From c97bd689f5bc952352652da5ab7ea309c38dfee3 Mon Sep 17 00:00:00 2001 From: Nick Downing Date: Thu, 19 Jan 2017 03:02:47 +1100 Subject: [PATCH] Can now compile headers with gcc --- lib/libstdc/arpa/inet.h | 2 + lib/libstdc/arpa/nameser.h | 2 + lib/libstdc/compat-4.1.h | 2 + lib/libstdc/compat-4.1/vlimit.c | 1 - lib/libstdc/compat-sys5.h | 2 + lib/libstdc/csu.h | 2 + lib/libstdc/disktab.h | 2 + lib/libstdc/errno.h | 105 ----- lib/libstdc/fcntl.h | 47 --- lib/libstdc/fstab.h | 2 + lib/libstdc/gen.h | 2 + lib/libstdc/gen/abort.c | 1 - lib/libstdc/gen/execvp.c | 1 - lib/libstdc/gen/getpass.c | 1 - lib/libstdc/gen/getpwnamuid.c | 1 - lib/libstdc/gen/mkstemp.c | 1 - lib/libstdc/gen/ndbm.c | 2 - lib/libstdc/gen/psignal.c | 1 - lib/libstdc/gen/siginterrupt.c | 1 - lib/libstdc/gen/siglist.c | 1 - lib/libstdc/gen/signal.c | 1 - lib/libstdc/gen/sleep.c | 1 - lib/libstdc/gen/syslog.c | 3 - lib/libstdc/gen/system.c | 1 - lib/libstdc/gen/usleep.c | 1 - lib/libstdc/grp.h | 2 + lib/libstdc/libstdc.patch | 188 ++++++--- lib/libstdc/math.h | 2 + lib/libstdc/memory.h | 2 + lib/libstdc/n.sh | 12 - lib/libstdc/ndbm.h | 2 + lib/libstdc/net.h | 2 + lib/libstdc/net/hosttable/gethostnamadr.c | 1 - lib/libstdc/net/named/gethostnamadr.c | 1 - lib/libstdc/net/rcmd.c | 3 - lib/libstdc/net/res_send.c | 1 - lib/libstdc/net/rexec.c | 1 - lib/libstdc/net/ruserpass.c | 1 - lib/libstdc/netdb.h | 2 + lib/libstdc/netns/ns.h | 2 + lib/libstdc/nlist.h | 2 + lib/libstdc/p.sh | 10 +- lib/libstdc/pwd.h | 2 + lib/libstdc/r.sh | 4 + lib/libstdc/s.sh | 38 ++ lib/libstdc/setjmp.h | 2 + lib/libstdc/signal.h | 121 ------ lib/libstdc/stdio.h | 2 + lib/libstdc/stdio/findiop.c | 1 - lib/libstdc/stdio/fopen.c | 1 - lib/libstdc/stdio/freopen.c | 1 - lib/libstdc/stdio/popen.c | 1 - lib/libstdc/string.h | 2 + lib/libstdc/strings.h | 2 + lib/libstdc/sys.h | 2 + lib/libstdc/sys/acct.h | 2 + lib/libstdc/sys/dir.h | 2 + lib/libstdc/sys/errno.h | 4 +- lib/libstdc/sys/exec.h | 2 + lib/libstdc/sys/file.h | 4 +- lib/libstdc/sys/ioctl.h | 3 +- lib/libstdc/sys/mount.h | 2 + lib/libstdc/sys/proc.h | 2 + lib/libstdc/sys/ptrace.h | 2 + lib/libstdc/sys/quota.h | 2 + lib/libstdc/sys/resource.h | 2 + lib/libstdc/sys/select.h | 2 + lib/libstdc/sys/signal.h | 4 +- lib/libstdc/sys/sigreturn.c | 2 - lib/libstdc/sys/sigstack.c | 2 - lib/libstdc/sys/sigvec.c | 2 - lib/libstdc/sys/socket.h | 2 + lib/libstdc/sys/stat.h | 2 + lib/libstdc/sys/syslog.h | 4 +- lib/libstdc/sys/time.h | 2 + lib/libstdc/sys/timeb.h | 2 + lib/libstdc/sys/times.h | 2 + lib/libstdc/sys/tty.h | 30 +- lib/libstdc/sys/uio.h | 2 + lib/libstdc/sys/user.h | 1 - lib/libstdc/sys/vlimit.h | 2 + lib/libstdc/sys/vtimes.h | 2 + lib/libstdc/sys/wait.h | 2 + lib/libstdc/syslog.h | 71 ---- lib/libstdc/time.h | 2 + lib/libstdc/ttyent.h | 2 + lib/libstdc/utmp.h | 2 + x_include/arpa/x_ftp.h | 74 ++++ x_include/arpa/x_inet.h | 54 +++ x_include/arpa/x_nameser.h | 204 ++++++++++ x_include/arpa/x_telnet.h | 89 ++++ x_include/arpa/x_tftp.h | 55 +++ x_include/machine | 1 + x_include/net/x_af.h | 44 ++ x_include/net/x_if.h | 225 ++++++++++ x_include/net/x_if_arp.h | 61 +++ x_include/net/x_netisr.h | 47 +++ x_include/net/x_raw_cb.h | 66 +++ x_include/net/x_route.h | 90 ++++ x_include/netimp/x_if_imp.h | 170 ++++++++ x_include/netimp/x_if_imphost.h | 104 +++++ x_include/netinet/x_icmp_var.h | 39 ++ x_include/netinet/x_if_ether.h | 91 +++++ x_include/netinet/x_in.h | 124 ++++++ x_include/netinet/x_in_pcb.h | 49 +++ x_include/netinet/x_in_systm.h | 38 ++ x_include/netinet/x_in_var.h | 54 +++ x_include/netinet/x_ip.h | 119 ++++++ x_include/netinet/x_ip_icmp.h | 112 +++++ x_include/netinet/x_ip_var.h | 108 +++++ x_include/netinet/x_tcp.h | 68 ++++ x_include/netinet/x_tcp_debug.h | 44 ++ x_include/netinet/x_tcp_fsm.h | 69 ++++ x_include/netinet/x_tcp_seq.h | 44 ++ x_include/netinet/x_tcp_timer.h | 119 ++++++ x_include/netinet/x_tcp_var.h | 104 +++++ x_include/netinet/x_tcpip.h | 42 ++ x_include/netinet/x_udp.h | 27 ++ x_include/netinet/x_udp_var.h | 50 +++ x_include/netns/x_idp.h | 29 ++ x_include/netns/x_idp_var.h | 29 ++ x_include/netns/x_ns.h | 155 +++++++ x_include/netns/x_ns_error.h | 74 ++++ x_include/netns/x_ns_if.h | 64 +++ x_include/netns/x_ns_pcb.h | 63 +++ x_include/netns/x_sp.h | 34 ++ x_include/netns/x_spidp.h | 45 ++ x_include/netns/x_spp_debug.h | 43 ++ x_include/netns/x_spp_var.h | 105 +++++ x_include/protocols/x_dumprestore.h | 67 +++ x_include/protocols/x_routed.h | 74 ++++ x_include/protocols/x_rwhod.h | 41 ++ x_include/protocols/x_talkd.h | 94 +++++ x_include/protocols/x_timed.h | 78 ++++ x_include/stdarg.h | 9 + x_include/sys/x_acct.h | 68 ++++ x_include/sys/x_bkmac.h | 38 ++ x_include/sys/x_buf.h | 198 +++++++++ x_include/sys/x_callout.h | 37 ++ x_include/sys/x_clist.h | 30 ++ x_include/sys/x_cmap.h | 95 +++++ x_include/sys/x_conf.h | 87 ++++ x_include/sys/x_dir.h | 143 +++++++ x_include/sys/x_dk.h | 40 ++ x_include/sys/x_dkbad.h | 56 +++ x_include/sys/x_dmap.h | 42 ++ x_include/sys/x_domain.h | 31 ++ x_include/sys/x_errno.h | 118 ++++++ x_include/sys/x_exec.h | 64 +++ x_include/sys/x_file.h | 226 ++++++++++ x_include/sys/x_fs.h | 388 ++++++++++++++++++ x_include/sys/x_gprof.h | 94 +++++ x_include/sys/x_inode.h | 208 ++++++++++ x_include/sys/x_ioctl.h | 306 ++++++++++++++ x_include/sys/x_kernel.h | 48 +++ x_include/sys/x_map.h | 56 +++ x_include/sys/x_mbuf.h | 168 ++++++++ x_include/sys/x_mman.h | 30 ++ x_include/sys/x_mount.h | 48 +++ x_include/sys/x_msgbuf.h | 26 ++ x_include/sys/x_mtio.h | 77 ++++ x_include/sys/x_namei.h | 99 +++++ x_include/sys/x_param.h | 201 +++++++++ x_include/sys/x_proc.h | 216 ++++++++++ x_include/sys/x_protosw.h | 190 +++++++++ x_include/sys/x_ptrace.h | 43 ++ x_include/sys/x_quota.h | 170 ++++++++ x_include/sys/x_reboot.h | 49 +++ x_include/sys/x_resource.h | 101 +++++ x_include/sys/x_seg.h | 23 ++ x_include/sys/x_select.h | 52 +++ x_include/sys/x_signal.h | 164 ++++++++ x_include/sys/x_socket.h | 212 ++++++++++ x_include/sys/x_socketvar.h | 158 +++++++ x_include/sys/x_stat.h | 69 ++++ x_include/sys/x_syslog.h | 87 ++++ x_include/sys/x_systm.h | 93 +++++ x_include/sys/x_tablet.h | 76 ++++ x_include/sys/x_text.h | 69 ++++ x_include/sys/x_time.h | 111 +++++ x_include/sys/x_timeb.h | 39 ++ x_include/sys/x_times.h | 39 ++ x_include/sys/x_trace.h | 93 +++++ x_include/sys/x_tty.h | 150 +++++++ x_include/sys/x_ttychars.h | 57 +++ x_include/sys/x_ttydev.h | 58 +++ x_include/sys/x_types.h | 83 ++++ x_include/sys/x_uio.h | 58 +++ x_include/sys/x_un.h | 26 ++ x_include/sys/x_unpcb.h | 55 +++ x_include/sys/x_user.h | 163 ++++++++ x_include/sys/x_vadvise.h | 29 ++ x_include/sys/x_vcmd.h | 31 ++ x_include/sys/x_vlimit.h | 42 ++ x_include/sys/x_vm.h | 31 ++ x_include/sys/x_vmmac.h | 182 +++++++++ x_include/sys/x_vmmeter.h | 115 ++++++ x_include/sys/x_vmparam.h | 31 ++ x_include/sys/x_vmsystm.h | 64 +++ x_include/sys/x_vsio.h | 128 ++++++ x_include/sys/x_vtimes.h | 50 +++ x_include/sys/x_wait.h | 90 ++++ x_include/vax/inline/x_inline.h | 88 ++++ x_include/vax/x_clock.h | 48 +++ x_include/vax/x_cons.h | 46 +++ x_include/vax/x_cpu.h | 120 ++++++ x_include/vax/x_crl.h | 85 ++++ x_include/vax/x_dkio.h | 27 ++ x_include/vax/x_flp.h | 58 +++ x_include/vax/x_frame.h | 31 ++ x_include/vax/x_ioa.h | 96 +++++ x_include/vax/x_ka630.h | 87 ++++ x_include/vax/x_machparam.h | 65 +++ x_include/vax/x_mem.h | 179 ++++++++ x_include/vax/x_mscp.h | 321 +++++++++++++++ x_include/vax/x_mtpr.h | 100 +++++ x_include/vax/x_nexus.h | 126 ++++++ x_include/vax/x_pcb.h | 75 ++++ x_include/vax/x_psl.h | 40 ++ x_include/vax/x_pte.h | 99 +++++ x_include/vax/x_reg.h | 40 ++ x_include/vax/x_rpb.h | 30 ++ x_include/vax/x_rsp.h | 94 +++++ x_include/vax/x_scb.h | 73 ++++ x_include/vax/x_tmscp.h | 330 +++++++++++++++ x_include/vax/x_trap.h | 35 ++ x_include/vax/x_vmparam.h | 171 ++++++++ x_include/vaxif/x_if_accreg.h | 74 ++++ x_include/vaxif/x_if_cssreg.h | 75 ++++ x_include/vaxif/x_if_ddnreg.h | 135 ++++++ x_include/vaxif/x_if_ddnvar.h | 124 ++++++ x_include/vaxif/x_if_dereg.h | 201 +++++++++ x_include/vaxif/x_if_dmc.h | 107 +++++ x_include/vaxif/x_if_ecreg.h | 72 ++++ x_include/vaxif/x_if_en.h | 39 ++ x_include/vaxif/x_if_enreg.h | 45 ++ x_include/vaxif/x_if_exreg.h | 257 ++++++++++++ x_include/vaxif/x_if_hdhreg.h | 109 +++++ x_include/vaxif/x_if_hy.h | 314 ++++++++++++++ x_include/vaxif/x_if_hyreg.h | 193 +++++++++ x_include/vaxif/x_if_il.h | 61 +++ x_include/vaxif/x_if_ilreg.h | 129 ++++++ x_include/vaxif/x_if_ix.h | 65 +++ x_include/vaxif/x_if_pclreg.h | 68 ++++ x_include/vaxif/x_if_qereg.h | 144 +++++++ x_include/vaxif/x_if_uba.h | 115 ++++++ x_include/vaxif/x_if_vv.h | 121 ++++++ x_include/vaxmba/x_hpreg.h | 172 ++++++++ x_include/vaxmba/x_htreg.h | 118 ++++++ x_include/vaxmba/x_mbareg.h | 143 +++++++ x_include/vaxmba/x_mbavar.h | 154 +++++++ x_include/vaxmba/x_mtreg.h | 138 +++++++ x_include/vaxuba/x_adreg.h | 38 ++ x_include/vaxuba/x_dhreg.h | 62 +++ x_include/vaxuba/x_dhureg.h | 148 +++++++ x_include/vaxuba/x_dmfreg.h | 156 +++++++ x_include/vaxuba/x_dmreg.h | 50 +++ x_include/vaxuba/x_dmzreg.h | 153 +++++++ x_include/vaxuba/x_dzreg.h | 96 +++++ x_include/vaxuba/x_idcreg.h | 111 +++++ x_include/vaxuba/x_ikreg.h | 124 ++++++ x_include/vaxuba/x_npreg.h | 476 ++++++++++++++++++++++ x_include/vaxuba/x_pdma.h | 22 + x_include/vaxuba/x_psreg.h | 215 ++++++++++ x_include/vaxuba/x_rkreg.h | 144 +++++++ x_include/vaxuba/x_rlreg.h | 122 ++++++ x_include/vaxuba/x_rxreg.h | 114 ++++++ x_include/vaxuba/x_tmreg.h | 107 +++++ x_include/vaxuba/x_tmscpreg.h | 89 ++++ x_include/vaxuba/x_tsreg.h | 173 ++++++++ x_include/vaxuba/x_ubareg.h | 199 +++++++++ x_include/vaxuba/x_ubavar.h | 218 ++++++++++ x_include/vaxuba/x_udareg.h | 63 +++ x_include/vaxuba/x_upreg.h | 174 ++++++++ x_include/vaxuba/x_utreg.h | 185 +++++++++ x_include/vaxuba/x_uureg.h | 42 ++ x_include/vaxuba/x_vpreg.h | 42 ++ x_include/vaxuba/x_vsreg.h | 242 +++++++++++ x_include/x_.h | 7 + x_include/x_a.out.h | 51 +++ x_include/x_ar.h | 29 ++ x_include/x_assert.h | 19 + x_include/x_compat-4.1.h | 37 ++ x_include/x_compat-sys5.h | 25 ++ x_include/x_csu.h | 34 ++ x_include/x_ctype.h | 35 ++ x_include/x_disktab.h | 51 +++ x_include/x_errno.h | 1 + x_include/x_fcntl.h | 1 + x_include/x_frame.h | 1 + x_include/x_fstab.h | 67 +++ x_include/x_gen.h | 141 +++++++ x_include/x_grp.h | 41 ++ x_include/x_inet.h | 8 + x_include/x_lastlog.h | 22 + x_include/x_math.h | 49 +++ x_include/x_memory.h | 49 +++ x_include/x_mp.h | 51 +++ x_include/x_mtab.h | 23 ++ x_include/x_ndbm.h | 89 ++++ x_include/x_net.h | 51 +++ x_include/x_netdb.h | 137 +++++++ x_include/x_nlist.h | 66 +++ x_include/x_ns.h | 8 + x_include/x_pcc.h | 236 +++++++++++ x_include/x_pwd.h | 42 ++ x_include/x_ranlib.h | 26 ++ x_include/x_resolv.h | 51 +++ x_include/x_setjmp.h | 31 ++ x_include/x_sgtty.h | 14 + x_include/x_signal.h | 1 + x_include/x_stab.h | 49 +++ x_include/x_stdio.h | 208 ++++++++++ x_include/x_string.h | 73 ++++ x_include/x_strings.h | 65 +++ x_include/x_struct.h | 16 + x_include/x_sys.h | 64 +++ x_include/x_syscall.h | 165 ++++++++ x_include/x_sysexits.h | 89 ++++ x_include/x_syslog.h | 1 + x_include/x_time.h | 45 ++ x_include/x_ttyent.h | 47 +++ x_include/x_utmp.h | 45 ++ x_include/x_varargs.h | 14 + x_include/x_vfont.h | 34 ++ xify/stdarg.h | 9 + xify/x_.h | 9 + xify/xify.c | 7 +- 328 files changed, 22037 insertions(+), 475 deletions(-) delete mode 100644 lib/libstdc/errno.h delete mode 100644 lib/libstdc/fcntl.h create mode 100755 lib/libstdc/s.sh delete mode 100644 lib/libstdc/signal.h delete mode 100644 lib/libstdc/syslog.h create mode 100644 x_include/arpa/x_ftp.h create mode 100644 x_include/arpa/x_inet.h create mode 100644 x_include/arpa/x_nameser.h create mode 100644 x_include/arpa/x_telnet.h create mode 100644 x_include/arpa/x_tftp.h create mode 120000 x_include/machine create mode 100644 x_include/net/x_af.h create mode 100644 x_include/net/x_if.h create mode 100644 x_include/net/x_if_arp.h create mode 100644 x_include/net/x_netisr.h create mode 100644 x_include/net/x_raw_cb.h create mode 100644 x_include/net/x_route.h create mode 100644 x_include/netimp/x_if_imp.h create mode 100644 x_include/netimp/x_if_imphost.h create mode 100644 x_include/netinet/x_icmp_var.h create mode 100644 x_include/netinet/x_if_ether.h create mode 100644 x_include/netinet/x_in.h create mode 100644 x_include/netinet/x_in_pcb.h create mode 100644 x_include/netinet/x_in_systm.h create mode 100644 x_include/netinet/x_in_var.h create mode 100644 x_include/netinet/x_ip.h create mode 100644 x_include/netinet/x_ip_icmp.h create mode 100644 x_include/netinet/x_ip_var.h create mode 100644 x_include/netinet/x_tcp.h create mode 100644 x_include/netinet/x_tcp_debug.h create mode 100644 x_include/netinet/x_tcp_fsm.h create mode 100644 x_include/netinet/x_tcp_seq.h create mode 100644 x_include/netinet/x_tcp_timer.h create mode 100644 x_include/netinet/x_tcp_var.h create mode 100644 x_include/netinet/x_tcpip.h create mode 100644 x_include/netinet/x_udp.h create mode 100644 x_include/netinet/x_udp_var.h create mode 100644 x_include/netns/x_idp.h create mode 100644 x_include/netns/x_idp_var.h create mode 100644 x_include/netns/x_ns.h create mode 100644 x_include/netns/x_ns_error.h create mode 100644 x_include/netns/x_ns_if.h create mode 100644 x_include/netns/x_ns_pcb.h create mode 100644 x_include/netns/x_sp.h create mode 100644 x_include/netns/x_spidp.h create mode 100644 x_include/netns/x_spp_debug.h create mode 100644 x_include/netns/x_spp_var.h create mode 100644 x_include/protocols/x_dumprestore.h create mode 100644 x_include/protocols/x_routed.h create mode 100644 x_include/protocols/x_rwhod.h create mode 100644 x_include/protocols/x_talkd.h create mode 100644 x_include/protocols/x_timed.h create mode 100644 x_include/stdarg.h create mode 100644 x_include/sys/x_acct.h create mode 100644 x_include/sys/x_bkmac.h create mode 100644 x_include/sys/x_buf.h create mode 100644 x_include/sys/x_callout.h create mode 100644 x_include/sys/x_clist.h create mode 100644 x_include/sys/x_cmap.h create mode 100644 x_include/sys/x_conf.h create mode 100644 x_include/sys/x_dir.h create mode 100644 x_include/sys/x_dk.h create mode 100644 x_include/sys/x_dkbad.h create mode 100644 x_include/sys/x_dmap.h create mode 100644 x_include/sys/x_domain.h create mode 100644 x_include/sys/x_errno.h create mode 100644 x_include/sys/x_exec.h create mode 100644 x_include/sys/x_file.h create mode 100644 x_include/sys/x_fs.h create mode 100644 x_include/sys/x_gprof.h create mode 100644 x_include/sys/x_inode.h create mode 100644 x_include/sys/x_ioctl.h create mode 100644 x_include/sys/x_kernel.h create mode 100644 x_include/sys/x_map.h create mode 100644 x_include/sys/x_mbuf.h create mode 100644 x_include/sys/x_mman.h create mode 100644 x_include/sys/x_mount.h create mode 100644 x_include/sys/x_msgbuf.h create mode 100644 x_include/sys/x_mtio.h create mode 100644 x_include/sys/x_namei.h create mode 100644 x_include/sys/x_param.h create mode 100644 x_include/sys/x_proc.h create mode 100644 x_include/sys/x_protosw.h create mode 100644 x_include/sys/x_ptrace.h create mode 100644 x_include/sys/x_quota.h create mode 100644 x_include/sys/x_reboot.h create mode 100644 x_include/sys/x_resource.h create mode 100644 x_include/sys/x_seg.h create mode 100644 x_include/sys/x_select.h create mode 100644 x_include/sys/x_signal.h create mode 100644 x_include/sys/x_socket.h create mode 100644 x_include/sys/x_socketvar.h create mode 100644 x_include/sys/x_stat.h create mode 100644 x_include/sys/x_syslog.h create mode 100644 x_include/sys/x_systm.h create mode 100644 x_include/sys/x_tablet.h create mode 100644 x_include/sys/x_text.h create mode 100644 x_include/sys/x_time.h create mode 100644 x_include/sys/x_timeb.h create mode 100644 x_include/sys/x_times.h create mode 100644 x_include/sys/x_trace.h create mode 100644 x_include/sys/x_tty.h create mode 100644 x_include/sys/x_ttychars.h create mode 100644 x_include/sys/x_ttydev.h create mode 100644 x_include/sys/x_types.h create mode 100644 x_include/sys/x_uio.h create mode 100644 x_include/sys/x_un.h create mode 100644 x_include/sys/x_unpcb.h create mode 100644 x_include/sys/x_user.h create mode 100644 x_include/sys/x_vadvise.h create mode 100644 x_include/sys/x_vcmd.h create mode 100644 x_include/sys/x_vlimit.h create mode 100644 x_include/sys/x_vm.h create mode 100644 x_include/sys/x_vmmac.h create mode 100644 x_include/sys/x_vmmeter.h create mode 100644 x_include/sys/x_vmparam.h create mode 100644 x_include/sys/x_vmsystm.h create mode 100644 x_include/sys/x_vsio.h create mode 100644 x_include/sys/x_vtimes.h create mode 100644 x_include/sys/x_wait.h create mode 100644 x_include/vax/inline/x_inline.h create mode 100644 x_include/vax/x_clock.h create mode 100644 x_include/vax/x_cons.h create mode 100644 x_include/vax/x_cpu.h create mode 100644 x_include/vax/x_crl.h create mode 100644 x_include/vax/x_dkio.h create mode 100644 x_include/vax/x_flp.h create mode 100644 x_include/vax/x_frame.h create mode 100644 x_include/vax/x_ioa.h create mode 100644 x_include/vax/x_ka630.h create mode 100644 x_include/vax/x_machparam.h create mode 100644 x_include/vax/x_mem.h create mode 100644 x_include/vax/x_mscp.h create mode 100644 x_include/vax/x_mtpr.h create mode 100644 x_include/vax/x_nexus.h create mode 100644 x_include/vax/x_pcb.h create mode 100644 x_include/vax/x_psl.h create mode 100644 x_include/vax/x_pte.h create mode 100644 x_include/vax/x_reg.h create mode 100644 x_include/vax/x_rpb.h create mode 100644 x_include/vax/x_rsp.h create mode 100644 x_include/vax/x_scb.h create mode 100644 x_include/vax/x_tmscp.h create mode 100644 x_include/vax/x_trap.h create mode 100644 x_include/vax/x_vmparam.h create mode 100644 x_include/vaxif/x_if_accreg.h create mode 100644 x_include/vaxif/x_if_cssreg.h create mode 100644 x_include/vaxif/x_if_ddnreg.h create mode 100644 x_include/vaxif/x_if_ddnvar.h create mode 100644 x_include/vaxif/x_if_dereg.h create mode 100644 x_include/vaxif/x_if_dmc.h create mode 100644 x_include/vaxif/x_if_ecreg.h create mode 100644 x_include/vaxif/x_if_en.h create mode 100644 x_include/vaxif/x_if_enreg.h create mode 100644 x_include/vaxif/x_if_exreg.h create mode 100644 x_include/vaxif/x_if_hdhreg.h create mode 100644 x_include/vaxif/x_if_hy.h create mode 100644 x_include/vaxif/x_if_hyreg.h create mode 100644 x_include/vaxif/x_if_il.h create mode 100644 x_include/vaxif/x_if_ilreg.h create mode 100644 x_include/vaxif/x_if_ix.h create mode 100644 x_include/vaxif/x_if_pclreg.h create mode 100644 x_include/vaxif/x_if_qereg.h create mode 100644 x_include/vaxif/x_if_uba.h create mode 100644 x_include/vaxif/x_if_vv.h create mode 100644 x_include/vaxmba/x_hpreg.h create mode 100644 x_include/vaxmba/x_htreg.h create mode 100644 x_include/vaxmba/x_mbareg.h create mode 100644 x_include/vaxmba/x_mbavar.h create mode 100644 x_include/vaxmba/x_mtreg.h create mode 100644 x_include/vaxuba/x_adreg.h create mode 100644 x_include/vaxuba/x_dhreg.h create mode 100644 x_include/vaxuba/x_dhureg.h create mode 100644 x_include/vaxuba/x_dmfreg.h create mode 100644 x_include/vaxuba/x_dmreg.h create mode 100644 x_include/vaxuba/x_dmzreg.h create mode 100644 x_include/vaxuba/x_dzreg.h create mode 100644 x_include/vaxuba/x_idcreg.h create mode 100644 x_include/vaxuba/x_ikreg.h create mode 100644 x_include/vaxuba/x_npreg.h create mode 100644 x_include/vaxuba/x_pdma.h create mode 100644 x_include/vaxuba/x_psreg.h create mode 100644 x_include/vaxuba/x_rkreg.h create mode 100644 x_include/vaxuba/x_rlreg.h create mode 100644 x_include/vaxuba/x_rxreg.h create mode 100644 x_include/vaxuba/x_tmreg.h create mode 100644 x_include/vaxuba/x_tmscpreg.h create mode 100644 x_include/vaxuba/x_tsreg.h create mode 100644 x_include/vaxuba/x_ubareg.h create mode 100644 x_include/vaxuba/x_ubavar.h create mode 100644 x_include/vaxuba/x_udareg.h create mode 100644 x_include/vaxuba/x_upreg.h create mode 100644 x_include/vaxuba/x_utreg.h create mode 100644 x_include/vaxuba/x_uureg.h create mode 100644 x_include/vaxuba/x_vpreg.h create mode 100644 x_include/vaxuba/x_vsreg.h create mode 100644 x_include/x_.h create mode 100644 x_include/x_a.out.h create mode 100644 x_include/x_ar.h create mode 100644 x_include/x_assert.h create mode 100644 x_include/x_compat-4.1.h create mode 100644 x_include/x_compat-sys5.h create mode 100644 x_include/x_csu.h create mode 100644 x_include/x_ctype.h create mode 100644 x_include/x_disktab.h create mode 120000 x_include/x_errno.h create mode 120000 x_include/x_fcntl.h create mode 120000 x_include/x_frame.h create mode 100644 x_include/x_fstab.h create mode 100644 x_include/x_gen.h create mode 100644 x_include/x_grp.h create mode 100644 x_include/x_inet.h create mode 100644 x_include/x_lastlog.h create mode 100644 x_include/x_math.h create mode 100644 x_include/x_memory.h create mode 100644 x_include/x_mp.h create mode 100644 x_include/x_mtab.h create mode 100644 x_include/x_ndbm.h create mode 100644 x_include/x_net.h create mode 100644 x_include/x_netdb.h create mode 100644 x_include/x_nlist.h create mode 100644 x_include/x_ns.h create mode 100644 x_include/x_pcc.h create mode 100644 x_include/x_pwd.h create mode 100644 x_include/x_ranlib.h create mode 100644 x_include/x_resolv.h create mode 100644 x_include/x_setjmp.h create mode 100644 x_include/x_sgtty.h create mode 120000 x_include/x_signal.h create mode 100644 x_include/x_stab.h create mode 100644 x_include/x_stdio.h create mode 100644 x_include/x_string.h create mode 100644 x_include/x_strings.h create mode 100644 x_include/x_struct.h create mode 100644 x_include/x_sys.h create mode 100644 x_include/x_syscall.h create mode 100644 x_include/x_sysexits.h create mode 120000 x_include/x_syslog.h create mode 100644 x_include/x_time.h create mode 100644 x_include/x_ttyent.h create mode 100644 x_include/x_utmp.h create mode 100644 x_include/x_varargs.h create mode 100644 x_include/x_vfont.h create mode 100644 xify/stdarg.h create mode 100644 xify/x_.h diff --git a/lib/libstdc/arpa/inet.h b/lib/libstdc/arpa/inet.h index 2465e3c..68eb50a 100644 --- a/lib/libstdc/arpa/inet.h +++ b/lib/libstdc/arpa/inet.h @@ -21,6 +21,7 @@ /*struct in_addr inet_makeaddr();*/ /*unsigned long inet_network();*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -46,5 +47,6 @@ u_long inet_network __P((register char *cp)); /* inet/inet_ntoa.c */ char *inet_ntoa __P((struct in_addr in)); +#endif #endif diff --git a/lib/libstdc/arpa/nameser.h b/lib/libstdc/arpa/nameser.h index f085c01..99efb19 100644 --- a/lib/libstdc/arpa/nameser.h +++ b/lib/libstdc/arpa/nameser.h @@ -161,6 +161,7 @@ struct rrec { /*extern u_short getshort();*/ /*extern u_long getlong();*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -196,5 +197,6 @@ int res_mkquery __P((int op, char *dname, int class, int type, char *data, int d /* net/res_send.c */ int res_send __P((char *buf, int buflen, char *answer, int anslen)); int _res_close __P((void)); +#endif #endif diff --git a/lib/libstdc/compat-4.1.h b/lib/libstdc/compat-4.1.h index cdfe77f..1cdb38d 100644 --- a/lib/libstdc/compat-4.1.h +++ b/lib/libstdc/compat-4.1.h @@ -9,6 +9,7 @@ #include #include +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -29,5 +30,6 @@ int rand __P((void)); /* compat-4.1/tell.c */ long tell __P((int f)); +#endif #endif diff --git a/lib/libstdc/compat-4.1/vlimit.c b/lib/libstdc/compat-4.1/vlimit.c index 1ec88db..0361294 100644 --- a/lib/libstdc/compat-4.1/vlimit.c +++ b/lib/libstdc/compat-4.1/vlimit.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/lib/libstdc/compat-sys5.h b/lib/libstdc/compat-sys5.h index 3824fdf..39dd615 100644 --- a/lib/libstdc/compat-sys5.h +++ b/lib/libstdc/compat-sys5.h @@ -4,6 +4,7 @@ #include #include +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -17,5 +18,6 @@ int getopt __P((int nargc, char **nargv, char *ostr)); /* compat-sys5/tmpnam.c */ char *tmpnam __P((char *s)); +#endif #endif diff --git a/lib/libstdc/csu.h b/lib/libstdc/csu.h index 65ab73e..05596fb 100644 --- a/lib/libstdc/csu.h +++ b/lib/libstdc/csu.h @@ -1,6 +1,7 @@ #ifndef _CSU_H_ #define _CSU_H_ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -26,5 +27,6 @@ int monstartup __P((char *lowpc, char *highpc)); int mcount __P((void)); int monitor __P((char *lowpc, char *highpc, char *buf, int bufsiz, int cntsiz)); int moncontrol __P((int mode)); +#endif #endif diff --git a/lib/libstdc/disktab.h b/lib/libstdc/disktab.h index 45ebe82..531770f 100644 --- a/lib/libstdc/disktab.h +++ b/lib/libstdc/disktab.h @@ -33,6 +33,7 @@ struct disktab { /*struct disktab *getdiskbyname();*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -43,5 +44,6 @@ struct disktab { /* gen/disktab.c */ struct disktab *getdiskbyname __P((char *name)); +#endif #endif diff --git a/lib/libstdc/errno.h b/lib/libstdc/errno.h deleted file mode 100644 index cfbb01e..0000000 --- a/lib/libstdc/errno.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef _ERRNO_H_ -#define _ERRNO_H_ - -#include - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - * - * @(#)errno.h 7.1 (Berkeley) 6/4/86 - */ - -/* - * Error codes - */ - -#define EPERM 1 /* Not owner */ -#define ENOENT 2 /* No such file or directory */ -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* I/O error */ -#define ENXIO 6 /* No such device or address */ -#define E2BIG 7 /* Arg list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file number */ -#define ECHILD 10 /* No children */ -#define EAGAIN 11 /* No more processes */ -#define ENOMEM 12 /* Not enough core */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -#define ENOTBLK 15 /* Block device required */ -#define EBUSY 16 /* Mount device busy */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* No such device */ -#define ENOTDIR 20 /* Not a directory*/ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* File table overflow */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Not a typewriter */ -#define ETXTBSY 26 /* Text file busy */ -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ - -/* math software */ -#define EDOM 33 /* Argument too large */ -#define ERANGE 34 /* Result too large */ - -/* non-blocking and interrupt i/o */ -#define EWOULDBLOCK 35 /* Operation would block */ -#define EDEADLK EWOULDBLOCK /* ditto */ -#define EINPROGRESS 36 /* Operation now in progress */ -#define EALREADY 37 /* Operation already in progress */ - -/* ipc/network software */ - - /* argument errors */ -#define ENOTSOCK 38 /* Socket operation on non-socket */ -#define EDESTADDRREQ 39 /* Destination address required */ -#define EMSGSIZE 40 /* Message too long */ -#define EPROTOTYPE 41 /* Protocol wrong type for socket */ -#define ENOPROTOOPT 42 /* Protocol not available */ -#define EPROTONOSUPPORT 43 /* Protocol not supported */ -#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ -#define EOPNOTSUPP 45 /* Operation not supported on socket */ -#define EPFNOSUPPORT 46 /* Protocol family not supported */ -#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ -#define EADDRINUSE 48 /* Address already in use */ -#define EADDRNOTAVAIL 49 /* Can't assign requested address */ - - /* operational errors */ -#define ENETDOWN 50 /* Network is down */ -#define ENETUNREACH 51 /* Network is unreachable */ -#define ENETRESET 52 /* Network dropped connection on reset */ -#define ECONNABORTED 53 /* Software caused connection abort */ -#define ECONNRESET 54 /* Connection reset by peer */ -#define ENOBUFS 55 /* No buffer space available */ -#define EISCONN 56 /* Socket is already connected */ -#define ENOTCONN 57 /* Socket is not connected */ -#define ESHUTDOWN 58 /* Can't send after socket shutdown */ -#define ETOOMANYREFS 59 /* Too many references: can't splice */ -#define ETIMEDOUT 60 /* Connection timed out */ -#define ECONNREFUSED 61 /* Connection refused */ - - /* */ -#define ELOOP 62 /* Too many levels of symbolic links */ -#define ENAMETOOLONG 63 /* File name too long */ - -/* should be rearranged */ -#define EHOSTDOWN 64 /* Host is down */ -#define EHOSTUNREACH 65 /* No route to host */ -#define ENOTEMPTY 66 /* Directory not empty */ - -/* quotas & mush */ -#define EPROCLIM 67 /* Too many processes */ -#define EUSERS 68 /* Too many users */ -#define EDQUOT 69 /* Disc quota exceeded */ - -#endif diff --git a/lib/libstdc/fcntl.h b/lib/libstdc/fcntl.h deleted file mode 100644 index 67d7c11..0000000 --- a/lib/libstdc/fcntl.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef _FCNTL_H_ -#define _FCNTL_H_ - -#include - -/* - * Copyright (c) 1983 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - * - * @(#)fcntl.h 5.2 (Berkeley) 1/8/86 - */ - -/* - * Flag values accessible to open(2) and fcntl(2)-- copied from - * . (The first three can only be set by open.) - */ -#define O_RDONLY 000 /* open for reading */ -#define O_WRONLY 001 /* open for writing */ -#define O_RDWR 002 /* open for read & write */ -#define O_NDELAY FNDELAY /* non-blocking open */ - /* really non-blocking I/O for fcntl */ -#define O_APPEND FAPPEND /* append on each write */ -#define O_CREAT FCREAT /* open with file create */ -#define O_TRUNC FTRUNC /* open with truncation */ -#define O_EXCL FEXCL /* error on create if file exists */ - -#ifndef F_DUPFD -/* fcntl(2) requests */ -#define F_DUPFD 0 /* Duplicate fildes */ -#define F_GETFD 1 /* Get fildes flags */ -#define F_SETFD 2 /* Set fildes flags */ -#define F_GETFL 3 /* Get file flags */ -#define F_SETFL 4 /* Set file flags */ -#define F_GETOWN 5 /* Get owner */ -#define F_SETOWN 6 /* Set owner */ - -/* flags for F_GETFL, F_SETFL-- copied from */ -#define FNDELAY 00004 /* non-blocking reads */ -#define FAPPEND 00010 /* append on each write */ -#define FASYNC 00100 /* signal pgrp when data ready */ -#define FCREAT 01000 /* create if nonexistant */ -#define FTRUNC 02000 /* truncate to zero length */ -#define FEXCL 04000 /* error if already created */ -#endif - -#endif diff --git a/lib/libstdc/fstab.h b/lib/libstdc/fstab.h index c1ac13a..e42a66f 100644 --- a/lib/libstdc/fstab.h +++ b/lib/libstdc/fstab.h @@ -44,6 +44,7 @@ struct fstab{ /*int setfsent();*/ /*int endfsent();*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -59,5 +60,6 @@ struct fstab *getfsent __P((void)); struct fstab *getfsspec __P((char *name)); struct fstab *getfsfile __P((char *name)); struct fstab *getfstype __P((char *type)); +#endif #endif diff --git a/lib/libstdc/gen.h b/lib/libstdc/gen.h index 58ab5d6..251b351 100644 --- a/lib/libstdc/gen.h +++ b/lib/libstdc/gen.h @@ -29,6 +29,7 @@ struct vaxque { /* queue format expected by VAX queue instructions */ struct vaxque *vq_prev; }; +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -133,5 +134,6 @@ char *timezone __P((int zone, int dst)); /* gen/valloc.c */ char *valloc __P((int i)); +#endif #endif diff --git a/lib/libstdc/gen/abort.c b/lib/libstdc/gen/abort.c index 5babb51..af1fbbb 100644 --- a/lib/libstdc/gen/abort.c +++ b/lib/libstdc/gen/abort.c @@ -1,5 +1,4 @@ #include -#include #include #include diff --git a/lib/libstdc/gen/execvp.c b/lib/libstdc/gen/execvp.c index f720b61..9be5ef1 100644 --- a/lib/libstdc/gen/execvp.c +++ b/lib/libstdc/gen/execvp.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/lib/libstdc/gen/getpass.c b/lib/libstdc/gen/getpass.c index b0d7717..d2c1f3f 100644 --- a/lib/libstdc/gen/getpass.c +++ b/lib/libstdc/gen/getpass.c @@ -1,5 +1,4 @@ #include -#include #include #include #include diff --git a/lib/libstdc/gen/getpwnamuid.c b/lib/libstdc/gen/getpwnamuid.c index 95468cc..29a922e 100644 --- a/lib/libstdc/gen/getpwnamuid.c +++ b/lib/libstdc/gen/getpwnamuid.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/lib/libstdc/gen/mkstemp.c b/lib/libstdc/gen/mkstemp.c index 5ec9fff..9ae25bd 100644 --- a/lib/libstdc/gen/mkstemp.c +++ b/lib/libstdc/gen/mkstemp.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/lib/libstdc/gen/ndbm.c b/lib/libstdc/gen/ndbm.c index a022b2d..808b6d8 100644 --- a/lib/libstdc/gen/ndbm.c +++ b/lib/libstdc/gen/ndbm.c @@ -1,5 +1,3 @@ -#include -#include #include #include #include diff --git a/lib/libstdc/gen/psignal.c b/lib/libstdc/gen/psignal.c index 72eca66..48eae46 100644 --- a/lib/libstdc/gen/psignal.c +++ b/lib/libstdc/gen/psignal.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/lib/libstdc/gen/siginterrupt.c b/lib/libstdc/gen/siginterrupt.c index 2e53205..22cb5ab 100644 --- a/lib/libstdc/gen/siginterrupt.c +++ b/lib/libstdc/gen/siginterrupt.c @@ -1,4 +1,3 @@ -#include #include /* diff --git a/lib/libstdc/gen/siglist.c b/lib/libstdc/gen/siglist.c index 0b912f7..71d646d 100644 --- a/lib/libstdc/gen/siglist.c +++ b/lib/libstdc/gen/siglist.c @@ -1,4 +1,3 @@ -#include #include /* diff --git a/lib/libstdc/gen/signal.c b/lib/libstdc/gen/signal.c index 86dbb39..f1da9f4 100644 --- a/lib/libstdc/gen/signal.c +++ b/lib/libstdc/gen/signal.c @@ -1,4 +1,3 @@ -#include #include /* diff --git a/lib/libstdc/gen/sleep.c b/lib/libstdc/gen/sleep.c index 3d6eca3..1ea08e5 100644 --- a/lib/libstdc/gen/sleep.c +++ b/lib/libstdc/gen/sleep.c @@ -1,4 +1,3 @@ -#include #include #include diff --git a/lib/libstdc/gen/syslog.c b/lib/libstdc/gen/syslog.c index d410beb..92646e5 100644 --- a/lib/libstdc/gen/syslog.c +++ b/lib/libstdc/gen/syslog.c @@ -1,9 +1,6 @@ -#include -#include #include #include #include -#include #include #include #include diff --git a/lib/libstdc/gen/system.c b/lib/libstdc/gen/system.c index faf5940..bb41d76 100644 --- a/lib/libstdc/gen/system.c +++ b/lib/libstdc/gen/system.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/lib/libstdc/gen/usleep.c b/lib/libstdc/gen/usleep.c index 5001b7b..e02b93c 100644 --- a/lib/libstdc/gen/usleep.c +++ b/lib/libstdc/gen/usleep.c @@ -1,4 +1,3 @@ -#include #include #include diff --git a/lib/libstdc/grp.h b/lib/libstdc/grp.h index 3e85061..7197fbf 100644 --- a/lib/libstdc/grp.h +++ b/lib/libstdc/grp.h @@ -12,6 +12,7 @@ struct group { /* see getgrent(3) */ /*struct group *getgrent(), *getgrgid(), *getgrnam();*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -33,5 +34,6 @@ struct group *getgrnam __P((register char *name)); /* gen/initgroups.c */ int initgroups __P((char *uname, int agroup)); +#endif #endif diff --git a/lib/libstdc/libstdc.patch b/lib/libstdc/libstdc.patch index 5f8ec43..5f5c599 100644 --- a/lib/libstdc/libstdc.patch +++ b/lib/libstdc/libstdc.patch @@ -1,6 +1,6 @@ diff --unified --recursive --new-file libstdc.orig/a.out.h libstdc/a.out.h ---- libstdc.orig/a.out.h 2017-01-19 01:18:23.137552484 +1100 -+++ libstdc/a.out.h 2017-01-19 01:18:23.145552491 +1100 +--- libstdc.orig/a.out.h 2017-01-19 02:19:04.343169028 +1100 ++++ libstdc/a.out.h 2017-01-19 02:19:04.351169187 +1100 @@ -39,44 +39,4 @@ :4; /* nothing, yet */ }; @@ -48,8 +48,8 @@ diff --unified --recursive --new-file libstdc.orig/a.out.h libstdc/a.out.h -#define N_FORMAT "%08x" +#include diff --unified --recursive --new-file libstdc.orig/compat-4.1/gtty.c libstdc/compat-4.1/gtty.c ---- libstdc.orig/compat-4.1/gtty.c 2017-01-19 01:18:23.137552484 +1100 -+++ libstdc/compat-4.1/gtty.c 2017-01-19 01:18:23.145552491 +1100 +--- libstdc.orig/compat-4.1/gtty.c 2017-01-19 02:19:04.339168949 +1100 ++++ libstdc/compat-4.1/gtty.c 2017-01-19 02:19:04.351169187 +1100 @@ -15,7 +15,7 @@ #include @@ -60,8 +60,8 @@ diff --unified --recursive --new-file libstdc.orig/compat-4.1/gtty.c libstdc/com return(ioctl(fd, TIOCGETP, ap)); } diff --unified --recursive --new-file libstdc.orig/compat-4.1/stty.c libstdc/compat-4.1/stty.c ---- libstdc.orig/compat-4.1/stty.c 2017-01-19 01:18:23.137552484 +1100 -+++ libstdc/compat-4.1/stty.c 2017-01-19 01:18:23.145552491 +1100 +--- libstdc.orig/compat-4.1/stty.c 2017-01-19 02:19:04.339168949 +1100 ++++ libstdc/compat-4.1/stty.c 2017-01-19 02:19:04.351169187 +1100 @@ -15,7 +15,7 @@ #include @@ -71,9 +71,53 @@ diff --unified --recursive --new-file libstdc.orig/compat-4.1/stty.c libstdc/com return(ioctl(fd, TIOCSETP, ap)); } +diff --unified --recursive --new-file libstdc.orig/fcntl.h libstdc/fcntl.h +--- libstdc.orig/fcntl.h 2017-01-19 02:19:04.343169028 +1100 ++++ libstdc/fcntl.h 1970-01-01 10:00:00.000000000 +1000 +@@ -1,40 +0,0 @@ +-/* +- * Copyright (c) 1983 Regents of the University of California. +- * All rights reserved. The Berkeley software License Agreement +- * specifies the terms and conditions for redistribution. +- * +- * @(#)fcntl.h 5.2 (Berkeley) 1/8/86 +- */ +- +-/* +- * Flag values accessible to open(2) and fcntl(2)-- copied from +- * . (The first three can only be set by open.) +- */ +-#define O_RDONLY 000 /* open for reading */ +-#define O_WRONLY 001 /* open for writing */ +-#define O_RDWR 002 /* open for read & write */ +-#define O_NDELAY FNDELAY /* non-blocking open */ +- /* really non-blocking I/O for fcntl */ +-#define O_APPEND FAPPEND /* append on each write */ +-#define O_CREAT FCREAT /* open with file create */ +-#define O_TRUNC FTRUNC /* open with truncation */ +-#define O_EXCL FEXCL /* error on create if file exists */ +- +-#ifndef F_DUPFD +-/* fcntl(2) requests */ +-#define F_DUPFD 0 /* Duplicate fildes */ +-#define F_GETFD 1 /* Get fildes flags */ +-#define F_SETFD 2 /* Set fildes flags */ +-#define F_GETFL 3 /* Get file flags */ +-#define F_SETFL 4 /* Set file flags */ +-#define F_GETOWN 5 /* Get owner */ +-#define F_SETOWN 6 /* Set owner */ +- +-/* flags for F_GETFL, F_SETFL-- copied from */ +-#define FNDELAY 00004 /* non-blocking reads */ +-#define FAPPEND 00010 /* append on each write */ +-#define FASYNC 00100 /* signal pgrp when data ready */ +-#define FCREAT 01000 /* create if nonexistant */ +-#define FTRUNC 02000 /* truncate to zero length */ +-#define FEXCL 04000 /* error if already created */ +-#endif diff --unified --recursive --new-file libstdc.orig/gen/insque.c libstdc/gen/insque.c ---- libstdc.orig/gen/insque.c 2017-01-19 01:18:23.141552487 +1100 -+++ libstdc/gen/insque.c 2017-01-19 01:18:23.145552491 +1100 +--- libstdc.orig/gen/insque.c 2017-01-19 02:19:04.347169107 +1100 ++++ libstdc/gen/insque.c 2017-01-19 02:19:04.351169187 +1100 @@ -8,16 +8,19 @@ static char sccsid[] = "@(#)insque.c 5.1 (Berkeley) 1/27/87"; #endif @@ -99,7 +143,7 @@ diff --unified --recursive --new-file libstdc.orig/gen/insque.c libstdc/gen/insq insque(e, prev) register struct vaxque *e, *prev; { diff --unified --recursive --new-file libstdc.orig/gen/popen.c libstdc/gen/popen.c ---- libstdc.orig/gen/popen.c 2017-01-19 01:18:23.145552491 +1100 +--- libstdc.orig/gen/popen.c 2017-01-19 02:19:04.347169107 +1100 +++ libstdc/gen/popen.c 1970-01-01 10:00:00.000000000 +1000 @@ -1,77 +0,0 @@ -/* @@ -180,8 +224,8 @@ diff --unified --recursive --new-file libstdc.orig/gen/popen.c libstdc/gen/popen - return (pid == -1 ? -1 : status); -} diff --unified --recursive --new-file libstdc.orig/gen/regex.c libstdc/gen/regex.c ---- libstdc.orig/gen/regex.c 2017-01-19 01:18:23.145552491 +1100 -+++ libstdc/gen/regex.c 2017-01-19 01:18:23.145552491 +1100 +--- libstdc.orig/gen/regex.c 2017-01-19 02:19:04.347169107 +1100 ++++ libstdc/gen/regex.c 2017-01-19 02:19:04.351169187 +1100 @@ -8,8 +8,6 @@ static char sccsid[] = "@(#)regex.c 5.2 (Berkeley) 3/9/86"; #endif @@ -192,8 +236,8 @@ diff --unified --recursive --new-file libstdc.orig/gen/regex.c libstdc/gen/regex * routines to do regular expression matching * diff --unified --recursive --new-file libstdc.orig/gen/remque.c libstdc/gen/remque.c ---- libstdc.orig/gen/remque.c 2017-01-19 01:18:23.145552491 +1100 -+++ libstdc/gen/remque.c 2017-01-19 01:18:23.145552491 +1100 +--- libstdc.orig/gen/remque.c 2017-01-19 02:19:04.347169107 +1100 ++++ libstdc/gen/remque.c 2017-01-19 02:19:04.351169187 +1100 @@ -8,16 +8,19 @@ static char sccsid[] = "@(#)remque.c 5.1 (Berkeley) 1/27/87"; #endif @@ -220,7 +264,7 @@ diff --unified --recursive --new-file libstdc.orig/gen/remque.c libstdc/gen/remq register struct vaxque *e; { diff --unified --recursive --new-file libstdc.orig/gen.h libstdc/gen.h --- libstdc.orig/gen.h 1970-01-01 10:00:00.000000000 +1000 -+++ libstdc/gen.h 2017-01-19 01:18:23.149552495 +1100 ++++ libstdc/gen.h 2017-01-19 02:19:04.351169187 +1100 @@ -0,0 +1,5 @@ +/* formerly duplicated in gen/insque.c and gen/remque.c */ +struct vaxque { /* queue format expected by VAX queue instructions */ @@ -229,7 +273,7 @@ diff --unified --recursive --new-file libstdc.orig/gen.h libstdc/gen.h +}; diff --unified --recursive --new-file libstdc.orig/net.h libstdc/net.h --- libstdc.orig/net.h 1970-01-01 10:00:00.000000000 +1000 -+++ libstdc/net.h 2017-01-19 01:18:23.149552495 +1100 ++++ libstdc/net.h 2017-01-19 02:19:04.351169187 +1100 @@ -0,0 +1,15 @@ +/* formerly duplicated in netinet/in.h and netns/ns.h */ +#if !defined(vax) && !defined(ntohl) && !defined(lint) @@ -247,8 +291,8 @@ diff --unified --recursive --new-file libstdc.orig/net.h libstdc/net.h +u_long ntohl(), htonl(); +#endif diff --unified --recursive --new-file libstdc.orig/netinet/in.h libstdc/netinet/in.h ---- libstdc.orig/netinet/in.h 2017-01-19 01:18:23.141552487 +1100 -+++ libstdc/netinet/in.h 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/netinet/in.h 2017-01-19 02:19:04.347169107 +1100 ++++ libstdc/netinet/in.h 2017-01-19 02:19:04.351169187 +1100 @@ -90,20 +90,21 @@ */ #define IP_OPTIONS 1 /* set/get IP per-packet options */ @@ -282,8 +326,8 @@ diff --unified --recursive --new-file libstdc.orig/netinet/in.h libstdc/netinet/ #ifdef KERNEL extern struct domain inetdomain; diff --unified --recursive --new-file libstdc.orig/netinet/ip.h libstdc/netinet/ip.h ---- libstdc.orig/netinet/ip.h 2017-01-19 01:18:23.141552487 +1100 -+++ libstdc/netinet/ip.h 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/netinet/ip.h 2017-01-19 02:19:04.347169107 +1100 ++++ libstdc/netinet/ip.h 2017-01-19 02:19:04.351169187 +1100 @@ -81,7 +81,7 @@ struct in_addr ipt_addr; n_long ipt_time; @@ -294,8 +338,8 @@ diff --unified --recursive --new-file libstdc.orig/netinet/ip.h libstdc/netinet/ /* flag bits for ipt_flg */ diff --unified --recursive --new-file libstdc.orig/netinet/tcp.h libstdc/netinet/tcp.h ---- libstdc.orig/netinet/tcp.h 2017-01-19 01:18:23.141552487 +1100 -+++ libstdc/netinet/tcp.h 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/netinet/tcp.h 2017-01-19 02:19:04.347169107 +1100 ++++ libstdc/netinet/tcp.h 2017-01-19 02:19:04.351169187 +1100 @@ -44,7 +44,9 @@ #ifdef lint #define TCP_MSS 536 @@ -308,8 +352,8 @@ diff --unified --recursive --new-file libstdc.orig/netinet/tcp.h libstdc/netinet /* diff --unified --recursive --new-file libstdc.orig/netns/ns.h libstdc/netns/ns.h ---- libstdc.orig/netns/ns.h 2017-01-19 01:18:23.141552487 +1100 -+++ libstdc/netns/ns.h 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/netns/ns.h 2017-01-19 02:19:04.347169107 +1100 ++++ libstdc/netns/ns.h 2017-01-19 02:19:04.351169187 +1100 @@ -103,20 +103,21 @@ #define ns_nullhost(x) (((x).x_host.s_host[0]==0) && \ ((x).x_host.s_host[1]==0) && ((x).x_host.s_host[2]==0)) @@ -343,8 +387,8 @@ diff --unified --recursive --new-file libstdc.orig/netns/ns.h libstdc/netns/ns.h #ifdef KERNEL extern struct domain nsdomain; diff --unified --recursive --new-file libstdc.orig/stdio/doscan.c libstdc/stdio/doscan.c ---- libstdc.orig/stdio/doscan.c 2017-01-19 01:18:23.137552484 +1100 -+++ libstdc/stdio/doscan.c 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/stdio/doscan.c 2017-01-19 02:19:04.339168949 +1100 ++++ libstdc/stdio/doscan.c 2017-01-19 02:19:04.351169187 +1100 @@ -3,7 +3,8 @@ #endif @@ -429,8 +473,8 @@ diff --unified --recursive --new-file libstdc.orig/stdio/doscan.c libstdc/stdio/ } return(1); diff --unified --recursive --new-file libstdc.orig/stdio/fprintf.c libstdc/stdio/fprintf.c ---- libstdc.orig/stdio/fprintf.c 2017-01-19 01:18:23.137552484 +1100 -+++ libstdc/stdio/fprintf.c 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/stdio/fprintf.c 2017-01-19 02:19:04.339168949 +1100 ++++ libstdc/stdio/fprintf.c 2017-01-19 02:19:04.351169187 +1100 @@ -1,31 +1,48 @@ /* * Copyright (c) 1980 Regents of the University of California. @@ -492,7 +536,7 @@ diff --unified --recursive --new-file libstdc.orig/stdio/fprintf.c libstdc/stdio } diff --unified --recursive --new-file libstdc.orig/stdio/popen.c libstdc/stdio/popen.c --- libstdc.orig/stdio/popen.c 1970-01-01 10:00:00.000000000 +1000 -+++ libstdc/stdio/popen.c 2017-01-19 01:18:23.149552495 +1100 ++++ libstdc/stdio/popen.c 2017-01-19 02:19:04.351169187 +1100 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 1980 Regents of the University of California. @@ -572,8 +616,8 @@ diff --unified --recursive --new-file libstdc.orig/stdio/popen.c libstdc/stdio/p + return (pid == -1 ? -1 : status); +} diff --unified --recursive --new-file libstdc.orig/stdio/printf.c libstdc/stdio/printf.c ---- libstdc.orig/stdio/printf.c 2017-01-19 01:18:23.137552484 +1100 -+++ libstdc/stdio/printf.c 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/stdio/printf.c 2017-01-19 02:19:04.339168949 +1100 ++++ libstdc/stdio/printf.c 2017-01-19 02:19:04.351169187 +1100 @@ -1,11 +1,35 @@ +/* + * Copyright (c) 1987 Regents of the University of California. @@ -617,8 +661,8 @@ diff --unified --recursive --new-file libstdc.orig/stdio/printf.c libstdc/stdio/ + return(ferror(stdout) ? EOF : len); } diff --unified --recursive --new-file libstdc.orig/stdio/scanf.c libstdc/stdio/scanf.c ---- libstdc.orig/stdio/scanf.c 2017-01-19 01:18:23.137552484 +1100 -+++ libstdc/stdio/scanf.c 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/stdio/scanf.c 2017-01-19 02:19:04.339168949 +1100 ++++ libstdc/stdio/scanf.c 2017-01-19 02:19:04.351169187 +1100 @@ -2,29 +2,50 @@ static char sccsid[] = "@(#)scanf.c 5.2 (Berkeley) 3/9/86"; #endif @@ -681,8 +725,8 @@ diff --unified --recursive --new-file libstdc.orig/stdio/scanf.c libstdc/stdio/s + return len; } diff --unified --recursive --new-file libstdc.orig/stdio/sprintf.c libstdc/stdio/sprintf.c ---- libstdc.orig/stdio/sprintf.c 2017-01-19 01:18:23.137552484 +1100 -+++ libstdc/stdio/sprintf.c 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/stdio/sprintf.c 2017-01-19 02:19:04.339168949 +1100 ++++ libstdc/stdio/sprintf.c 2017-01-19 02:19:04.351169187 +1100 @@ -1,17 +1,40 @@ +/* + * Copyright (c) 1987 Regents of the University of California. @@ -733,7 +777,7 @@ diff --unified --recursive --new-file libstdc.orig/stdio/sprintf.c libstdc/stdio } diff --unified --recursive --new-file libstdc.orig/stdio/vfprintf.c libstdc/stdio/vfprintf.c --- libstdc.orig/stdio/vfprintf.c 1970-01-01 10:00:00.000000000 +1000 -+++ libstdc/stdio/vfprintf.c 2017-01-19 01:18:23.149552495 +1100 ++++ libstdc/stdio/vfprintf.c 2017-01-19 02:19:04.351169187 +1100 @@ -0,0 +1,46 @@ +/* + * Copyright (c) 1988 Regents of the University of California. @@ -783,7 +827,7 @@ diff --unified --recursive --new-file libstdc.orig/stdio/vfprintf.c libstdc/stdi +} diff --unified --recursive --new-file libstdc.orig/stdio/vprintf.c libstdc/stdio/vprintf.c --- libstdc.orig/stdio/vprintf.c 1970-01-01 10:00:00.000000000 +1000 -+++ libstdc/stdio/vprintf.c 2017-01-19 01:18:23.149552495 +1100 ++++ libstdc/stdio/vprintf.c 2017-01-19 02:19:04.351169187 +1100 @@ -0,0 +1,33 @@ +/* + * Copyright (c) 1988 Regents of the University of California. @@ -820,7 +864,7 @@ diff --unified --recursive --new-file libstdc.orig/stdio/vprintf.c libstdc/stdio +} diff --unified --recursive --new-file libstdc.orig/stdio/vsprintf.c libstdc/stdio/vsprintf.c --- libstdc.orig/stdio/vsprintf.c 1970-01-01 10:00:00.000000000 +1000 -+++ libstdc/stdio/vsprintf.c 2017-01-19 01:18:23.149552495 +1100 ++++ libstdc/stdio/vsprintf.c 2017-01-19 02:19:04.351169187 +1100 @@ -0,0 +1,38 @@ +/* + * Copyright (c) 1988 Regents of the University of California. @@ -861,8 +905,8 @@ diff --unified --recursive --new-file libstdc.orig/stdio/vsprintf.c libstdc/stdi + return (len); +} diff --unified --recursive --new-file libstdc.orig/stdio.h libstdc/stdio.h ---- libstdc.orig/stdio.h 2017-01-19 01:18:23.137552484 +1100 -+++ libstdc/stdio.h 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/stdio.h 2017-01-19 02:19:04.343169028 +1100 ++++ libstdc/stdio.h 2017-01-19 02:19:04.351169187 +1100 @@ -59,7 +59,7 @@ long ftell(); char *fgets(); @@ -873,8 +917,8 @@ diff --unified --recursive --new-file libstdc.orig/stdio.h libstdc/stdio.h #endif # endif diff --unified --recursive --new-file libstdc.orig/sys/dir.h libstdc/sys/dir.h ---- libstdc.orig/sys/dir.h 2017-01-19 01:18:23.141552487 +1100 -+++ libstdc/sys/dir.h 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/sys/dir.h 2017-01-19 02:19:04.347169107 +1100 ++++ libstdc/sys/dir.h 2017-01-19 02:19:04.351169187 +1100 @@ -32,9 +32,9 @@ * dp->d_ino set to 0. */ @@ -889,8 +933,8 @@ diff --unified --recursive --new-file libstdc.orig/sys/dir.h libstdc/sys/dir.h #define MAXNAMLEN 255 diff --unified --recursive --new-file libstdc.orig/sys/param.h libstdc/sys/param.h ---- libstdc.orig/sys/param.h 2017-01-19 01:18:23.137552484 +1100 -+++ libstdc/sys/param.h 2017-01-19 01:26:32.138169531 +1100 +--- libstdc.orig/sys/param.h 2017-01-19 02:19:04.343169028 +1100 ++++ libstdc/sys/param.h 2017-01-19 02:19:04.351169187 +1100 @@ -53,15 +53,16 @@ /* * Signals @@ -937,8 +981,8 @@ diff --unified --recursive --new-file libstdc.orig/sys/param.h libstdc/sys/param +/* moved this from sys/types.h */ +#define NBBY 8 /* number of bits in a byte */ diff --unified --recursive --new-file libstdc.orig/sys/proc.h libstdc/sys/proc.h ---- libstdc.orig/sys/proc.h 2017-01-19 01:18:23.141552487 +1100 -+++ libstdc/sys/proc.h 2017-01-19 01:25:34.050092685 +1100 +--- libstdc.orig/sys/proc.h 2017-01-19 02:19:04.343169028 +1100 ++++ libstdc/sys/proc.h 2017-01-19 02:19:04.351169187 +1100 @@ -117,3 +117,8 @@ #define SSEL 0x0400000 /* selecting; wakeup/waiting danger */ #define SLOGIN 0x0800000 /* a login process (legit child of init) */ @@ -950,7 +994,7 @@ diff --unified --recursive --new-file libstdc.orig/sys/proc.h libstdc/sys/proc.h + ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) diff --unified --recursive --new-file libstdc.orig/sys/select.h libstdc/sys/select.h --- libstdc.orig/sys/select.h 1970-01-01 10:00:00.000000000 +1000 -+++ libstdc/sys/select.h 2017-01-19 01:18:23.149552495 +1100 ++++ libstdc/sys/select.h 2017-01-19 02:19:04.351169187 +1100 @@ -0,0 +1,28 @@ +#include + @@ -980,9 +1024,49 @@ diff --unified --recursive --new-file libstdc.orig/sys/select.h libstdc/sys/sele +#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) +#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) +#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) +diff --unified --recursive --new-file libstdc.orig/sys/tty.h libstdc/sys/tty.h +--- libstdc.orig/sys/tty.h 2017-01-19 02:19:04.343169028 +1100 ++++ libstdc/sys/tty.h 2017-01-19 02:20:23.760656935 +1100 +@@ -70,20 +70,22 @@ + struct ttychars t_chars; /* tty */ + struct winsize t_winsize; /* window size */ + /* be careful of tchars & co. */ +-#define t_erase t_chars.tc_erase +-#define t_kill t_chars.tc_kill +-#define t_intrc t_chars.tc_intrc +-#define t_quitc t_chars.tc_quitc +-#define t_startc t_chars.tc_startc +-#define t_stopc t_chars.tc_stopc +-#define t_eofc t_chars.tc_eofc +-#define t_brkc t_chars.tc_brkc +-#define t_suspc t_chars.tc_suspc +-#define t_dsuspc t_chars.tc_dsuspc +-#define t_rprntc t_chars.tc_rprntc +-#define t_flushc t_chars.tc_flushc +-#define t_werasc t_chars.tc_werasc +-#define t_lnextc t_chars.tc_lnextc ++/* these macros can be reinstated later, in just the *.c files that use them */ ++/* otherwise they're too dangerous, they conflict with ioctl.h which we need */ ++/*#define t_erase t_chars.tc_erase*/ ++/*#define t_kill t_chars.tc_kill*/ ++/*#define t_intrc t_chars.tc_intrc*/ ++/*#define t_quitc t_chars.tc_quitc*/ ++/*#define t_startc t_chars.tc_startc*/ ++/*#define t_stopc t_chars.tc_stopc*/ ++/*#define t_eofc t_chars.tc_eofc*/ ++/*#define t_brkc t_chars.tc_brkc*/ ++/*#define t_suspc t_chars.tc_suspc*/ ++/*#define t_dsuspc t_chars.tc_dsuspc*/ ++/*#define t_rprntc t_chars.tc_rprntc*/ ++/*#define t_flushc t_chars.tc_flushc*/ ++/*#define t_werasc t_chars.tc_werasc*/ ++/*#define t_lnextc t_chars.tc_lnextc*/ + }; + + #define TTIPRI 28 diff --unified --recursive --new-file libstdc.orig/sys/types.h libstdc/sys/types.h ---- libstdc.orig/sys/types.h 2017-01-19 01:18:23.141552487 +1100 -+++ libstdc/sys/types.h 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/sys/types.h 2017-01-19 02:19:04.343169028 +1100 ++++ libstdc/sys/types.h 2017-01-19 02:19:04.355169266 +1100 @@ -45,30 +45,32 @@ typedef u_short uid_t; typedef u_short gid_t; @@ -1033,8 +1117,8 @@ diff --unified --recursive --new-file libstdc.orig/sys/types.h libstdc/sys/types #endif diff --unified --recursive --new-file libstdc.orig/sys/vmmac.h libstdc/sys/vmmac.h ---- libstdc.orig/sys/vmmac.h 2017-01-19 01:18:23.141552487 +1100 -+++ libstdc/sys/vmmac.h 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/sys/vmmac.h 2017-01-19 02:19:04.343169028 +1100 ++++ libstdc/sys/vmmac.h 2017-01-19 02:19:04.355169266 +1100 @@ -157,3 +157,10 @@ } \ c->c_lock = 0; \ @@ -1047,8 +1131,8 @@ diff --unified --recursive --new-file libstdc.orig/sys/vmmac.h libstdc/sys/vmmac +#define mapin(pte, v, pfnum, count, prot) \ + (*(int *)(pte) = (pfnum) | (prot), mtpr(TBIS, ptob(v))) diff --unified --recursive --new-file libstdc.orig/vax/vmparam.h libstdc/vax/vmparam.h ---- libstdc.orig/vax/vmparam.h 2017-01-19 01:18:23.141552487 +1100 -+++ libstdc/vax/vmparam.h 2017-01-19 01:18:23.149552495 +1100 +--- libstdc.orig/vax/vmparam.h 2017-01-19 02:19:04.347169107 +1100 ++++ libstdc/vax/vmparam.h 2017-01-19 02:19:04.355169266 +1100 @@ -156,5 +156,6 @@ /* * BEWARE THIS DEFINITION WORKS ONLY WITH COUNT OF 1 diff --git a/lib/libstdc/math.h b/lib/libstdc/math.h index 65b0a83..1f968be 100644 --- a/lib/libstdc/math.h +++ b/lib/libstdc/math.h @@ -22,6 +22,7 @@ #define HUGE 1.701411733192644270e38 +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -41,5 +42,6 @@ double ldexp __P((double v, int e)); /* gen/modf.c */ double modf __P((double v, double *p)); +#endif #endif diff --git a/lib/libstdc/memory.h b/lib/libstdc/memory.h index 34969d9..28f973b 100644 --- a/lib/libstdc/memory.h +++ b/lib/libstdc/memory.h @@ -19,6 +19,7 @@ /*extern char *memcpy();*/ /*extern char *memset();*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -41,5 +42,6 @@ char *memcpy __P((register char *t, register char *f, register n)); /* compat-sys5/memset.c */ char *memset __P((register char *s, register c, register n)); +#endif #endif diff --git a/lib/libstdc/n.sh b/lib/libstdc/n.sh index a4a0410..1e99b3e 100755 --- a/lib/libstdc/n.sh +++ b/lib/libstdc/n.sh @@ -134,18 +134,6 @@ do cat xx* >$i done -#rm -f fcntl.h mp.h -#ln -s sys/file.h fcntl.h -#rm -f machine -#ln -s vax machine -#rm -f frame.h -#ln -s machine/frame.h frame.h -for i in errno.h signal.h syslog.h -do - rm -f $i - ln -s sys/$i $i -done - rm -rf ../libstdc.orig cp -r ../libstdc ../libstdc.orig patch --strip 1 -#include #include #include #include diff --git a/lib/libstdc/net/named/gethostnamadr.c b/lib/libstdc/net/named/gethostnamadr.c index 72e2bdb..4b4e4d2 100644 --- a/lib/libstdc/net/named/gethostnamadr.c +++ b/lib/libstdc/net/named/gethostnamadr.c @@ -1,7 +1,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/libstdc/net/rcmd.c b/lib/libstdc/net/rcmd.c index f48ac64..8373d55 100644 --- a/lib/libstdc/net/rcmd.c +++ b/lib/libstdc/net/rcmd.c @@ -1,13 +1,10 @@ #include #include -#include -#include #include #include #include #include #include -#include #include #include #include diff --git a/lib/libstdc/net/res_send.c b/lib/libstdc/net/res_send.c index 7ee04f8..d4c87a7 100644 --- a/lib/libstdc/net/res_send.c +++ b/lib/libstdc/net/res_send.c @@ -1,6 +1,5 @@ #include #include -#include #include #include #include diff --git a/lib/libstdc/net/rexec.c b/lib/libstdc/net/rexec.c index 9306585..b5e2c9e 100644 --- a/lib/libstdc/net/rexec.c +++ b/lib/libstdc/net/rexec.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/lib/libstdc/net/ruserpass.c b/lib/libstdc/net/ruserpass.c index dc7726d..a83af5a 100644 --- a/lib/libstdc/net/ruserpass.c +++ b/lib/libstdc/net/ruserpass.c @@ -1,6 +1,5 @@ #include #include -#include #include #include #include diff --git a/lib/libstdc/netdb.h b/lib/libstdc/netdb.h index 81bb027..4e8813d 100644 --- a/lib/libstdc/netdb.h +++ b/lib/libstdc/netdb.h @@ -65,6 +65,7 @@ extern int h_errno; #define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ #define NO_ADDRESS 4 /* Valid host name, no address, look for MX record */ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -129,5 +130,6 @@ struct hostent *_gethtbyaddr __P((char *addr, int len, int type)); int sethostent __P((int stayopen)); int endhostent __P((void)); int sethostfile __P((char *name)); +#endif #endif diff --git a/lib/libstdc/netns/ns.h b/lib/libstdc/netns/ns.h index 59b380f..19f31c1 100644 --- a/lib/libstdc/netns/ns.h +++ b/lib/libstdc/netns/ns.h @@ -134,6 +134,7 @@ union ns_net ns_broadnet; /*u_short ns_cksum();*/ #endif +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -147,5 +148,6 @@ struct ns_addr ns_addr __P((char *name)); /* ns/ns_ntoa.c */ char *ns_ntoa __P((struct ns_addr addr)); +#endif #endif diff --git a/lib/libstdc/nlist.h b/lib/libstdc/nlist.h index 82a9b4b..45645fd 100644 --- a/lib/libstdc/nlist.h +++ b/lib/libstdc/nlist.h @@ -48,6 +48,7 @@ struct nlist { */ #define N_FORMAT "%08x" +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -58,5 +59,6 @@ struct nlist { /* gen/nlist.c */ int nlist __P((char *name, struct nlist *list)); +#endif #endif diff --git a/lib/libstdc/p.sh b/lib/libstdc/p.sh index 1473071..88850b1 100755 --- a/lib/libstdc/p.sh +++ b/lib/libstdc/p.sh @@ -13,10 +13,13 @@ done grep '\.h:' oldprotos.txt >oldprotos.temp -rm -f machine +rm -f machine frame.h errno.h fcntl.h signal.h syslog.h ln -s vax machine -rm -f frame.h ln -s machine/frame.h frame.h +ln -s sys/errno.h errno.h +ln -s sys/file.h fcntl.h +ln -s sys/signal.h signal.h +ln -s sys/syslog.h syslog.h while read i do @@ -62,5 +65,4 @@ EOF fi done ]*>' `find . -name '*.h' -print |sed -e 's:^\./::'` |\ +sed -e 's/^\(.*\):#include <\(.*\)>/\1 \2/' |\ +tsort >a + +rm -rf ../../x_include +mkdir ../../x_include +cp ../../xify/stdarg.h ../../xify/x_.h ../../x_include +( + cd ../../x_include + ln -s vax machine + ln -s machine/x_frame.h x_frame.h + ln -s sys/x_errno.h x_errno.h + ln -s sys/x_file.h x_fcntl.h + ln -s sys/x_signal.h x_signal.h + ln -s sys/x_syslog.h x_syslog.h +) + +find . -name '*.h' -print |\ +sed -e 's:\./::' |\ +while read i +do + mkdir -p ../../x_include/`dirname $i` + ../../xify/xify <$i |sed -e 's/register x_int x_u_long/register x_u_long/g' >../../x_include/`dirname $i`/x_`basename $i` +done + +find . -name '*.h' -print |\ +sed -e 's:\./::' |\ +while read i +do + echo "i=$i" + echo "#include <$i>" |../../xify/xify >temp.c + echo "===$i===" >&2 + gcc -nostdinc -I../../x_include -Dx_vax -Dx_NCMD=1 -Dx_NRSP=1 -c temp.c +done + +rm -f temp.c errno.h fcntl.h frame.h machine signal.h syslog.h diff --git a/lib/libstdc/setjmp.h b/lib/libstdc/setjmp.h index 2123c17..200fc3a 100644 --- a/lib/libstdc/setjmp.h +++ b/lib/libstdc/setjmp.h @@ -5,6 +5,7 @@ typedef int jmp_buf[10]; +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -23,5 +24,6 @@ void longjmp __P((jmp_buf e, int v)); /* gen/setjmperr.c */ int longjmperror __P((void)); +#endif #endif diff --git a/lib/libstdc/signal.h b/lib/libstdc/signal.h deleted file mode 100644 index 2a50070..0000000 --- a/lib/libstdc/signal.h +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef _SIGNAL_H_ -#define _SIGNAL_H_ - -#include - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - * - * @(#)signal.h 7.1 (Berkeley) 6/4/86 - */ - -#ifndef NSIG -#define NSIG 32 - -#define SIGHUP 1 /* hangup */ -#define SIGINT 2 /* interrupt */ -#define SIGQUIT 3 /* quit */ -#define SIGILL 4 /* illegal instruction (not reset when caught) */ -#define ILL_RESAD_FAULT 0x0 /* reserved addressing fault */ -#define ILL_PRIVIN_FAULT 0x1 /* privileged instruction fault */ -#define ILL_RESOP_FAULT 0x2 /* reserved operand fault */ -/* CHME, CHMS, CHMU are not yet given back to users reasonably */ -#define SIGTRAP 5 /* trace trap (not reset when caught) */ -#define SIGIOT 6 /* IOT instruction */ -#define SIGABRT SIGIOT /* compatibility */ -#define SIGEMT 7 /* EMT instruction */ -#define SIGFPE 8 /* floating point exception */ -#define FPE_INTOVF_TRAP 0x1 /* integer overflow */ -#define FPE_INTDIV_TRAP 0x2 /* integer divide by zero */ -#define FPE_FLTOVF_TRAP 0x3 /* floating overflow */ -#define FPE_FLTDIV_TRAP 0x4 /* floating/decimal divide by zero */ -#define FPE_FLTUND_TRAP 0x5 /* floating underflow */ -#define FPE_DECOVF_TRAP 0x6 /* decimal overflow */ -#define FPE_SUBRNG_TRAP 0x7 /* subscript out of range */ -#define FPE_FLTOVF_FAULT 0x8 /* floating overflow fault */ -#define FPE_FLTDIV_FAULT 0x9 /* divide by zero floating fault */ -#define FPE_FLTUND_FAULT 0xa /* floating underflow fault */ -#define SIGKILL 9 /* kill (cannot be caught or ignored) */ -#define SIGBUS 10 /* bus error */ -#define SIGSEGV 11 /* segmentation violation */ -#define SIGSYS 12 /* bad argument to system call */ -#define SIGPIPE 13 /* write on a pipe with no one to read it */ -#define SIGALRM 14 /* alarm clock */ -#define SIGTERM 15 /* software termination signal from kill */ -#define SIGURG 16 /* urgent condition on IO channel */ -#define SIGSTOP 17 /* sendable stop signal not from tty */ -#define SIGTSTP 18 /* stop signal from tty */ -#define SIGCONT 19 /* continue a stopped process */ -#define SIGCHLD 20 /* to parent on child stop or exit */ -#define SIGCLD SIGCHLD /* compatibility */ -#define SIGTTIN 21 /* to readers pgrp upon background tty read */ -#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ -#define SIGIO 23 /* input/output possible signal */ -#define SIGXCPU 24 /* exceeded CPU time limit */ -#define SIGXFSZ 25 /* exceeded file size limit */ -#define SIGVTALRM 26 /* virtual time alarm */ -#define SIGPROF 27 /* profiling time alarm */ -#define SIGWINCH 28 /* window size changes */ -#define SIGUSR1 30 /* user defined signal 1 */ -#define SIGUSR2 31 /* user defined signal 2 */ - -#ifndef KERNEL -int (*signal())(); -#endif - -/* - * Signal vector "template" used in sigvec call. - */ -struct sigvec { - int (*sv_handler)(); /* signal handler */ - int sv_mask; /* signal mask to apply */ - int sv_flags; /* see signal options below */ -}; -#define SV_ONSTACK 0x0001 /* take signal on signal stack */ -#define SV_INTERRUPT 0x0002 /* do not restart system on signal return */ -#define sv_onstack sv_flags /* isn't compatibility wonderful! */ - -/* - * Structure used in sigstack call. - */ -struct sigstack { - char *ss_sp; /* signal stack pointer */ - int ss_onstack; /* current status */ -}; - -/* - * 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 properly restore state if - * a non-standard exit is performed. - */ -struct sigcontext { - int sc_onstack; /* sigstack state to restore */ - 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 */ -}; - -#define BADSIG (int (*)())-1 -#define SIG_DFL (int (*)())0 -#define SIG_IGN (int (*)())1 - -#ifdef KERNEL -#define SIG_CATCH (int (*)())2 -#define SIG_HOLD (int (*)())3 -#endif -#endif - -/* - * Macro for converting signal number to a mask suitable for - * sigblock(). - */ -#define sigmask(m) (1 << ((m)-1)) - -#endif diff --git a/lib/libstdc/stdio.h b/lib/libstdc/stdio.h index 89fe1b9..2c42334 100644 --- a/lib/libstdc/stdio.h +++ b/lib/libstdc/stdio.h @@ -72,6 +72,7 @@ extern struct _iobuf { #endif /*# endif*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -200,5 +201,6 @@ int vprintf __P((char *fmt, va_list ap)); /* stdio/vsprintf.c */ int vsprintf __P((char *str, char *fmt, va_list ap)); +#endif #endif diff --git a/lib/libstdc/stdio/findiop.c b/lib/libstdc/stdio/findiop.c index 738dea7..c8c10cf 100644 --- a/lib/libstdc/stdio/findiop.c +++ b/lib/libstdc/stdio/findiop.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/lib/libstdc/stdio/fopen.c b/lib/libstdc/stdio/fopen.c index 96cf8e0..33c4314 100644 --- a/lib/libstdc/stdio/fopen.c +++ b/lib/libstdc/stdio/fopen.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/lib/libstdc/stdio/freopen.c b/lib/libstdc/stdio/freopen.c index cfb15e3..717dc9d 100644 --- a/lib/libstdc/stdio/freopen.c +++ b/lib/libstdc/stdio/freopen.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/lib/libstdc/stdio/popen.c b/lib/libstdc/stdio/popen.c index 3fe1d24..d0c1479 100644 --- a/lib/libstdc/stdio/popen.c +++ b/lib/libstdc/stdio/popen.c @@ -1,5 +1,4 @@ #include -#include #include #include #include diff --git a/lib/libstdc/string.h b/lib/libstdc/string.h index 564cf9f..f0603f5 100644 --- a/lib/libstdc/string.h +++ b/lib/libstdc/string.h @@ -31,6 +31,7 @@ /*extern int strcspn();*/ /*extern char *strtok();*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -65,5 +66,6 @@ int strspn __P((register char *s, register char *set)); /* compat-sys5/strtok.c */ char *strtok __P((register char *s, register char *sep)); +#endif #endif diff --git a/lib/libstdc/strings.h b/lib/libstdc/strings.h index d387e0a..e7da1d4 100644 --- a/lib/libstdc/strings.h +++ b/lib/libstdc/strings.h @@ -23,6 +23,7 @@ /*char *index();*/ /*char *rindex();*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -57,5 +58,6 @@ int strncmp __P((register char *s1, register char *s2, register n)); /* gen/strncpy.c */ char *strncpy __P((register char *s1, register char *s2, int n)); +#endif #endif diff --git a/lib/libstdc/sys.h b/lib/libstdc/sys.h index 3eb6427..b1c1b28 100644 --- a/lib/libstdc/sys.h +++ b/lib/libstdc/sys.h @@ -19,6 +19,7 @@ #include #include +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -56,5 +57,6 @@ int swapon __P((char *s)); /* sys/vhangup.c */ void vhangup __P((void)); +#endif #endif diff --git a/lib/libstdc/sys/acct.h b/lib/libstdc/sys/acct.h index 012105e..e31436c 100644 --- a/lib/libstdc/sys/acct.h +++ b/lib/libstdc/sys/acct.h @@ -50,6 +50,7 @@ struct acct acctbuf; struct inode *acctp; #endif +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -60,5 +61,6 @@ struct inode *acctp; /* sys/acct.c */ int acct __P((char *f)); +#endif #endif diff --git a/lib/libstdc/sys/dir.h b/lib/libstdc/sys/dir.h index c1495ac..2b9bc6d 100644 --- a/lib/libstdc/sys/dir.h +++ b/lib/libstdc/sys/dir.h @@ -100,6 +100,7 @@ struct dirtemplate { }; #endif +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -135,5 +136,6 @@ int mkdir __P((char *p, int m)); /* sys/rmdir.c */ int rmdir __P((char *p)); +#endif #endif diff --git a/lib/libstdc/sys/errno.h b/lib/libstdc/sys/errno.h index 609f594..5ae618d 100644 --- a/lib/libstdc/sys/errno.h +++ b/lib/libstdc/sys/errno.h @@ -1,8 +1,6 @@ #ifndef _SYS_ERRNO_H_ #define _SYS_ERRNO_H_ -#include - /* * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement @@ -102,6 +100,7 @@ #define EUSERS 68 /* Too many users */ #define EDQUOT 69 /* Disc quota exceeded */ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -112,5 +111,6 @@ /* gen/perror.c */ int perror __P((char *s)); +#endif #endif diff --git a/lib/libstdc/sys/exec.h b/lib/libstdc/sys/exec.h index 79e7ddb..59eb4b2 100644 --- a/lib/libstdc/sys/exec.h +++ b/lib/libstdc/sys/exec.h @@ -27,6 +27,7 @@ unsigned long a_drsize; /* size of data relocation */ #define NMAGIC 0410 /* read-only text */ #define ZMAGIC 0413 /* demand load format */ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -56,5 +57,6 @@ void execv __P((char *s, char *v[])); /* sys/execve.c */ void execve __P((char *s, char *v[], char *e[])); +#endif #endif diff --git a/lib/libstdc/sys/file.h b/lib/libstdc/sys/file.h index 6baa843..3bd5fdb 100644 --- a/lib/libstdc/sys/file.h +++ b/lib/libstdc/sys/file.h @@ -1,8 +1,6 @@ #ifndef _SYS_FILE_H_ #define _SYS_FILE_H_ -#include -#include #include #include #include @@ -129,6 +127,7 @@ int nfile; #define DTYPE_SOCKET 2 /* communications endpoint */ #endif +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -220,5 +219,6 @@ int unlink __P((char *s)); /* sys/write.c */ int write __P((int f, char *b, int l)); +#endif #endif diff --git a/lib/libstdc/sys/ioctl.h b/lib/libstdc/sys/ioctl.h index 571dbe8..65a3832 100644 --- a/lib/libstdc/sys/ioctl.h +++ b/lib/libstdc/sys/ioctl.h @@ -4,7 +4,6 @@ #include #include #include -#include #include /* @@ -280,6 +279,7 @@ struct ttysize { /*#endif*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -299,5 +299,6 @@ int isatty __P((int f)); /* sys/ioctl.c */ int ioctl __P((int d, u_long r, char *p)); +#endif #endif diff --git a/lib/libstdc/sys/mount.h b/lib/libstdc/sys/mount.h index 9db492f..5c84aa4 100644 --- a/lib/libstdc/sys/mount.h +++ b/lib/libstdc/sys/mount.h @@ -27,6 +27,7 @@ struct mount { struct mount mount[NMOUNT]; #endif +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -40,5 +41,6 @@ int mount __P((char *s, char *n, int f)); /* sys/umount.c */ int umount __P((char *s)); +#endif #endif diff --git a/lib/libstdc/sys/proc.h b/lib/libstdc/sys/proc.h index 6c80310..1d9809f 100644 --- a/lib/libstdc/sys/proc.h +++ b/lib/libstdc/sys/proc.h @@ -129,6 +129,7 @@ int whichqs; /* bit mask summarizing non-empty qs's */ ((p)->p_sig && ((p)->p_flag&STRC || \ ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig()) +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -208,5 +209,6 @@ int setregid __P((int r, int e)); /* sys/setreuid.c */ int setreuid __P((int r, int e)); +#endif #endif diff --git a/lib/libstdc/sys/ptrace.h b/lib/libstdc/sys/ptrace.h index 66473ae..9ff92fb 100644 --- a/lib/libstdc/sys/ptrace.h +++ b/lib/libstdc/sys/ptrace.h @@ -25,6 +25,7 @@ /*#endif*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -35,5 +36,6 @@ /* sys/ptrace.c */ int ptrace __P((int r, int p, int *a, int d)); +#endif #endif diff --git a/lib/libstdc/sys/quota.h b/lib/libstdc/sys/quota.h index 5a71975..0d06423 100644 --- a/lib/libstdc/sys/quota.h +++ b/lib/libstdc/sys/quota.h @@ -149,6 +149,7 @@ struct dqwarn { u_char dw_iwarn; }; +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -162,5 +163,6 @@ int quota __P((int c, int u, int a, char *ad)); /* sys/setquota.c */ int setquota __P((char *s, char *f)); +#endif #endif diff --git a/lib/libstdc/sys/resource.h b/lib/libstdc/sys/resource.h index 5946f45..ade4acc 100644 --- a/lib/libstdc/sys/resource.h +++ b/lib/libstdc/sys/resource.h @@ -68,6 +68,7 @@ struct rlimit { int rlim_max; /* maximum value for rlim_cur */ }; +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -93,5 +94,6 @@ int setpriority __P((int w, int who, int pri)); /* sys/setrlimit.c */ int setrlimit __P((int res, struct rlimit *rip)); +#endif #endif diff --git a/lib/libstdc/sys/select.h b/lib/libstdc/sys/select.h index 206fe40..3402a2c 100644 --- a/lib/libstdc/sys/select.h +++ b/lib/libstdc/sys/select.h @@ -34,6 +34,7 @@ typedef struct fd_set { #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -44,5 +45,6 @@ typedef struct fd_set { /* sys/select.c */ int select __P((int n, fd_set *r, fd_set *w, fd_set *e, struct timeval *t)); +#endif #endif diff --git a/lib/libstdc/sys/signal.h b/lib/libstdc/sys/signal.h index 73d2cf4..d5bbedf 100644 --- a/lib/libstdc/sys/signal.h +++ b/lib/libstdc/sys/signal.h @@ -1,8 +1,6 @@ #ifndef _SYS_SIGNAL_H_ #define _SYS_SIGNAL_H_ -#include - /* * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement @@ -118,6 +116,7 @@ struct sigcontext { */ #define sigmask(m) (1 << ((m)-1)) +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -158,5 +157,6 @@ int sigstack __P((struct sigstack *ss, struct sigstack *oss)); /* sys/sigvec.c */ int sigvec __P((int c, struct sigvec *f, struct sigvec *m)); +#endif #endif diff --git a/lib/libstdc/sys/sigreturn.c b/lib/libstdc/sys/sigreturn.c index 4b9524b..ba3a54a 100644 --- a/lib/libstdc/sys/sigreturn.c +++ b/lib/libstdc/sys/sigreturn.c @@ -1,8 +1,6 @@ #include -#include #include -/*#include */ /*#include */ int sigreturn(scp) struct sigcontext *scp; { abort(); diff --git a/lib/libstdc/sys/sigstack.c b/lib/libstdc/sys/sigstack.c index 30fccde..ae5dc7d 100644 --- a/lib/libstdc/sys/sigstack.c +++ b/lib/libstdc/sys/sigstack.c @@ -1,8 +1,6 @@ #include -#include #include -/*#include */ /*#include */ int sigstack(ss, oss) struct sigstack *ss; struct sigstack *oss; { abort(); diff --git a/lib/libstdc/sys/sigvec.c b/lib/libstdc/sys/sigvec.c index 6c134eb..930c54f 100644 --- a/lib/libstdc/sys/sigvec.c +++ b/lib/libstdc/sys/sigvec.c @@ -1,8 +1,6 @@ #include -#include #include -/*#include */ /*#include */ int sigvec(c, f, m) int c; struct sigvec *f; struct sigvec *m; { abort(); diff --git a/lib/libstdc/sys/socket.h b/lib/libstdc/sys/socket.h index e66e93e..95c617a 100644 --- a/lib/libstdc/sys/socket.h +++ b/lib/libstdc/sys/socket.h @@ -149,6 +149,7 @@ struct msghdr { #define MSG_MAXIOVLEN 16 +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -204,5 +205,6 @@ int socket __P((int a, int t, int p)); /* sys/socketpair.c */ int socketpair __P((int d, int t, int p, int s[2])); +#endif #endif diff --git a/lib/libstdc/sys/stat.h b/lib/libstdc/sys/stat.h index 49068be..8b78a3c 100644 --- a/lib/libstdc/sys/stat.h +++ b/lib/libstdc/sys/stat.h @@ -45,6 +45,7 @@ struct stat { #define S_IWRITE 0000200 /* write permission, owner */ #define S_IEXEC 0000100 /* execute/search permission, owner */ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -61,5 +62,6 @@ int lstat __P((char *s, struct stat *b)); /* sys/stat.c */ int stat __P((char *s, struct stat *b)); +#endif #endif diff --git a/lib/libstdc/sys/syslog.h b/lib/libstdc/sys/syslog.h index 788e4f7..964f2f3 100644 --- a/lib/libstdc/sys/syslog.h +++ b/lib/libstdc/sys/syslog.h @@ -1,8 +1,6 @@ #ifndef _SYS_SYSLOG_H_ #define _SYS_SYSLOG_H_ -#include - /* * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement @@ -68,6 +66,7 @@ #define LOG_NDELAY 0x08 /* don't delay open */ #define LOG_NOWAIT 0x10 /* if forking to log on console, don't wait() */ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -81,5 +80,6 @@ int syslog __P((int pri, char *fmt, int p0, int p1, int p2, int p3, int p4)); int openlog __P((char *ident, int logstat, int logfac)); int closelog __P((void)); int setlogmask __P((int pmask)); +#endif #endif diff --git a/lib/libstdc/sys/time.h b/lib/libstdc/sys/time.h index 070da40..818af8f 100644 --- a/lib/libstdc/sys/time.h +++ b/lib/libstdc/sys/time.h @@ -60,6 +60,7 @@ struct itimerval { #include #endif +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -103,5 +104,6 @@ int settimeofday __P((struct timeval *t, struct timezone *z)); /* sys/utimes.c */ int utimes __P((char *f, struct timeval t[2])); +#endif #endif diff --git a/lib/libstdc/sys/timeb.h b/lib/libstdc/sys/timeb.h index 4aa28dd..ccac933 100644 --- a/lib/libstdc/sys/timeb.h +++ b/lib/libstdc/sys/timeb.h @@ -21,6 +21,7 @@ struct timeb { short dstflag; }; +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -31,5 +32,6 @@ struct timeb { /* compat-4.1/ftime.c */ int ftime __P((register struct timeb *tp)); +#endif #endif diff --git a/lib/libstdc/sys/times.h b/lib/libstdc/sys/times.h index d1d5b4d..9ba63fc 100644 --- a/lib/libstdc/sys/times.h +++ b/lib/libstdc/sys/times.h @@ -21,6 +21,7 @@ struct tms { time_t tms_cstime; /* system time, children */ }; +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -31,5 +32,6 @@ struct tms { /* compat-4.1/times.c */ int times __P((register struct tms *tmsp)); +#endif #endif diff --git a/lib/libstdc/sys/tty.h b/lib/libstdc/sys/tty.h index ec3d866..94c95a0 100644 --- a/lib/libstdc/sys/tty.h +++ b/lib/libstdc/sys/tty.h @@ -77,20 +77,22 @@ struct tty { struct ttychars t_chars; /* tty */ struct winsize t_winsize; /* window size */ /* be careful of tchars & co. */ -#define t_erase t_chars.tc_erase -#define t_kill t_chars.tc_kill -#define t_intrc t_chars.tc_intrc -#define t_quitc t_chars.tc_quitc -#define t_startc t_chars.tc_startc -#define t_stopc t_chars.tc_stopc -#define t_eofc t_chars.tc_eofc -#define t_brkc t_chars.tc_brkc -#define t_suspc t_chars.tc_suspc -#define t_dsuspc t_chars.tc_dsuspc -#define t_rprntc t_chars.tc_rprntc -#define t_flushc t_chars.tc_flushc -#define t_werasc t_chars.tc_werasc -#define t_lnextc t_chars.tc_lnextc +/* these macros can be reinstated later, in just the *.c files that use them */ +/* otherwise they're too dangerous, they conflict with ioctl.h which we need */ +/*#define t_erase t_chars.tc_erase*/ +/*#define t_kill t_chars.tc_kill*/ +/*#define t_intrc t_chars.tc_intrc*/ +/*#define t_quitc t_chars.tc_quitc*/ +/*#define t_startc t_chars.tc_startc*/ +/*#define t_stopc t_chars.tc_stopc*/ +/*#define t_eofc t_chars.tc_eofc*/ +/*#define t_brkc t_chars.tc_brkc*/ +/*#define t_suspc t_chars.tc_suspc*/ +/*#define t_dsuspc t_chars.tc_dsuspc*/ +/*#define t_rprntc t_chars.tc_rprntc*/ +/*#define t_flushc t_chars.tc_flushc*/ +/*#define t_werasc t_chars.tc_werasc*/ +/*#define t_lnextc t_chars.tc_lnextc*/ }; #define TTIPRI 28 diff --git a/lib/libstdc/sys/uio.h b/lib/libstdc/sys/uio.h index becbafd..bc382e4 100644 --- a/lib/libstdc/sys/uio.h +++ b/lib/libstdc/sys/uio.h @@ -37,6 +37,7 @@ enum uio_rw { UIO_READ, UIO_WRITE }; #define UIO_USERISPACE 2 /* from user I space */ /*#endif*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -50,5 +51,6 @@ int readv __P((int d, struct iovec *v, int l)); /* sys/writev.c */ int writev __P((int f, struct iovec *v, int l)); +#endif #endif diff --git a/lib/libstdc/sys/user.h b/lib/libstdc/sys/user.h index 63e3e94..1de262d 100644 --- a/lib/libstdc/sys/user.h +++ b/lib/libstdc/sys/user.h @@ -1,7 +1,6 @@ #ifndef _SYS_USER_H_ #define _SYS_USER_H_ -#include #include #include #include diff --git a/lib/libstdc/sys/vlimit.h b/lib/libstdc/sys/vlimit.h index 7abcb64..eb25a7b 100644 --- a/lib/libstdc/sys/vlimit.h +++ b/lib/libstdc/sys/vlimit.h @@ -24,6 +24,7 @@ #define INFINITY 0x7fffffff +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -34,5 +35,6 @@ /* compat-4.1/vlimit.c */ int vlimit __P((int limit, int value)); +#endif #endif diff --git a/lib/libstdc/sys/vtimes.h b/lib/libstdc/sys/vtimes.h index 0bcc5a0..112a670 100644 --- a/lib/libstdc/sys/vtimes.h +++ b/lib/libstdc/sys/vtimes.h @@ -32,6 +32,7 @@ struct vtimes { #ifdef KERNEL #endif +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -42,5 +43,6 @@ struct vtimes { /* compat-4.1/vtimes.c */ int vtimes __P((register struct vtimes *par, register struct vtimes *chi)); +#endif #endif diff --git a/lib/libstdc/sys/wait.h b/lib/libstdc/sys/wait.h index f91b485..6a9586a 100644 --- a/lib/libstdc/sys/wait.h +++ b/lib/libstdc/sys/wait.h @@ -69,6 +69,7 @@ union wait { #define WIFSIGNALED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig != 0) #define WIFEXITED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig == 0) +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -82,5 +83,6 @@ int wait3 __P((union wait *s, int o, struct rusage *r)); /* sys/wait.c */ int wait __P((union wait *s)); +#endif #endif diff --git a/lib/libstdc/syslog.h b/lib/libstdc/syslog.h deleted file mode 100644 index 7975cce..0000000 --- a/lib/libstdc/syslog.h +++ /dev/null @@ -1,71 +0,0 @@ -#ifndef _SYSLOG_H_ -#define _SYSLOG_H_ - -#include - -/* - * Copyright (c) 1982, 1986 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. - * - * @(#)syslog.h 7.1 (Berkeley) 6/4/86 - */ - -/* - * Facility codes - */ - -#define LOG_KERN (0<<3) /* kernel messages */ -#define LOG_USER (1<<3) /* random user-level messages */ -#define LOG_MAIL (2<<3) /* mail system */ -#define LOG_DAEMON (3<<3) /* system daemons */ -#define LOG_AUTH (4<<3) /* security/authorization messages */ -#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ -#define LOG_LPR (6<<3) /* line printer subsystem */ - /* other codes through 15 reserved for system use */ -#define LOG_LOCAL0 (16<<3) /* reserved for local use */ -#define LOG_LOCAL1 (17<<3) /* reserved for local use */ -#define LOG_LOCAL2 (18<<3) /* reserved for local use */ -#define LOG_LOCAL3 (19<<3) /* reserved for local use */ -#define LOG_LOCAL4 (20<<3) /* reserved for local use */ -#define LOG_LOCAL5 (21<<3) /* reserved for local use */ -#define LOG_LOCAL6 (22<<3) /* reserved for local use */ -#define LOG_LOCAL7 (23<<3) /* reserved for local use */ - -#define LOG_NFACILITIES 24 /* maximum number of facilities */ -#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ - -/* - * Priorities (these are ordered) - */ - -#define LOG_EMERG 0 /* system is unusable */ -#define LOG_ALERT 1 /* action must be taken immediately */ -#define LOG_CRIT 2 /* critical conditions */ -#define LOG_ERR 3 /* error conditions */ -#define LOG_WARNING 4 /* warning conditions */ -#define LOG_NOTICE 5 /* normal but signification condition */ -#define LOG_INFO 6 /* informational */ -#define LOG_DEBUG 7 /* debug-level messages */ - -#define LOG_PRIMASK 0x0007 /* mask to extract priority part (internal) */ - -/* - * arguments to setlogmask. - */ -#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ -#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ - -/* - * Option flags for openlog. - * - * LOG_ODELAY no longer does anything; LOG_NDELAY is the - * inverse of what it used to be. - */ -#define LOG_PID 0x01 /* log the pid with each message */ -#define LOG_CONS 0x02 /* log on the console if errors in sending */ -#define LOG_ODELAY 0x04 /* delay open until syslog() is called */ -#define LOG_NDELAY 0x08 /* don't delay open */ -#define LOG_NOWAIT 0x10 /* if forking to log on console, don't wait() */ - -#endif diff --git a/lib/libstdc/time.h b/lib/libstdc/time.h index 542aa81..921e9bb 100644 --- a/lib/libstdc/time.h +++ b/lib/libstdc/time.h @@ -23,6 +23,7 @@ struct tm { /*extern struct tm *gmtime(), *localtime();*/ /*extern char *asctime(), *ctime();*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -37,5 +38,6 @@ struct tm *localtime __P((time_t *tim)); struct tm *gmtime __P((time_t *tim)); char *asctime __P((struct tm *t)); int dysize __P((int y)); +#endif #endif diff --git a/lib/libstdc/ttyent.h b/lib/libstdc/ttyent.h index 2ac6f82..9556424 100644 --- a/lib/libstdc/ttyent.h +++ b/lib/libstdc/ttyent.h @@ -24,6 +24,7 @@ struct ttyent { /* see getttyent(3) */ /*extern struct ttyent *getttyent();*/ /*extern struct ttyent *getttynam();*/ +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -39,5 +40,6 @@ struct ttyent *getttyent __P((void)); /* gen/getttynam.c */ struct ttyent *getttynam __P((char *tty)); +#endif #endif diff --git a/lib/libstdc/utmp.h b/lib/libstdc/utmp.h index d9455b7..c52ed0c 100644 --- a/lib/libstdc/utmp.h +++ b/lib/libstdc/utmp.h @@ -21,6 +21,7 @@ struct utmp { long ut_time; /* time on */ }; +#ifndef KERNEL #ifndef __P #ifdef __STDC__ #define __P(args) args @@ -37,5 +38,6 @@ char *ttyname __P((int f)); /* gen/ttyslot.c */ int ttyslot __P((void)); +#endif #endif diff --git a/x_include/arpa/x_ftp.h b/x_include/arpa/x_ftp.h new file mode 100644 index 0000000..e3cd849 --- /dev/null +++ b/x_include/arpa/x_ftp.h @@ -0,0 +1,74 @@ +#include "x_.h" + +#ifndef x__ARPA_FTP_H_ +#define x__ARPA_FTP_H_ + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ftp.h 5.2 (Berkeley) 5/30/85 + */ + +/* + * Definitions for FTP + * See RFC-765 + */ + +/* + * Reply codes. + */ +#define x_PRELIM 1 /* positive preliminary */ +#define x_COMPLETE 2 /* positive completion */ +#define x_CONTINUE 3 /* positive intermediate */ +#define x_TRANSIENT 4 /* transient negative completion */ +#define x_ERROR 5 /* permanent negative completion */ + +/* + * Type codes + */ +#define x_TYPE_A 1 /* ASCII */ +#define x_TYPE_E 2 /* EBCDIC */ +#define x_TYPE_I 3 /* image */ +#define x_TYPE_L 4 /* local byte size */ + +/* + * Form codes + */ +#define x_FORM_N 1 /* non-print */ +#define x_FORM_T 2 /* telnet format effectors */ +#define x_FORM_C 3 /* carriage control (ASA) */ + +/* + * Structure codes + */ +#define x_STRU_F 1 /* file (no record structure) */ +#define x_STRU_R 2 /* record structure */ +#define x_STRU_P 3 /* page structure */ + +/* + * Mode types + */ +#define x_MODE_S 1 /* stream */ +#define x_MODE_B 2 /* block */ +#define x_MODE_C 3 /* compressed */ + +/* + * Record Tokens + */ +#define x_REC_ESC '\377' /* Record-mode Escape */ +#define x_REC_EOR '\001' /* Record-mode End-of-Record */ +#define x_REC_EOF '\002' /* Record-mode End-of-File */ + +/* + * Block Header + */ +#define x_BLK_EOR 0x80 /* Block is End-of-Record */ +#define x_BLK_EOF 0x40 /* Block is End-of-File */ +#define x_BLK_ERRORS 0x20 /* Block is suspected of containing errors */ +#define x_BLK_RESTART 0x10 /* Block is Restart Marker */ + +#define x_BLK_BYTECOUNT 2 /* Bytes in this block */ + +#endif diff --git a/x_include/arpa/x_inet.h b/x_include/arpa/x_inet.h new file mode 100644 index 0000000..1c30541 --- /dev/null +++ b/x_include/arpa/x_inet.h @@ -0,0 +1,54 @@ +#include "x_.h" + +#ifndef x__ARPA_INET_H_ +#define x__ARPA_INET_H_ + +#include +#include + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)inet.h 5.1 (Berkeley) 5/30/85 + */ + +/* + * External definitions for + * functions in inet(3N) + */ +/*unsigned long inet_addr();*/ +/*char *inet_ntoa();*/ +/*struct in_addr inet_makeaddr();*/ +/*unsigned long inet_network();*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* inet/inet_addr.c */ +x_u_long x_inet_addr __P((register char *x_cp)); + +/* inet/inet_lnaof.c */ +x_int x_inet_lnaof __P((struct x_in_addr x_in)); + +/* inet/inet_makeaddr.c */ +struct x_in_addr x_inet_makeaddr __P((x_int x_net, x_int x_host)); + +/* inet/inet_netof.c */ +x_int x_inet_netof __P((struct x_in_addr x_in)); + +/* inet/inet_network.c */ +x_u_long x_inet_network __P((register char *x_cp)); + +/* inet/inet_ntoa.c */ +char *x_inet_ntoa __P((struct x_in_addr x_in)); +#endif + +#endif diff --git a/x_include/arpa/x_nameser.h b/x_include/arpa/x_nameser.h new file mode 100644 index 0000000..c46ff19 --- /dev/null +++ b/x_include/arpa/x_nameser.h @@ -0,0 +1,204 @@ +#include "x_.h" + +#ifndef x__ARPA_NAMESER_H_ +#define x__ARPA_NAMESER_H_ + +#include +#include + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)nameser.h 5.11 (Berkeley) 2/14/86 + */ + +/* + * Define constants based on rfc883 + */ +#define x_PACKETSZ 512 /* maximum packet size */ +#define x_MAXDNAME 256 /* maximum domain name */ +#define x_MAXCDNAME 255 /* maximum compressed domain name */ +#define x_MAXLABEL 63 /* maximum length of domain label */ + /* Number of bytes of fixed size data in query structure */ +#define x_QFIXEDSZ 4 + /* number of bytes of fixed size data in resource record */ +#define x_RRFIXEDSZ 10 + +/* + * Internet nameserver port number + */ +#define x_NAMESERVER_PORT 53 + +/* + * Currently defined opcodes + */ +#define x_QUERY 0 /* standard query */ +#define x_IQUERY 1 /* inverse query */ +#define x_CQUERYM 2 /* completion query (multiple) */ +#define x_CQUERYU 3 /* completion query (unique) */ + /* non standard */ +#define x_UPDATEA 100 /* add resource record */ +#define x_UPDATED 101 /* delete resource record */ +#define x_UPDATEM 102 /* modify resource record */ +#define x_ZONEINIT 103 /* initial zone transfer */ +#define x_ZONEREF 104 /* incremental zone referesh */ + +/* + * Currently defined response codes + */ +#define x_NOERROR 0 /* no error */ +#define x_FORMERR 1 /* format error */ +#define x_SERVFAIL 2 /* server failure */ +#define x_NXDOMAIN 3 /* non existent domain */ +#define x_NOTIMP 4 /* not implemented */ +#define x_REFUSED 5 /* query refused */ + /* non standard */ +#define x_NOCHANGE 100 /* update failed to change db */ + +/* + * Type values for resources and queries + */ +#define x_T_A 1 /* host address */ +#define x_T_NS 2 /* authoritative server */ +#define x_T_MD 3 /* mail destination */ +#define x_T_MF 4 /* mail forwarder */ +#define x_T_CNAME 5 /* connonical name */ +#define x_T_SOA 6 /* start of authority zone */ +#define x_T_MB 7 /* mailbox domain name */ +#define x_T_MG 8 /* mail group member */ +#define x_T_MR 9 /* mail rename name */ +#define x_T_NULL 10 /* null resource record */ +#define x_T_WKS 11 /* well known service */ +#define x_T_PTR 12 /* domain name pointer */ +#define x_T_HINFO 13 /* host information */ +#define x_T_MINFO 14 /* mailbox information */ +#define x_T_MX 15 /* mail routing information */ + /* non standard */ +#define x_T_UINFO 100 /* user (finger) information */ +#define x_T_UID 101 /* user ID */ +#define x_T_GID 102 /* group ID */ + /* Query type values which do not appear in resource records */ +#define x_T_AXFR 252 /* transfer zone of authority */ +#define x_T_MAILB 253 /* transfer mailbox records */ +#define x_T_MAILA 254 /* transfer mail agent records */ +#define x_T_ANY 255 /* wildcard match */ + +/* + * Values for class field + */ + +#define x_C_IN 1 /* the arpa internet */ +#define x_C_CHAOS 3 /* for chaos net at MIT */ + /* Query class values which do not appear in resource records */ +#define x_C_ANY 255 /* wildcard match */ + +/* + * Structure for query header, the order of the fields is machine and + * compiler dependent, in our case, the bits within a byte are assignd + * least significant first, while the order of transmition is most + * significant first. This requires a somewhat confusing rearrangement. + */ + +typedef struct { + x_u_short x_id; /* query identification number */ +#if defined (x_sun) || defined (x_sel) || defined (x_pyr) || defined (x_is68k) \ +|| defined (x_tahoe) || defined (x_BIT_ZERO_ON_LEFT) + /* Bit zero on left: Gould and similar architectures */ + /* fields in third byte */ + x_u_char x_qr:1; /* response flag */ + x_u_char x_opcode:4; /* purpose of message */ + x_u_char x_aa:1; /* authoritive answer */ + x_u_char x_tc:1; /* truncated message */ + x_u_char x_rd:1; /* recursion desired */ + /* fields in fourth byte */ + x_u_char x_ra:1; /* recursion available */ + x_u_char x_pr:1; /* primary server required (non standard) */ + x_u_char x_unused:2; /* unused bits */ + x_u_char x_rcode:4; /* response code */ +#else +#if defined (x_vax) || defined (x_BIT_ZERO_ON_RIGHT) + /* Bit zero on right: VAX */ + /* fields in third byte */ + x_u_char x_rd:1; /* recursion desired */ + x_u_char x_tc:1; /* truncated message */ + x_u_char x_aa:1; /* authoritive answer */ + x_u_char x_opcode:4; /* purpose of message */ + x_u_char x_qr:1; /* response flag */ + /* fields in fourth byte */ + x_u_char x_rcode:4; /* response code */ + x_u_char x_unused:2; /* unused bits */ + x_u_char x_pr:1; /* primary server required (non standard) */ + x_u_char x_ra:1; /* recursion available */ +#else + /* you must determine what the correct bit order is for your compiler */ + x_UNDEFINED_BIT_ORDER; +#endif +#endif + /* remaining bytes */ + x_u_short x_qdcount; /* number of question entries */ + x_u_short x_ancount; /* number of answer entries */ + x_u_short x_nscount; /* number of authority entries */ + x_u_short x_arcount; /* number of resource entries */ +} x_HEADER; + +/* + * Defines for handling compressed domain names + */ +#define x_INDIR_MASK 0xc0 + +/* + * Structure for passing resource records around. + */ +struct x_rrec { + x_short x_r_zone; /* zone number */ + x_short x_r_class; /* class number */ + x_short x_r_type; /* type number */ + x_u_long x_r_ttl; /* time to live */ + x_int x_r_size; /* size of data area */ + char *x_r_data; /* pointer to data */ +}; + +/*extern u_short getshort();*/ +/*extern u_long getlong();*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* net/res_comp.c */ +x_int x_dn_expand __P((char *x_msg, char *x_eomorig, char *x_comp_dn, char *x_exp_dn, x_int x_length)); +x_int x_dn_comp __P((char *x_exp_dn, char *x_comp_dn, x_int x_length, char **x_dnptrs, char **x_lastdnptr)); +x_int x_dn_skip __P((char *x_comp_dn)); +x_int x_dn_find __P((char *x_exp_dn, char *x_msg, char **x_dnptrs, char **x_lastdnptr)); +x_u_short x_getshort __P((char *x_msgp)); +x_u_long x_getlong __P((char *x_msgp)); +x_int x_putshort __P((x_int x_s, register char *x_msgp)); +x_int x_putlong __P((register x_u_long x_l, register char *x_msgp)); + +/* net/res_debug.c */ +x_int x_p_query __P((char *x_msg)); +x_int x_fp_query __P((char *x_msg, x_FILE *x_file)); +char *x_p_cdname __P((char *x_cp, char *x_msg, x_FILE *x_file)); +char *x_p_rr __P((char *x_cp, char *x_msg, x_FILE *x_file)); +char *x_p_type __P((x_int x_type)); +char *x_p_class __P((x_int x_class)); + +/* net/res_init.c */ +x_int x_res_init __P((void)); + +/* net/res_mkquery.c */ +x_int x_res_mkquery __P((x_int x_op, char *x_dname, x_int x_class, x_int x_type, char *x_data, x_int x_datalen, struct x_rrec *x_newrr, char *x_buf, x_int x_buflen)); + +/* net/res_send.c */ +x_int x_res_send __P((char *x_buf, x_int x_buflen, char *x_answer, x_int x_anslen)); +x_int x__res_close __P((void)); +#endif + +#endif diff --git a/x_include/arpa/x_telnet.h b/x_include/arpa/x_telnet.h new file mode 100644 index 0000000..cd069c1 --- /dev/null +++ b/x_include/arpa/x_telnet.h @@ -0,0 +1,89 @@ +#include "x_.h" + +#ifndef x__ARPA_TELNET_H_ +#define x__ARPA_TELNET_H_ + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)telnet.h 5.1 (Berkeley) 5/30/85 + */ + +/* + * Definitions for the TELNET protocol. + */ +#define x_IAC 255 /* interpret as command: */ +#define x_DONT 254 /* you are not to use option */ +#define x_DO 253 /* please, you use option */ +#define x_WONT 252 /* I won't use option */ +#define x_WILL 251 /* I will use option */ +#define x_SB 250 /* interpret as subnegotiation */ +#define x_GA 249 /* you may reverse the line */ +#define x_EL 248 /* erase the current line */ +#define x_EC 247 /* erase the current character */ +#define x_AYT 246 /* are you there */ +#define x_AO 245 /* abort output--but let prog finish */ +#define x_IP 244 /* interrupt process--permanently */ +#define x_BREAK 243 /* break */ +#define x_DM 242 /* data mark--for connect. cleaning */ +#define x_NOP 241 /* nop */ +#define x_SE 240 /* end sub negotiation */ +#define x_EOR 239 /* end of record (transparent mode) */ + +#define x_SYNCH 242 /* for telfunc calls */ + +#ifdef x_TELCMDS +char *x_telcmds[] = { + "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", + "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", +}; +#endif + +/* telnet options */ +#define x_TELOPT_BINARY 0 /* 8-bit data path */ +#define x_TELOPT_ECHO 1 /* echo */ +#define x_TELOPT_RCP 2 /* prepare to reconnect */ +#define x_TELOPT_SGA 3 /* suppress go ahead */ +#define x_TELOPT_NAMS 4 /* approximate message size */ +#define x_TELOPT_STATUS 5 /* give status */ +#define x_TELOPT_TM 6 /* timing mark */ +#define x_TELOPT_RCTE 7 /* remote controlled transmission and echo */ +#define x_TELOPT_NAOL 8 /* negotiate about output line width */ +#define x_TELOPT_NAOP 9 /* negotiate about output page size */ +#define x_TELOPT_NAOCRD 10 /* negotiate about CR disposition */ +#define x_TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ +#define x_TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ +#define x_TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ +#define x_TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ +#define x_TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ +#define x_TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ +#define x_TELOPT_XASCII 17 /* extended ascic character set */ +#define x_TELOPT_LOGOUT 18 /* force logout */ +#define x_TELOPT_BM 19 /* byte macro */ +#define x_TELOPT_DET 20 /* data entry terminal */ +#define x_TELOPT_SUPDUP 21 /* supdup protocol */ +#define x_TELOPT_SUPDUPOUTPUT 22 /* supdup output */ +#define x_TELOPT_SNDLOC 23 /* send location */ +#define x_TELOPT_TTYPE 24 /* terminal type */ +#define x_TELOPT_EOR 25 /* end or record */ +#define x_TELOPT_EXOPL 255 /* extended-options-list */ + +#ifdef x_TELOPTS +#define x_NTELOPTS (1+x_TELOPT_EOR) +char *x_telopts[x_NTELOPTS] = { + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", + "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", +}; +#endif + +/* sub-option qualifiers */ +#define x_TELQUAL_IS 0 /* option is... */ +#define x_TELQUAL_SEND 1 /* send option */ + +#endif diff --git a/x_include/arpa/x_tftp.h b/x_include/arpa/x_tftp.h new file mode 100644 index 0000000..4713b86 --- /dev/null +++ b/x_include/arpa/x_tftp.h @@ -0,0 +1,55 @@ +#include "x_.h" + +#ifndef x__ARPA_TFTP_H_ +#define x__ARPA_TFTP_H_ + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)tftp.h 5.1 (Berkeley) 5/30/85 + */ + +/* + * Trivial File Transfer Protocol (IEN-133) + */ +#define x_SEGSIZE 512 /* data segment size */ + +/* + * Packet types. + */ +#define x_RRQ 01 /* read request */ +#define x_WRQ 02 /* write request */ +#define x_DATA 03 /* data packet */ +#define x_ACK 04 /* acknowledgement */ +#define x_ERROR 05 /* error code */ + +struct x_tftphdr { + x_short x_th_opcode; /* packet type */ + union { + x_short x_tu_block; /* block # */ + x_short x_tu_code; /* error code */ + char x_tu_stuff[1]; /* request packet stuff */ + } x_th_u; + char x_th_data[1]; /* data or error string */ +}; + +#define x_th_block x_th_u.x_tu_block +#define x_th_code x_th_u.x_tu_code +#define x_th_stuff x_th_u.x_tu_stuff +#define x_th_msg x_th_data + +/* + * Error codes. + */ +#define x_EUNDEF 0 /* not defined */ +#define x_ENOTFOUND 1 /* file not found */ +#define x_EACCESS 2 /* access violation */ +#define x_ENOSPACE 3 /* disk full or allocation exceeded */ +#define x_EBADOP 4 /* illegal TFTP operation */ +#define x_EBADID 5 /* unknown transfer ID */ +#define x_EEXISTS 6 /* file already exists */ +#define x_ENOUSER 7 /* no such user */ + +#endif diff --git a/x_include/machine b/x_include/machine new file mode 120000 index 0000000..4fa2d2a --- /dev/null +++ b/x_include/machine @@ -0,0 +1 @@ +vax \ No newline at end of file diff --git a/x_include/net/x_af.h b/x_include/net/x_af.h new file mode 100644 index 0000000..fc982b5 --- /dev/null +++ b/x_include/net/x_af.h @@ -0,0 +1,44 @@ +#include "x_.h" + +#ifndef x__NET_AF_H_ +#define x__NET_AF_H_ + +#include + +/* + * Copyright (c) 1980, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)af.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Address family routines, + * used in handling generic sockaddr structures. + * + * Hash routine is called + * af_hash(addr, h); + * struct sockaddr *addr; struct afhash *h; + * producing an afhash structure for addr. + * + * Netmatch routine is called + * af_netmatch(addr1, addr2); + * where addr1 and addr2 are sockaddr *. Returns 1 if network + * values match, 0 otherwise. + */ +struct x_afswitch { + x_int (*x_af_hash)(); + x_int (*x_af_netmatch)(); +}; + +struct x_afhash { + x_u_int x_afh_hosthash; + x_u_int x_afh_nethash; +}; + +#ifdef x_KERNEL +struct x_afswitch x_afswitch[]; +#endif + +#endif diff --git a/x_include/net/x_if.h b/x_include/net/x_if.h new file mode 100644 index 0000000..e12d608 --- /dev/null +++ b/x_include/net/x_if.h @@ -0,0 +1,225 @@ +#include "x_.h" + +#ifndef x__NET_IF_H_ +#define x__NET_IF_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Structures defining a network interface, providing a packet + * transport mechanism (ala level 0 of the PUP protocols). + * + * Each interface accepts output datagrams of a specified maximum + * length, and provides higher level routines with input datagrams + * received from its medium. + * + * Output occurs when the routine if_output is called, with three parameters: + * (*ifp->if_output)(ifp, m, dst) + * Here m is the mbuf chain to be sent and dst is the destination address. + * The output routine encapsulates the supplied datagram if necessary, + * and then transmits it on its medium. + * + * On input, each interface unwraps the data received by it, and either + * places it on the input queue of a internetwork datagram routine + * and posts the associated software interrupt, or passes the datagram to a raw + * packet input routine. + * + * Routines exist for locating interfaces by their addresses + * or for locating a interface on a certain network, as well as more general + * routing and gateway routines maintaining information used to locate + * interfaces. These routines live in the files if.c and route.c + */ + +/* + * Structure defining a queue for a network interface. + * + * (Would like to call this struct ``if'', but C isn't PL/1.) + */ +struct x_ifnet { + char *x_if_name; /* name, e.g. ``en'' or ``lo'' */ + x_short x_if_unit; /* sub-unit for lower level driver */ + x_short x_if_mtu; /* maximum transmission unit */ + x_short x_if_flags; /* up/down, broadcast, etc. */ + x_short x_if_timer; /* time 'til if_watchdog called */ + x_int x_if_metric; /* routing metric (external only) */ + struct x_ifaddr *x_if_addrlist; /* linked list of addresses per if */ + struct x_ifqueue { + struct x_mbuf *x_ifq_head; + struct x_mbuf *x_ifq_tail; + x_int x_ifq_len; + x_int x_ifq_maxlen; + x_int x_ifq_drops; + } x_if_snd; /* output queue */ +/* procedure handles */ + x_int (*x_if_init)(); /* init routine */ + x_int (*x_if_output)(); /* output routine */ + x_int (*x_if_ioctl)(); /* ioctl routine */ + x_int (*x_if_reset)(); /* bus reset routine */ + x_int (*x_if_watchdog)(); /* timer routine */ +/* generic interface statistics */ + x_int x_if_ipackets; /* packets received on interface */ + x_int x_if_ierrors; /* input errors on interface */ + x_int x_if_opackets; /* packets sent on interface */ + x_int x_if_oerrors; /* output errors on interface */ + x_int x_if_collisions; /* collisions on csma interfaces */ +/* end statistics */ + struct x_ifnet *x_if_next; +}; + +#define x_IFF_UP 0x1 /* interface is up */ +#define x_IFF_BROADCAST 0x2 /* broadcast address valid */ +#define x_IFF_DEBUG 0x4 /* turn on debugging */ +#define x_IFF_LOOPBACK 0x8 /* is a loopback net */ +#define x_IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ +#define x_IFF_NOTRAILERS 0x20 /* avoid use of trailers */ +#define x_IFF_RUNNING 0x40 /* resources allocated */ +#define x_IFF_NOARP 0x80 /* no address resolution protocol */ +/* next two not supported now, but reserved: */ +#define x_IFF_PROMISC 0x100 /* receive all packets */ +#define x_IFF_ALLMULTI 0x200 /* receive all multicast packets */ +/* flags set internally only: */ +#define x_IFF_CANTCHANGE (x_IFF_BROADCAST | x_IFF_POINTOPOINT | x_IFF_RUNNING) + +/* + * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1) + * input routines have queues of messages stored on ifqueue structures + * (defined above). Entries are added to and deleted from these structures + * by these macros, which should be called with ipl raised to splimp(). + */ +#define x_IF_QFULL(x_ifq) ((x_ifq)->x_ifq_len >= (x_ifq)->x_ifq_maxlen) +#define x_IF_DROP(x_ifq) ((x_ifq)->x_ifq_drops++) +#define x_IF_ENQUEUE(x_ifq, x_m) { \ + (x_m)->x_m_act = 0; \ + if ((x_ifq)->x_ifq_tail == 0) \ + (x_ifq)->x_ifq_head = x_m; \ + else \ + (x_ifq)->x_ifq_tail->x_m_act = x_m; \ + (x_ifq)->x_ifq_tail = x_m; \ + (x_ifq)->x_ifq_len++; \ +} +#define x_IF_PREPEND(x_ifq, x_m) { \ + (x_m)->x_m_act = (x_ifq)->x_ifq_head; \ + if ((x_ifq)->x_ifq_tail == 0) \ + (x_ifq)->x_ifq_tail = (x_m); \ + (x_ifq)->x_ifq_head = (x_m); \ + (x_ifq)->x_ifq_len++; \ +} +/* + * Packets destined for level-1 protocol input routines + * have a pointer to the receiving interface prepended to the data. + * IF_DEQUEUEIF extracts and returns this pointer when dequeueing the packet. + * IF_ADJ should be used otherwise to adjust for its presence. + */ +#define x_IF_ADJ(x_m) { \ + (x_m)->x_m_off += sizeof(struct x_ifnet *); \ + (x_m)->x_m_len -= sizeof(struct x_ifnet *); \ + if ((x_m)->x_m_len == 0) { \ + struct x_mbuf *x_n; \ + x_MFREE((x_m), x_n); \ + (x_m) = x_n; \ + } \ +} +#define x_IF_DEQUEUEIF(x_ifq, x_m, x_ifp) { \ + (x_m) = (x_ifq)->x_ifq_head; \ + if (x_m) { \ + if (((x_ifq)->x_ifq_head = (x_m)->x_m_act) == 0) \ + (x_ifq)->x_ifq_tail = 0; \ + (x_m)->x_m_act = 0; \ + (x_ifq)->x_ifq_len--; \ + (x_ifp) = *(x_mtod((x_m), struct x_ifnet **)); \ + x_IF_ADJ(x_m); \ + } \ +} +#define x_IF_DEQUEUE(x_ifq, x_m) { \ + (x_m) = (x_ifq)->x_ifq_head; \ + if (x_m) { \ + if (((x_ifq)->x_ifq_head = (x_m)->x_m_act) == 0) \ + (x_ifq)->x_ifq_tail = 0; \ + (x_m)->x_m_act = 0; \ + (x_ifq)->x_ifq_len--; \ + } \ +} + +#define x_IFQ_MAXLEN 50 +#define x_IFNET_SLOWHZ 1 /* granularity is 1 second */ + +/* + * The ifaddr structure contains information about one address + * of an interface. They are maintained by the different address families, + * are allocated and attached when an address is set, and are linked + * together so all addresses for an interface can be located. + */ +struct x_ifaddr { + struct x_sockaddr x_ifa_addr; /* address of interface */ + union { + struct x_sockaddr x_ifu_broadaddr; + struct x_sockaddr x_ifu_dstaddr; + } x_ifa_ifu; +#define x_ifa_broadaddr x_ifa_ifu.x_ifu_broadaddr /* broadcast address */ +#define x_ifa_dstaddr x_ifa_ifu.x_ifu_dstaddr /* other end of p-to-p link */ + struct x_ifnet *x_ifa_ifp; /* back-pointer to interface */ + struct x_ifaddr *x_ifa_next; /* next address for interface */ +}; + +/* + * Interface request structure used for socket + * ioctl's. All interface ioctl's must have parameter + * definitions which begin with ifr_name. The + * remainder may be interface specific. + */ +struct x_ifreq { +#define x_IFNAMSIZ 16 + char x_ifr_name[x_IFNAMSIZ]; /* if name, e.g. "en0" */ + union { + struct x_sockaddr x_ifru_addr; + struct x_sockaddr x_ifru_dstaddr; + struct x_sockaddr x_ifru_broadaddr; + x_short x_ifru_flags; + x_int x_ifru_metric; + x_caddr_t x_ifru_data; + } x_ifr_ifru; +#define x_ifr_addr x_ifr_ifru.x_ifru_addr /* address */ +#define x_ifr_dstaddr x_ifr_ifru.x_ifru_dstaddr /* other end of p-to-p link */ +#define x_ifr_broadaddr x_ifr_ifru.x_ifru_broadaddr /* broadcast address */ +#define x_ifr_flags x_ifr_ifru.x_ifru_flags /* flags */ +#define x_ifr_metric x_ifr_ifru.x_ifru_metric /* metric */ +#define x_ifr_data x_ifr_ifru.x_ifru_data /* for use by interface */ +}; + +/* + * Structure used in SIOCGIFCONF request. + * Used to retrieve interface configuration + * for machine (useful for programs which + * must know all networks accessible). + */ +struct x_ifconf { + x_int x_ifc_len; /* size of associated buffer */ + union { + x_caddr_t x_ifcu_buf; + struct x_ifreq *x_ifcu_req; + } x_ifc_ifcu; +#define x_ifc_buf x_ifc_ifcu.x_ifcu_buf /* buffer address */ +#define x_ifc_req x_ifc_ifcu.x_ifcu_req /* array of structures returned */ +}; + +#ifdef x_KERNEL +#include "../net/x_if_arp.h" +struct x_ifqueue x_rawintrq; /* raw packet input queue */ +struct x_ifnet *x_ifnet; +/*struct ifaddr *ifa_ifwithaddr(), *ifa_ifwithnet();*/ +/*struct ifaddr *ifa_ifwithdstaddr();*/ +#else +#include +#endif + +#endif diff --git a/x_include/net/x_if_arp.h b/x_include/net/x_if_arp.h new file mode 100644 index 0000000..2095fb6 --- /dev/null +++ b/x_include/net/x_if_arp.h @@ -0,0 +1,61 @@ +#include "x_.h" + +#ifndef x__NET_IF_ARP_H_ +#define x__NET_IF_ARP_H_ + +#include +#include + +/* + * Copyright (c) 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_arp.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Address Resolution Protocol. + * + * See RFC 826 for protocol description. ARP packets are variable + * in size; the arphdr structure defines the fixed-length portion. + * Protocol type values are the same as those for 10 Mb/s Ethernet. + * It is followed by the variable-sized fields ar_sha, arp_spa, + * arp_tha and arp_tpa in that order, according to the lengths + * specified. Field names used correspond to RFC 826. + */ +struct x_arphdr { + x_u_short x_ar_hrd; /* format of hardware address */ +#define x_ARPHRD_ETHER 1 /* ethernet hardware address */ + x_u_short x_ar_pro; /* format of protocol address */ + x_u_char x_ar_hln; /* length of hardware address */ + x_u_char x_ar_pln; /* length of protocol address */ + x_u_short x_ar_op; /* one of: */ +#define x_ARPOP_REQUEST 1 /* request to resolve address */ +#define x_ARPOP_REPLY 2 /* response to previous request */ +/* + * The remaining fields are variable in size, + * according to the sizes above. + */ +/* u_char ar_sha[]; /* sender hardware address */ +/* u_char ar_spa[]; /* sender protocol address */ +/* u_char ar_tha[]; /* target hardware address */ +/* u_char ar_tpa[]; /* target protocol address */ +}; + +/* + * ARP ioctl request + */ +struct x_arpreq { + struct x_sockaddr x_arp_pa; /* protocol address */ + struct x_sockaddr x_arp_ha; /* hardware address */ + x_int x_arp_flags; /* flags */ +}; +/* arp_flags and at_flags field values */ +#define x_ATF_INUSE 0x01 /* entry in use */ +#define x_ATF_COM 0x02 /* completed entry (enaddr valid) */ +#define x_ATF_PERM 0x04 /* permanent entry */ +#define x_ATF_PUBL 0x08 /* publish entry (respond for other host) */ +#define x_ATF_USETRAILERS 0x10 /* has requested trailers */ + +#endif diff --git a/x_include/net/x_netisr.h b/x_include/net/x_netisr.h new file mode 100644 index 0000000..08ffda9 --- /dev/null +++ b/x_include/net/x_netisr.h @@ -0,0 +1,47 @@ +#include "x_.h" + +#ifndef x__NET_NETISR_H_ +#define x__NET_NETISR_H_ + +#include + +/* + * Copyright (c) 1980, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)netisr.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * The networking code runs off software interrupts. + * + * You can switch into the network by doing splnet() and return by splx(). + * The software interrupt level for the network is higher than the software + * level for the clock (so you can enter the network in routines called + * at timeout time). + */ +#ifdef x_vax +#define x_setsoftnet() x_mtpr(x_SIRR, 12) +#endif + +/* + * Each ``pup-level-1'' input queue has a bit in a ``netisr'' status + * word which is used to de-multiplex a single software + * interrupt used for scheduling the network code to calls + * on the lowest level routine of each protocol. + */ +#define x_NETISR_RAW 0 /* same as AF_UNSPEC */ +#define x_NETISR_IP 2 /* same as AF_INET */ +#define x_NETISR_IMP 3 /* same as AF_IMPLINK */ +#define x_NETISR_NS 6 /* same as AF_NS */ + +#define x_schednetisr(x_anisr) { x_netisr |= 1<<(x_anisr); x_setsoftnet(); } + +#ifndef x_LOCORE +#ifdef x_KERNEL +x_int x_netisr; /* scheduling bits for network */ +#endif +#endif + +#endif diff --git a/x_include/net/x_raw_cb.h b/x_include/net/x_raw_cb.h new file mode 100644 index 0000000..cac149f --- /dev/null +++ b/x_include/net/x_raw_cb.h @@ -0,0 +1,66 @@ +#include "x_.h" + +#ifndef x__NET_RAW_CB_H_ +#define x__NET_RAW_CB_H_ + +#include +#include +#include + +/* + * Copyright (c) 1980, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)raw_cb.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Raw protocol interface control block. Used + * to tie a socket to the generic raw interface. + */ +struct x_rawcb { + struct x_rawcb *x_rcb_next; /* doubly linked list */ + struct x_rawcb *x_rcb_prev; + struct x_socket *x_rcb_socket; /* back pointer to socket */ + struct x_sockaddr x_rcb_faddr; /* destination address */ + struct x_sockaddr x_rcb_laddr; /* socket's address */ + struct x_sockproto x_rcb_proto; /* protocol family, protocol */ + x_caddr_t x_rcb_pcb; /* protocol specific stuff */ + struct x_mbuf *x_rcb_options; /* protocol specific options */ + struct x_route x_rcb_route; /* routing information */ + x_short x_rcb_flags; +}; + +/* + * Since we can't interpret canonical addresses, + * we mark an address present in the flags field. + */ +#define x_RAW_LADDR 01 +#define x_RAW_FADDR 02 +#define x_RAW_DONTROUTE 04 /* no routing, default */ + +#define x_sotorawcb(x_so) ((struct x_rawcb *)(x_so)->x_so_pcb) + +/* + * Nominal space allocated to a raw socket. + */ +#define x_RAWSNDQ 2048 +#define x_RAWRCVQ 2048 + +/* + * Format of raw interface header prepended by + * raw_input after call from protocol specific + * input routine. + */ +struct x_raw_header { + struct x_sockproto x_raw_proto; /* format of packet */ + struct x_sockaddr x_raw_dst; /* dst address for rawintr */ + struct x_sockaddr x_raw_src; /* src address for sbappendaddr */ +}; + +#ifdef x_KERNEL +struct x_rawcb x_rawcb; /* head of list */ +#endif + +#endif diff --git a/x_include/net/x_route.h b/x_include/net/x_route.h new file mode 100644 index 0000000..8a753c1 --- /dev/null +++ b/x_include/net/x_route.h @@ -0,0 +1,90 @@ +#include "x_.h" + +#ifndef x__NET_ROUTE_H_ +#define x__NET_ROUTE_H_ + +#include +#include + +/* + * Copyright (c) 1980, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)route.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Kernel resident routing tables. + * + * The routing tables are initialized when interface addresses + * are set by making entries for all directly connected interfaces. + */ + +/* + * A route consists of a destination address and a reference + * to a routing entry. These are often held by protocols + * in their control blocks, e.g. inpcb. + */ +struct x_route { + struct x_rtentry *x_ro_rt; + struct x_sockaddr x_ro_dst; +}; + +/* + * We distinguish between routes to hosts and routes to networks, + * preferring the former if available. For each route we infer + * the interface to use from the gateway address supplied when + * the route was entered. Routes that forward packets through + * gateways are marked so that the output routines know to address the + * gateway rather than the ultimate destination. + */ +struct x_rtentry { + x_u_long x_rt_hash; /* to speed lookups */ + struct x_sockaddr x_rt_dst; /* key */ + struct x_sockaddr x_rt_gateway; /* value */ + x_short x_rt_flags; /* up/down?, host/net */ + x_short x_rt_refcnt; /* # held references */ + x_u_long x_rt_use; /* raw # packets forwarded */ + struct x_ifnet *x_rt_ifp; /* the answer: interface to use */ +}; + +#define x_RTF_UP 0x1 /* route useable */ +#define x_RTF_GATEWAY 0x2 /* destination is a gateway */ +#define x_RTF_HOST 0x4 /* host entry (net otherwise) */ +#define x_RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ + +/* + * Routing statistics. + */ +struct x_rtstat { + x_short x_rts_badredirect; /* bogus redirect calls */ + x_short x_rts_dynamic; /* routes created by redirects */ + x_short x_rts_newgateway; /* routes modified by redirects */ + x_short x_rts_unreach; /* lookups which failed */ + x_short x_rts_wildcard; /* lookups satisfied by a wildcard */ +}; + +#ifdef x_KERNEL +#define x_RTFREE(x_rt) \ + if ((x_rt)->x_rt_refcnt == 1) \ + x_rtfree(x_rt); \ + else \ + (x_rt)->x_rt_refcnt--; + +#ifdef x_GATEWAY +#define x_RTHASHSIZ 64 +#else +#define x_RTHASHSIZ 8 +#endif +#if (x_RTHASHSIZ & (x_RTHASHSIZ - 1)) == 0 +#define x_RTHASHMOD(x_h) ((x_h) & (x_RTHASHSIZ - 1)) +#else +#define x_RTHASHMOD(x_h) ((x_h) % x_RTHASHSIZ) +#endif +struct x_mbuf *x_rthost[x_RTHASHSIZ]; +struct x_mbuf *x_rtnet[x_RTHASHSIZ]; +struct x_rtstat x_rtstat; +#endif + +#endif diff --git a/x_include/netimp/x_if_imp.h b/x_include/netimp/x_if_imp.h new file mode 100644 index 0000000..807eccf --- /dev/null +++ b/x_include/netimp/x_if_imp.h @@ -0,0 +1,170 @@ +#include "x_.h" + +#ifndef x__NETIMP_IF_IMP_H_ +#define x__NETIMP_IF_IMP_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_imp.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Structure of IMP 1822 long leader. + */ +struct x_control_leader { + x_u_char x_dl_format; /* leader format */ + x_u_char x_dl_network; /* src/dest network */ + x_u_char x_dl_flags; /* leader flags */ + x_u_char x_dl_mtype; /* message type */ + x_u_char x_dl_htype; /* handling type */ + x_u_char x_dl_host; /* host number */ + x_u_short x_dl_imp; /* imp field */ + x_u_char x_dl_link; /* link number */ + x_u_char x_dl_subtype; /* message subtype */ +}; + +struct x_imp_leader { + struct x_control_leader x_il_dl; +#define x_il_format x_il_dl.x_dl_format +#define x_il_network x_il_dl.x_dl_network +#define x_il_flags x_il_dl.x_dl_flags +#define x_il_mtype x_il_dl.x_dl_mtype +#define x_il_htype x_il_dl.x_dl_htype +#define x_il_host x_il_dl.x_dl_host +#define x_il_imp x_il_dl.x_dl_imp +#define x_il_link x_il_dl.x_dl_link +#define x_il_subtype x_il_dl.x_dl_subtype + x_u_short x_il_length; /* message length */ +}; + +#define x_IMP_DROPCNT 2 /* # of noops from imp to ignore */ +/* insure things are even... */ +#define x_IMPMTU ((8159 / x_NBBY) & ~01) + +/* + * IMP-host flags + */ +#define x_IMP_NFF 0xf /* 96-bit (new) format */ +#define x_IMP_TRACE 0x8 /* trace message route */ + +#define x_IMP_DMASK 0x3 /* host going down mask */ + +/* + * IMP-host message types. + */ +#define x_IMPTYPE_DATA 0 /* data for protocol */ +#define x_IMPTYPE_BADLEADER 1 /* leader error */ +#define x_IMPTYPE_DOWN 2 /* imp going down */ +#define x_IMPTYPE_NOOP 4 /* noop seen during initialization */ +#define x_IMPTYPE_RFNM 5 /* request for new messages */ +#define x_IMPTYPE_HOSTDEAD 6 /* host doesn't respond */ +#define x_IMPTYPE_HOSTUNREACH 7 /* host unreachable */ +#define x_IMPTYPE_BADDATA 8 /* data error */ +#define x_IMPTYPE_INCOMPLETE 9 /* incomplete message, send rest */ +#define x_IMPTYPE_RESET 10 /* reset complete */ +/* non-blocking IMP interface */ +#define x_IMPTYPE_RETRY 11 /* IMP refused, try again */ +#define x_IMPTYPE_NOTIFY 12 /* IMP refused, will notify */ +#define x_IMPTYPE_TRYING 13 /* IMP refused, still rexmt'ng */ +#define x_IMPTYPE_READY 14 /* ready for next message */ + +/* + * IMPTYPE_DOWN subtypes. + */ +#define x_IMPDOWN_GOING 0 /* 30 secs */ +#define x_IMPDOWN_PM 1 /* hardware PM */ +#define x_IMPDOWN_RELOAD 2 /* software reload */ +#define x_IMPDOWN_RESTART 3 /* emergency restart */ + +/* + * IMPTYPE_BADLEADER subtypes. + */ +#define x_IMPLEADER_ERR 0 /* error flip-flop set */ +#define x_IMPLEADER_SHORT 1 /* leader < 80 bits */ +#define x_IMPLEADER_TYPE 2 /* illegal type field */ +#define x_IMPLEADER_OPPOSITE 3 /* opposite leader type */ + +/* + * IMPTYPE_HOSTDEAD subtypes. + */ +#define x_IMPHOST_NORDY 1 /* ready-line negated */ +#define x_IMPHOST_TARDY 2 /* tardy receiving mesgs */ +#define x_IMPHOST_NOEXIST 3 /* NCC doesn't know host */ +#define x_IMPHOST_IMPSOFT 4 /* IMP software won't allow mesgs */ +#define x_IMPHOST_PM 5 /* host down for scheduled PM */ +#define x_IMPHOST_HARDSCHED 6 /* " " " " hardware work */ +#define x_IMPHOST_SOFTSCHED 7 /* " " " " software work */ +#define x_IMPHOST_RESTART 8 /* host down for emergency restart */ +#define x_IMPHOST_POWER 9 /* down because of power outage */ +#define x_IMPHOST_BREAKPOINT 10 /* host stopped at a breakpoint */ +#define x_IMPHOST_HARDWARE 11 /* hardware failure */ +#define x_IMPHOST_NOTUP 12 /* host not scheduled to be up */ +/* 13-14 currently unused */ +#define x_IMPHOST_COMINGUP 15 /* host in process of coming up */ + +/* + * IMPTYPE_HOSTUNREACH subtypes. + */ +#define x_IMPREACH_IMP 0 /* destination IMP can't be reached */ +#define x_IMPREACH_HOSTUP 1 /* destination host isn't up */ +#define x_IMPREACH_LEADER 2 /* host doesn't support long leader */ +#define x_IMPREACH_PROHIBITED 3 /* communication is prohibited */ + +/* + * IMPTYPE_INCOMPLETE subtypes. + */ +#define x_IMPCOMPLETE_SLOW 0 /* host didn't take data fast enough */ +#define x_IMPCOMPLETE_TOOLONG 1 /* message was too long */ +#define x_IMPCOMPLETE_TIMEOUT 2 /* mesg transmission time > 15 sec. */ +#define x_IMPCOMPLETE_FAILURE 3 /* IMP/circuit failure */ +#define x_IMPCOMPLETE_NOSPACE 4 /* no resources within 15 sec. */ +#define x_IMPCOMPLETE_IMPIO 5 /* src IMP I/O failure during receipt */ + +/* + * IMPTYPE_RETRY subtypes. + */ +#define x_IMPRETRY_BUFFER 0 /* IMP buffer wasn't available */ +#define x_IMPRETRY_BLOCK 1 /* connection block unavailable */ + +/* + * Data structure shared between IMP protocol module and hardware + * interface driver. Used to allow layering of IMP routines on top + * of varying device drivers. NOTE: there's a possible problem + * with ambiguity in the ``unit'' definition which is implicitly + * shared by the both IMP and device code. If we have two IMPs, + * with each on top of a device of the same unit, things won't work. + * The assumption is if you've got multiple IMPs, then they all run + * on top of the same type of device, or they must have different units. + */ +struct x_impcb { + char x_ic_oactive; /* output in progress */ + x_int (*x_ic_init)(); /* hardware init routine */ + x_int (*x_ic_start)(); /* hardware start output routine */ +}; + +/* + * State of an IMP. + */ +#define x_IMPS_DOWN 0 /* unavailable, don't use */ +#define x_IMPS_GOINGDOWN 1 /* been told we go down soon */ +#define x_IMPS_INIT 2 /* coming up */ +#define x_IMPS_UP 3 /* ready to go */ +#define x_IMPS_RESET 4 /* reset in progress */ + +#define x_IMPTV_DOWN (30*60) /* going down timer 30 secs */ + +#ifdef x_IMPLEADERS +char *x_impleaders[x_IMPTYPE_READY+1] = { + "DATA", "BADLEADER", "DOWN", "bad", "NOOP", "RFNM", "HOSTDEAD", + "HOSTUNREACH", "BADDATA", "INCOMPLETE", "RESET", "RETRY", + "NOTIFY", "TRYING", "READY" +}; +#endif + +#endif diff --git a/x_include/netimp/x_if_imphost.h b/x_include/netimp/x_if_imphost.h new file mode 100644 index 0000000..895d247 --- /dev/null +++ b/x_include/netimp/x_if_imphost.h @@ -0,0 +1,104 @@ +#include "x_.h" + +#ifndef x__NETIMP_IF_IMPHOST_H_ +#define x__NETIMP_IF_IMPHOST_H_ + +#include +#include +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_imphost.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Host structure used with IMP's. + * Used to hold outgoing packets which + * would exceed allowed RFNM count. + * + * These structures are packed into + * mbuf's and kept as small as possible. + */ +struct x_host { + struct x_mbuf *x_h_q; /* holding queue */ + struct x_in_addr x_h_addr; /* host's address */ + x_u_char x_h_qcnt; /* size of holding q */ + x_u_char x_h_timer; /* used to stay off deletion */ + x_u_char x_h_rfnm; /* # outstanding rfnm's */ + x_u_char x_h_flags; /* see below */ +}; + +/* + * A host structure is kept around (even when there are no + * references to it) for a spell to avoid constant reallocation + * and also to reflect IMP status back to sites which aren't + * directly connected to the IMP. When structures are marked + * free, a timer is started; when the timer expires the structure + * is scavenged. + */ +#define x_HF_INUSE 0x1 +#define x_HF_DEAD (1<>24)+(x_a).x_s_addr) % x_HPMBUF) +#endif + +/* + * In-line expansions for queuing operations on + * host message holding queue. Queue is maintained + * as circular list with the head pointing to the + * last message in the queue. + */ +#define x_HOST_ENQUE(x_hp, x_m) { \ + register struct x_mbuf *x_n; \ + (x_hp)->x_h_qcnt++; \ + if ((x_n = (x_hp)->x_h_q) == 0) \ + (x_hp)->x_h_q = (x_m)->x_m_act = (x_m); \ + else { \ + (x_m)->x_m_act = x_n->x_m_act; \ + (x_hp)->x_h_q = x_n->x_m_act = (x_m); \ + } \ +} +#define x_HOST_DEQUE(x_hp, x_m) { \ + if ((x_m) = (x_hp)->x_h_q) { \ + if ((x_m)->x_m_act == (x_m)) \ + (x_hp)->x_h_q = 0; \ + else { \ + (x_m) = (x_m)->x_m_act; \ + (x_hp)->x_h_q->x_m_act = (x_m)->x_m_act; \ + } \ + (x_hp)->x_h_qcnt--; \ + (x_m)->x_m_act = 0; \ + } \ +} + +struct x_hmbuf { + x_int x_hm_count; /* # of struct's in use */ + struct x_host x_hm_hosts[x_HPMBUF]; /* data structures proper */ +}; + +#ifdef x_KERNEL +/*struct host *hostlookup();*/ +/*struct host *hostenter();*/ +/*struct mbuf *hostdeque();*/ +#endif + +#endif diff --git a/x_include/netinet/x_icmp_var.h b/x_include/netinet/x_icmp_var.h new file mode 100644 index 0000000..ebeff81 --- /dev/null +++ b/x_include/netinet/x_icmp_var.h @@ -0,0 +1,39 @@ +#include "x_.h" + +#ifndef x__NETINET_ICMP_VAR_H_ +#define x__NETINET_ICMP_VAR_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)icmp_var.h 7.2 (Berkeley) 1/13/87 + */ + +/* + * Variables related to this implementation + * of the internet control message protocol. + */ +struct x_icmpstat { +/* statistics related to icmp packets generated */ + x_int x_icps_error; /* # of calls to icmp_error */ + x_int x_icps_oldshort; /* no error 'cuz old ip too short */ + x_int x_icps_oldicmp; /* no error 'cuz old was icmp */ + x_int x_icps_outhist[x_ICMP_MAXTYPE + 1]; +/* statistics related to input messages processed */ + x_int x_icps_badcode; /* icmp_code out of range */ + x_int x_icps_tooshort; /* packet < ICMP_MINLEN */ + x_int x_icps_checksum; /* bad checksum */ + x_int x_icps_badlen; /* calculated bound mismatch */ + x_int x_icps_reflect; /* number of responses */ + x_int x_icps_inhist[x_ICMP_MAXTYPE + 1]; +}; + +#ifdef x_KERNEL +struct x_icmpstat x_icmpstat; +#endif + +#endif diff --git a/x_include/netinet/x_if_ether.h b/x_include/netinet/x_if_ether.h new file mode 100644 index 0000000..9495d26 --- /dev/null +++ b/x_include/netinet/x_if_ether.h @@ -0,0 +1,91 @@ +#include "x_.h" + +#ifndef x__NETINET_IF_ETHER_H_ +#define x__NETINET_IF_ETHER_H_ + +#include +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_ether.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Structure of a 10Mb/s Ethernet header. + */ +struct x_ether_header { + x_u_char x_ether_dhost[6]; + x_u_char x_ether_shost[6]; + x_u_short x_ether_type; +}; + +#define x_ETHERTYPE_PUP 0x0200 /* PUP protocol */ +#define x_ETHERTYPE_IP 0x0800 /* IP protocol */ +#define x_ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ + +/* + * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have + * (type-ETHERTYPE_TRAIL)*512 bytes of data followed + * by an ETHER type (as given above) and then the (variable-length) header. + */ +#define x_ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ +#define x_ETHERTYPE_NTRAILER 16 + +#define x_ETHERMTU 1500 +#define x_ETHERMIN (60-14) + +/* + * Ethernet Address Resolution Protocol. + * + * See RFC 826 for protocol description. Structure below is adapted + * to resolving internet addresses. Field names used correspond to + * RFC 826. + */ +struct x_ether_arp { + struct x_arphdr x_ea_hdr; /* fixed-size header */ + x_u_char x_arp_sha[6]; /* sender hardware address */ + x_u_char x_arp_spa[4]; /* sender protocol address */ + x_u_char x_arp_tha[6]; /* target hardware address */ + x_u_char x_arp_tpa[4]; /* target protocol address */ +}; +#define x_arp_hrd x_ea_hdr.x_ar_hrd +#define x_arp_pro x_ea_hdr.x_ar_pro +#define x_arp_hln x_ea_hdr.x_ar_hln +#define x_arp_pln x_ea_hdr.x_ar_pln +#define x_arp_op x_ea_hdr.x_ar_op + +/* + * Structure shared between the ethernet driver modules and + * the address resolution code. For example, each ec_softc or il_softc + * begins with this structure. + */ +struct x_arpcom { + struct x_ifnet x_ac_if; /* network-visible interface */ + x_u_char x_ac_enaddr[6]; /* ethernet hardware address */ + struct x_in_addr x_ac_ipaddr; /* copy of ip address- XXX */ +}; + +/* + * Internet to ethernet address resolution table. + */ +struct x_arptab { + struct x_in_addr x_at_iaddr; /* internet address */ + x_u_char x_at_enaddr[6]; /* ethernet address */ + x_u_char x_at_timer; /* minutes since last reference */ + x_u_char x_at_flags; /* flags */ + struct x_mbuf *x_at_hold; /* last packet until resolved/timeout */ +}; + +#ifdef x_KERNEL +x_u_char x_etherbroadcastaddr[6]; +/*struct arptab *arptnew();*/ +/*char *ether_sprintf();*/ +#endif + +#endif diff --git a/x_include/netinet/x_in.h b/x_include/netinet/x_in.h new file mode 100644 index 0000000..b848e61 --- /dev/null +++ b/x_include/netinet/x_in.h @@ -0,0 +1,124 @@ +#include "x_.h" + +#ifndef x__NETINET_IN_H_ +#define x__NETINET_IN_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)in.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981. + */ + +/* + * Protocols + */ +#define x_IPPROTO_IP 0 /* dummy for IP */ +#define x_IPPROTO_ICMP 1 /* control message protocol */ +#define x_IPPROTO_GGP 2 /* gateway^2 (deprecated) */ +#define x_IPPROTO_TCP 6 /* tcp */ +#define x_IPPROTO_EGP 8 /* exterior gateway protocol */ +#define x_IPPROTO_PUP 12 /* pup */ +#define x_IPPROTO_UDP 17 /* user datagram protocol */ +#define x_IPPROTO_IDP 22 /* xns idp */ + +#define x_IPPROTO_RAW 255 /* raw IP packet */ +#define x_IPPROTO_MAX 256 + +/* + * Ports < IPPORT_RESERVED are reserved for + * privileged processes (e.g. root). + * Ports > IPPORT_USERRESERVED are reserved + * for servers, not necessarily privileged. + */ +#define x_IPPORT_RESERVED 1024 +#define x_IPPORT_USERRESERVED 5000 + +/* + * Link numbers + */ +#define x_IMPLINK_IP 155 +#define x_IMPLINK_LOWEXPER 156 +#define x_IMPLINK_HIGHEXPER 158 + +/* + * Internet address (a structure for historical reasons) + */ +struct x_in_addr { + x_u_long x_s_addr; +}; + +/* + * Definitions of bits in internet address integers. + * On subnets, the decomposition of addresses to host and net parts + * is done according to subnet mask, not the masks here. + */ +#define x_IN_CLASSA(x_i) (((x_long)(x_i) & 0x80000000) == 0) +#define x_IN_CLASSA_NET 0xff000000 +#define x_IN_CLASSA_NSHIFT 24 +#define x_IN_CLASSA_HOST 0x00ffffff +#define x_IN_CLASSA_MAX 128 + +#define x_IN_CLASSB(x_i) (((x_long)(x_i) & 0xc0000000) == 0x80000000) +#define x_IN_CLASSB_NET 0xffff0000 +#define x_IN_CLASSB_NSHIFT 16 +#define x_IN_CLASSB_HOST 0x0000ffff +#define x_IN_CLASSB_MAX 65536 + +#define x_IN_CLASSC(x_i) (((x_long)(x_i) & 0xc0000000) == 0xc0000000) +#define x_IN_CLASSC_NET 0xffffff00 +#define x_IN_CLASSC_NSHIFT 8 +#define x_IN_CLASSC_HOST 0x000000ff + +#define x_INADDR_ANY (x_u_long)0x00000000 +#define x_INADDR_BROADCAST (x_u_long)0xffffffff /* must be masked */ + +/* + * Socket address, internet style. + */ +struct x_sockaddr_in { + x_short x_sin_family; + x_u_short x_sin_port; + struct x_in_addr x_sin_addr; + char x_sin_zero[8]; +}; + +/* + * Options for use with [gs]etsockopt at the IP level. + */ +#define x_IP_OPTIONS 1 /* set/get IP per-packet options */ + +/* moved this to net.h as it's shared by netns/ns.h */ +/*#if !defined(vax) && !defined(ntohl) && !defined(lint)*/ +/* + * Macros for number representation conversion. + */ +/*#define ntohl(x) (x)*/ +/*#define ntohs(x) (x)*/ +/*#define htonl(x) (x)*/ +/*#define htons(x) (x)*/ +/*#endif*/ + +/*#if !defined(ntohl) && (defined(vax) || defined(lint))*/ +/*u_short ntohs(), htons();*/ +/*u_long ntohl(), htonl();*/ +/*#endif*/ + +#ifdef x_KERNEL +extern struct x_domain x_inetdomain; +extern struct x_protosw x_inetsw[]; +/*struct in_addr in_makeaddr();*/ +/*u_long in_netof(), in_lnaof();*/ +#endif + +#endif diff --git a/x_include/netinet/x_in_pcb.h b/x_include/netinet/x_in_pcb.h new file mode 100644 index 0000000..eaca804 --- /dev/null +++ b/x_include/netinet/x_in_pcb.h @@ -0,0 +1,49 @@ +#include "x_.h" + +#ifndef x__NETINET_IN_PCB_H_ +#define x__NETINET_IN_PCB_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)in_pcb.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Common structure pcb for internet protocol implementation. + * Here are stored pointers to local and foreign host table + * entries, local and foreign socket numbers, and pointers + * up (to a socket structure) and down (to a protocol-specific) + * control block. + */ +struct x_inpcb { + struct x_inpcb *x_inp_next,*x_inp_prev; + /* pointers to other pcb's */ + struct x_inpcb *x_inp_head; /* pointer back to chain of inpcb's + for this protocol */ + struct x_in_addr x_inp_faddr; /* foreign host table entry */ + x_u_short x_inp_fport; /* foreign port */ + struct x_in_addr x_inp_laddr; /* local host table entry */ + x_u_short x_inp_lport; /* local port */ + struct x_socket *x_inp_socket; /* back pointer to socket */ + x_caddr_t x_inp_ppcb; /* pointer to per-protocol pcb */ + struct x_route x_inp_route; /* placeholder for routing entry */ + struct x_mbuf *x_inp_options; /* IP options */ +}; + +#define x_INPLOOKUP_WILDCARD 1 +#define x_INPLOOKUP_SETLOCAL 2 + +#define x_sotoinpcb(x_so) ((struct x_inpcb *)(x_so)->x_so_pcb) + +#ifdef x_KERNEL +/*struct inpcb *in_pcblookup();*/ +#endif + +#endif diff --git a/x_include/netinet/x_in_systm.h b/x_include/netinet/x_in_systm.h new file mode 100644 index 0000000..2e45e2b --- /dev/null +++ b/x_include/netinet/x_in_systm.h @@ -0,0 +1,38 @@ +#include "x_.h" + +#ifndef x__NETINET_IN_SYSTM_H_ +#define x__NETINET_IN_SYSTM_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)in_systm.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Miscellaneous internetwork + * definitions for kernel. + */ + +/* + * Network types. + * + * Internally the system keeps counters in the headers with the bytes + * swapped so that VAX instructions will work on them. It reverses + * the bytes before transmission at each protocol level. The n_ types + * represent the types with the bytes in ``high-ender'' order. + */ +typedef x_u_short x_n_short; /* short as received from the net */ +typedef x_u_long x_n_long; /* long as received from the net */ + +typedef x_u_long x_n_time; /* ms since 00:00 GMT, byte rev */ + +#ifdef x_KERNEL +/*n_time iptime();*/ +#endif + +#endif diff --git a/x_include/netinet/x_in_var.h b/x_include/netinet/x_in_var.h new file mode 100644 index 0000000..5e859b4 --- /dev/null +++ b/x_include/netinet/x_in_var.h @@ -0,0 +1,54 @@ +#include "x_.h" + +#ifndef x__NETINET_IN_VAR_H_ +#define x__NETINET_IN_VAR_H_ + +#include +#include +#include + +/* + * Copyright (c) 1985, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)in_var.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Interface address, Internet version. One of these structures + * is allocated for each interface with an Internet address. + * The ifaddr structure contains the protocol-independent part + * of the structure and is assumed to be first. + */ +struct x_in_ifaddr { + struct x_ifaddr x_ia_ifa; /* protocol-independent info */ +#define x_ia_addr x_ia_ifa.x_ifa_addr +#define x_ia_broadaddr x_ia_ifa.x_ifa_broadaddr +#define x_ia_dstaddr x_ia_ifa.x_ifa_dstaddr +#define x_ia_ifp x_ia_ifa.x_ifa_ifp + x_u_long x_ia_net; /* network number of interface */ + x_u_long x_ia_netmask; /* mask of net part */ + x_u_long x_ia_subnet; /* subnet number, including net */ + x_u_long x_ia_subnetmask; /* mask of net + subnet */ + struct x_in_addr x_ia_netbroadcast; /* broadcast addr for (logical) net */ + x_int x_ia_flags; + struct x_in_ifaddr *x_ia_next; /* next in list of internet addresses */ +}; +/* + * Given a pointer to an in_ifaddr (ifaddr), + * return a pointer to the addr as a sockadd_in. + */ +#define x_IA_SIN(x_ia) ((struct x_sockaddr_in *)(&((struct x_in_ifaddr *)x_ia)->x_ia_addr)) +/* + * ia_flags + */ +#define x_IFA_ROUTE 0x01 /* routing entry installed */ + +#ifdef x_KERNEL +struct x_in_ifaddr *x_in_ifaddr; +/*struct in_ifaddr *in_iaonnetof();*/ +struct x_ifqueue x_ipintrq; /* ip packet input queue */ +#endif + +#endif diff --git a/x_include/netinet/x_ip.h b/x_include/netinet/x_ip.h new file mode 100644 index 0000000..430e555 --- /dev/null +++ b/x_include/netinet/x_ip.h @@ -0,0 +1,119 @@ +#include "x_.h" + +#ifndef x__NETINET_IP_H_ +#define x__NETINET_IP_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ip.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Definitions for internet protocol version 4. + * Per RFC 791, September 1981. + */ +#define x_IPVERSION 4 + +/* + * Structure of an internet header, naked of options. + * + * We declare ip_len and ip_off to be short, rather than u_short + * pragmatically since otherwise unsigned comparisons can result + * against negative integers quite easily, and fail in subtle ways. + */ +struct x_ip { +#ifdef x_vax + x_u_char x_ip_hl:4, /* header length */ + x_ip_v:4; /* version */ +#endif + x_u_char x_ip_tos; /* type of service */ + x_short x_ip_len; /* total length */ + x_u_short x_ip_id; /* identification */ + x_short x_ip_off; /* fragment offset field */ +#define x_IP_DF 0x4000 /* dont fragment flag */ +#define x_IP_MF 0x2000 /* more fragments flag */ + x_u_char x_ip_ttl; /* time to live */ + x_u_char x_ip_p; /* protocol */ + x_u_short x_ip_sum; /* checksum */ + struct x_in_addr x_ip_src,x_ip_dst; /* source and dest address */ +}; + +/* + * Definitions for options. + */ +#define x_IPOPT_COPIED(x_o) ((x_o)&0x80) +#define x_IPOPT_CLASS(x_o) ((x_o)&0x60) +#define x_IPOPT_NUMBER(x_o) ((x_o)&0x1f) + +#define x_IPOPT_CONTROL 0x00 +#define x_IPOPT_RESERVED1 0x20 +#define x_IPOPT_DEBMEAS 0x40 +#define x_IPOPT_RESERVED2 0x60 + +#define x_IPOPT_EOL 0 /* end of option list */ +#define x_IPOPT_NOP 1 /* no operation */ + +#define x_IPOPT_RR 7 /* record packet route */ +#define x_IPOPT_TS 68 /* timestamp */ +#define x_IPOPT_SECURITY 130 /* provide s,c,h,tcc */ +#define x_IPOPT_LSRR 131 /* loose source route */ +#define x_IPOPT_SATID 136 /* satnet id */ +#define x_IPOPT_SSRR 137 /* strict source route */ + +/* + * Offsets to fields in options other than EOL and NOP. + */ +#define x_IPOPT_OPTVAL 0 /* option ID */ +#define x_IPOPT_OLEN 1 /* option length */ +#define x_IPOPT_OFFSET 2 /* offset within option */ +#define x_IPOPT_MINOFF 4 /* min value of above */ + +/* + * Time stamp option structure. + */ +struct x_ip_timestamp { + x_u_char x_ipt_code; /* IPOPT_TS */ + x_u_char x_ipt_len; /* size of structure (variable) */ + x_u_char x_ipt_ptr; /* index of current entry */ + x_u_char x_ipt_flg:4, /* flags, see below */ + x_ipt_oflw:4; /* overflow counter */ + union { + x_n_long x_ipt_time[1]; + struct x_ipt_ta { + struct x_in_addr x_ipt_addr; + x_n_long x_ipt_time; + } x_ipt_ta[1]; + }; +}; + +/* flag bits for ipt_flg */ +#define x_IPOPT_TS_TSONLY 0 /* timestamps only */ +#define x_IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ +#define x_IPOPT_TS_PRESPEC 2 /* specified modules only */ + +/* bits for security (not byte swapped) */ +#define x_IPOPT_SECUR_UNCLASS 0x0000 +#define x_IPOPT_SECUR_CONFID 0xf135 +#define x_IPOPT_SECUR_EFTO 0x789a +#define x_IPOPT_SECUR_MMMM 0xbc4d +#define x_IPOPT_SECUR_RESTR 0xaf13 +#define x_IPOPT_SECUR_SECRET 0xd788 +#define x_IPOPT_SECUR_TOPSECRET 0x6bc5 + +/* + * Internet implementation parameters. + */ +#define x_MAXTTL 255 /* maximum time to live (seconds) */ +#define x_IPFRAGTTL 15 /* time to live for frag chains */ +#define x_IPTTLDEC 1 /* subtracted when forwarding */ + +#define x_IP_MSS 576 /* default maximum segment size */ + +#endif diff --git a/x_include/netinet/x_ip_icmp.h b/x_include/netinet/x_ip_icmp.h new file mode 100644 index 0000000..9815945 --- /dev/null +++ b/x_include/netinet/x_ip_icmp.h @@ -0,0 +1,112 @@ +#include "x_.h" + +#ifndef x__NETINET_IP_ICMP_H_ +#define x__NETINET_IP_ICMP_H_ + +#include +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ip_icmp.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Interface Control Message Protocol Definitions. + * Per RFC 792, September 1981. + */ + +/* + * Structure of an icmp header. + */ +struct x_icmp { + x_u_char x_icmp_type; /* type of message, see below */ + x_u_char x_icmp_code; /* type sub code */ + x_u_short x_icmp_cksum; /* ones complement cksum of struct */ + union { + x_u_char x_ih_pptr; /* ICMP_PARAMPROB */ + struct x_in_addr x_ih_gwaddr; /* ICMP_REDIRECT */ + struct x_ih_idseq { + x_n_short x_icd_id; + x_n_short x_icd_seq; + } x_ih_idseq; + x_int x_ih_void; + } x_icmp_hun; +#define x_icmp_pptr x_icmp_hun.x_ih_pptr +#define x_icmp_gwaddr x_icmp_hun.x_ih_gwaddr +#define x_icmp_id x_icmp_hun.x_ih_idseq.x_icd_id +#define x_icmp_seq x_icmp_hun.x_ih_idseq.x_icd_seq +#define x_icmp_void x_icmp_hun.x_ih_void + union { + struct x_id_ts { + x_n_time x_its_otime; + x_n_time x_its_rtime; + x_n_time x_its_ttime; + } x_id_ts; + struct x_id_ip { + struct x_ip x_idi_ip; + /* options and then 64 bits of data */ + } x_id_ip; + x_u_long x_id_mask; + char x_id_data[1]; + } x_icmp_dun; +#define x_icmp_otime x_icmp_dun.x_id_ts.x_its_otime +#define x_icmp_rtime x_icmp_dun.x_id_ts.x_its_rtime +#define x_icmp_ttime x_icmp_dun.x_id_ts.x_its_ttime +#define x_icmp_ip x_icmp_dun.x_id_ip.x_idi_ip +#define x_icmp_mask x_icmp_dun.x_id_mask +#define x_icmp_data x_icmp_dun.x_id_data +}; + +/* + * Lower bounds on packet lengths for various types. + * For the error advice packets must first insure that the + * packet is large enought to contain the returned ip header. + * Only then can we do the check to see if 64 bits of packet + * data have been returned, since we need to check the returned + * ip header length. + */ +#define x_ICMP_MINLEN 8 /* abs minimum */ +#define x_ICMP_TSLEN (8 + 3 * sizeof (x_n_time)) /* timestamp */ +#define x_ICMP_MASKLEN 12 /* address mask */ +#define x_ICMP_ADVLENMIN (8 + sizeof (struct x_ip) + 8) /* min */ +#define x_ICMP_ADVLEN(x_p) (8 + ((x_p)->x_icmp_ip.x_ip_hl << 2) + 8) + /* N.B.: must separately check that ip_hl >= 5 */ + +/* + * Definition of type and code field values. + */ +#define x_ICMP_ECHOREPLY 0 /* echo reply */ +#define x_ICMP_UNREACH 3 /* dest unreachable, codes: */ +#define x_ICMP_UNREACH_NET 0 /* bad net */ +#define x_ICMP_UNREACH_HOST 1 /* bad host */ +#define x_ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ +#define x_ICMP_UNREACH_PORT 3 /* bad port */ +#define x_ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ +#define x_ICMP_UNREACH_SRCFAIL 5 /* src route failed */ +#define x_ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ +#define x_ICMP_REDIRECT 5 /* shorter route, codes: */ +#define x_ICMP_REDIRECT_NET 0 /* for network */ +#define x_ICMP_REDIRECT_HOST 1 /* for host */ +#define x_ICMP_REDIRECT_TOSNET 2 /* for tos and net */ +#define x_ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ +#define x_ICMP_ECHO 8 /* echo service */ +#define x_ICMP_TIMXCEED 11 /* time exceeded, code: */ +#define x_ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ +#define x_ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ +#define x_ICMP_PARAMPROB 12 /* ip header bad */ +#define x_ICMP_TSTAMP 13 /* timestamp request */ +#define x_ICMP_TSTAMPREPLY 14 /* timestamp reply */ +#define x_ICMP_IREQ 15 /* information request */ +#define x_ICMP_IREQREPLY 16 /* information reply */ +#define x_ICMP_MASKREQ 17 /* address mask request */ +#define x_ICMP_MASKREPLY 18 /* address mask reply */ + +#define x_ICMP_MAXTYPE 18 + +#endif diff --git a/x_include/netinet/x_ip_var.h b/x_include/netinet/x_ip_var.h new file mode 100644 index 0000000..3549d03 --- /dev/null +++ b/x_include/netinet/x_ip_var.h @@ -0,0 +1,108 @@ +#include "x_.h" + +#ifndef x__NETINET_IP_VAR_H_ +#define x__NETINET_IP_VAR_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ip_var.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Overlay for ip header used by other protocols (tcp, udp). + */ +struct x_ipovly { + x_caddr_t x_ih_next, x_ih_prev; /* for protocol sequence q's */ + x_u_char x_ih_x1; /* (unused) */ + x_u_char x_ih_pr; /* protocol */ + x_short x_ih_len; /* protocol length */ + struct x_in_addr x_ih_src; /* source internet address */ + struct x_in_addr x_ih_dst; /* destination internet address */ +}; + +/* + * Ip reassembly queue structure. Each fragment + * being reassembled is attached to one of these structures. + * They are timed out after ipq_ttl drops to 0, and may also + * be reclaimed if memory becomes tight. + */ +struct x_ipq { + struct x_ipq *x_next,*x_prev; /* to other reass headers */ + x_u_char x_ipq_ttl; /* time for reass q to live */ + x_u_char x_ipq_p; /* protocol of this fragment */ + x_u_short x_ipq_id; /* sequence id for reassembly */ + struct x_ipasfrag *x_ipq_next,*x_ipq_prev; + /* to ip headers of fragments */ + struct x_in_addr x_ipq_src,x_ipq_dst; +}; + +/* + * Ip header, when holding a fragment. + * + * Note: ipf_next must be at same offset as ipq_next above + */ +struct x_ipasfrag { +#ifdef x_vax + x_u_char x_ip_hl:4, + x_ip_v:4; +#endif + x_u_char x_ipf_mff; /* copied from (ip_off&IP_MF) */ + x_short x_ip_len; + x_u_short x_ip_id; + x_short x_ip_off; + x_u_char x_ip_ttl; + x_u_char x_ip_p; + x_u_short x_ip_sum; + struct x_ipasfrag *x_ipf_next; /* next fragment */ + struct x_ipasfrag *x_ipf_prev; /* previous fragment */ +}; + +/* + * Structure stored in mbuf in inpcb.ip_options + * and passed to ip_output when ip options are in use. + * The actual length of the options (including ipopt_dst) + * is in m_len. + */ +#define x_MAX_IPOPTLEN 40 + +struct x_ipoption { + struct x_in_addr x_ipopt_dst; /* first-hop dst if source routed */ + char x_ipopt_list[x_MAX_IPOPTLEN]; /* options proper */ +}; + +struct x_ipstat { + x_long x_ips_total; /* total packets received */ + x_long x_ips_badsum; /* checksum bad */ + x_long x_ips_tooshort; /* packet too short */ + x_long x_ips_toosmall; /* not enough data */ + x_long x_ips_badhlen; /* ip header length < data size */ + x_long x_ips_badlen; /* ip length < ip header length */ + x_long x_ips_fragments; /* fragments received */ + x_long x_ips_fragdropped; /* frags dropped (dups, out of space) */ + x_long x_ips_fragtimeout; /* fragments timed out */ + x_long x_ips_forward; /* packets forwarded */ + x_long x_ips_cantforward; /* packets rcvd for unreachable dest */ + x_long x_ips_redirectsent; /* packets forwarded on same net */ +}; + +#ifdef x_KERNEL +/* flags passed to ip_output as last parameter */ +#define x_IP_FORWARDING 0x1 /* most of ip header exists */ +#define x_IP_ROUTETOIF x_SO_DONTROUTE /* bypass routing tables */ +#define x_IP_ALLOWBROADCAST x_SO_BROADCAST /* can send broadcast packets */ + +struct x_ipstat x_ipstat; +struct x_ipq x_ipq; /* ip reass. queue */ +x_u_short x_ip_id; /* ip packet ctr, for ids */ + +/*struct mbuf *ip_srcroute();*/ +#endif + +#endif diff --git a/x_include/netinet/x_tcp.h b/x_include/netinet/x_tcp.h new file mode 100644 index 0000000..943241c --- /dev/null +++ b/x_include/netinet/x_tcp.h @@ -0,0 +1,68 @@ +#include "x_.h" + +#ifndef x__NETINET_TCP_H_ +#define x__NETINET_TCP_H_ + +#include +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)tcp.h 7.1 (Berkeley) 6/5/86 + */ + +typedef x_u_long x_tcp_seq; +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +struct x_tcphdr { + x_u_short x_th_sport; /* source port */ + x_u_short x_th_dport; /* destination port */ + x_tcp_seq x_th_seq; /* sequence number */ + x_tcp_seq x_th_ack; /* acknowledgement number */ +#ifdef x_vax + x_u_char x_th_x2:4, /* (unused) */ + x_th_off:4; /* data offset */ +#endif + x_u_char x_th_flags; +#define x_TH_FIN 0x01 +#define x_TH_SYN 0x02 +#define x_TH_RST 0x04 +#define x_TH_PUSH 0x08 +#define x_TH_ACK 0x10 +#define x_TH_URG 0x20 + x_u_short x_th_win; /* window */ + x_u_short x_th_sum; /* checksum */ + x_u_short x_th_urp; /* urgent pointer */ +}; + +#define x_TCPOPT_EOL 0 +#define x_TCPOPT_NOP 1 +#define x_TCPOPT_MAXSEG 2 + +/* + * Default maximum segment size for TCP. + * With an IP MSS of 576, this is 536, + * but 512 is probably more convenient. + */ +#ifdef x_lint +#define x_TCP_MSS 536 +#else +/* redefined this to avoid a circular dependency */ +/*#define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr))*/ +#define x_TCP_MSS x_MIN(512, x_IP_MSS - sizeof(struct x_ipovly) - sizeof(struct x_tcphdr)) +#endif + +/* + * User-settable options (used with setsockopt). + */ +#define x_TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ +#define x_TCP_MAXSEG 0x02 /* set maximum segment size */ + +#endif diff --git a/x_include/netinet/x_tcp_debug.h b/x_include/netinet/x_tcp_debug.h new file mode 100644 index 0000000..c96a7ec --- /dev/null +++ b/x_include/netinet/x_tcp_debug.h @@ -0,0 +1,44 @@ +#include "x_.h" + +#ifndef x__NETINET_TCP_DEBUG_H_ +#define x__NETINET_TCP_DEBUG_H_ + +#include +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)tcp_debug.h 7.1 (Berkeley) 6/5/86 + */ + +struct x_tcp_debug { + x_n_time x_td_time; + x_short x_td_act; + x_short x_td_ostate; + x_caddr_t x_td_tcb; + struct x_tcpiphdr x_td_ti; + x_short x_td_req; + struct x_tcpcb x_td_cb; +}; + +#define x_TA_INPUT 0 +#define x_TA_OUTPUT 1 +#define x_TA_USER 2 +#define x_TA_RESPOND 3 +#define x_TA_DROP 4 + +#ifdef x_TANAMES +char *x_tanames[] = + { "input", "output", "user", "respond", "drop" }; +#endif + +#define x_TCP_NDEBUG 100 +struct x_tcp_debug x_tcp_debug[x_TCP_NDEBUG]; +x_int x_tcp_debx; + +#endif diff --git a/x_include/netinet/x_tcp_fsm.h b/x_include/netinet/x_tcp_fsm.h new file mode 100644 index 0000000..e83e092 --- /dev/null +++ b/x_include/netinet/x_tcp_fsm.h @@ -0,0 +1,69 @@ +#include "x_.h" + +#ifndef x__NETINET_TCP_FSM_H_ +#define x__NETINET_TCP_FSM_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)tcp_fsm.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * TCP FSM state definitions. + * Per RFC793, September, 1981. + */ + +#define x_TCP_NSTATES 11 + +#define x_TCPS_CLOSED 0 /* closed */ +#define x_TCPS_LISTEN 1 /* listening for connection */ +#define x_TCPS_SYN_SENT 2 /* active, have sent syn */ +#define x_TCPS_SYN_RECEIVED 3 /* have send and received syn */ +/* states < TCPS_ESTABLISHED are those where connections not established */ +#define x_TCPS_ESTABLISHED 4 /* established */ +#define x_TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ +/* states > TCPS_CLOSE_WAIT are those where user has closed */ +#define x_TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ +#define x_TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */ +#define x_TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */ +/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ +#define x_TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ +#define x_TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */ + +#define x_TCPS_HAVERCVDSYN(x_s) ((x_s) >= x_TCPS_SYN_RECEIVED) +#define x_TCPS_HAVERCVDFIN(x_s) ((x_s) >= x_TCPS_TIME_WAIT) + +#ifdef x_TCPOUTFLAGS +/* + * Flags used when sending segments in tcp_output. + * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally + * determined by state, with the proviso that TH_FIN is sent only + * if all data queued for output is included in the segment. + */ +x_u_char x_tcp_outflags[x_TCP_NSTATES] = { + x_TH_RST|x_TH_ACK, 0, x_TH_SYN, x_TH_SYN|x_TH_ACK, + x_TH_ACK, x_TH_ACK, + x_TH_FIN|x_TH_ACK, x_TH_FIN|x_TH_ACK, x_TH_FIN|x_TH_ACK, x_TH_ACK, x_TH_ACK, +}; +#endif + +#ifdef x_KPROF +x_int x_tcp_acounts[x_TCP_NSTATES][x_PRU_NREQ]; +#endif + +#ifdef x_TCPSTATES +char *x_tcpstates[] = { + "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD", + "ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING", + "LAST_ACK", "FIN_WAIT_2", "TIME_WAIT", +}; +#endif + +#endif diff --git a/x_include/netinet/x_tcp_seq.h b/x_include/netinet/x_tcp_seq.h new file mode 100644 index 0000000..3f9d964 --- /dev/null +++ b/x_include/netinet/x_tcp_seq.h @@ -0,0 +1,44 @@ +#include "x_.h" + +#ifndef x__NETINET_TCP_SEQ_H_ +#define x__NETINET_TCP_SEQ_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)tcp_seq.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * TCP sequence numbers are 32 bit integers operated + * on with modular arithmetic. These macros can be + * used to compare such integers. + */ +#define x_SEQ_LT(x_a,x_b) ((x_int)((x_a)-(x_b)) < 0) +#define x_SEQ_LEQ(x_a,x_b) ((x_int)((x_a)-(x_b)) <= 0) +#define x_SEQ_GT(x_a,x_b) ((x_int)((x_a)-(x_b)) > 0) +#define x_SEQ_GEQ(x_a,x_b) ((x_int)((x_a)-(x_b)) >= 0) + +/* + * Macros to initialize tcp sequence numbers for + * send and receive from initial send and receive + * sequence numbers. + */ +#define x_tcp_rcvseqinit(x_tp) \ + (x_tp)->x_rcv_adv = (x_tp)->x_rcv_nxt = (x_tp)->x_irs + 1 + +#define x_tcp_sendseqinit(x_tp) \ + (x_tp)->x_snd_una = (x_tp)->x_snd_nxt = (x_tp)->x_snd_max = (x_tp)->x_snd_up = \ + (x_tp)->x_iss + +#define x_TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */ + +#ifdef x_KERNEL +x_tcp_seq x_tcp_iss; /* tcp initial send seq # */ +#endif + +#endif diff --git a/x_include/netinet/x_tcp_timer.h b/x_include/netinet/x_tcp_timer.h new file mode 100644 index 0000000..e3fa307 --- /dev/null +++ b/x_include/netinet/x_tcp_timer.h @@ -0,0 +1,119 @@ +#include "x_.h" + +#ifndef x__NETINET_TCP_TIMER_H_ +#define x__NETINET_TCP_TIMER_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)tcp_timer.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Definitions of the TCP timers. These timers are counted + * down PR_SLOWHZ times a second. + */ +#define x_TCPT_NTIMERS 4 + +#define x_TCPT_REXMT 0 /* retransmit */ +#define x_TCPT_PERSIST 1 /* retransmit persistance */ +#define x_TCPT_KEEP 2 /* keep alive */ +#define x_TCPT_2MSL 3 /* 2*msl quiet time timer */ + +/* + * The TCPT_REXMT timer is used to force retransmissions. + * The TCP has the TCPT_REXMT timer set whenever segments + * have been sent for which ACKs are expected but not yet + * received. If an ACK is received which advances tp->snd_una, + * then the retransmit timer is cleared (if there are no more + * outstanding segments) or reset to the base value (if there + * are more ACKs expected). Whenever the retransmit timer goes off, + * we retransmit one unacknowledged segment, and do a backoff + * on the retransmit timer. + * + * The TCPT_PERSIST timer is used to keep window size information + * flowing even if the window goes shut. If all previous transmissions + * have been acknowledged (so that there are no retransmissions in progress), + * and the window is too small to bother sending anything, then we start + * the TCPT_PERSIST timer. When it expires, if the window is nonzero, + * we go to transmit state. Otherwise, at intervals send a single byte + * into the peer's window to force him to update our window information. + * We do this at most as often as TCPT_PERSMIN time intervals, + * but no more frequently than the current estimate of round-trip + * packet time. The TCPT_PERSIST timer is cleared whenever we receive + * a window update from the peer. + * + * The TCPT_KEEP timer is used to keep connections alive. If an + * connection is idle (no segments received) for TCPTV_KEEP amount of time, + * but not yet established, then we drop the connection. If the connection + * is established, then we force the peer to send us a segment by sending: + * + * This segment is (deliberately) outside the window, and should elicit + * an ack segment in response from the peer. If, despite the TCPT_KEEP + * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE + * amount of time, then we drop the connection. + */ + +#define x_TCP_TTL 30 /* time to live for TCP segs */ +/* + * Time constants. + */ +#define x_TCPTV_MSL ( 15*x_PR_SLOWHZ) /* max seg lifetime */ +#define x_TCPTV_SRTTBASE 0 /* base roundtrip time; + if 0, no idea yet */ +#define x_TCPTV_SRTTDFLT ( 3*x_PR_SLOWHZ) /* assumed RTT if no info */ + +#define x_TCPTV_KEEP ( 45*x_PR_SLOWHZ) /* keep alive - 45 secs */ +#define x_TCPTV_PERSMIN ( 5*x_PR_SLOWHZ) /* retransmit persistance */ + +#define x_TCPTV_MAXIDLE ( 8*x_TCPTV_KEEP) /* maximum allowable idle + time before drop conn */ + +#define x_TCPTV_MIN ( 1*x_PR_SLOWHZ) /* minimum allowable value */ +#define x_TCPTV_MAX ( 30*x_PR_SLOWHZ) /* maximum allowable value */ + +#define x_TCP_LINGERTIME 120 /* linger at most 2 minutes */ + +#define x_TCP_MAXRXTSHIFT 12 /* maximum retransmits */ + +#ifdef x_TCPTIMERS +char *x_tcptimers[] = + { "REXMT", "PERSIST", "KEEP", "2MSL" }; +#endif + +/* + * Retransmission smoothing constants. + * Smoothed round trip time is updated by + * tp->t_srtt = (tcp_alpha * tp->t_srtt) + ((1 - tcp_alpha) * tp->t_rtt) + * each time a new value of tp->t_rtt is available. The initial + * retransmit timeout is then based on + * tp->t_timer[TCPT_REXMT] = tcp_beta * tp->t_srtt; + * limited, however to be at least TCPTV_MIN and at most TCPTV_MAX. + */ +float x_tcp_alpha, x_tcp_beta; + +/* + * Initial values of tcp_alpha and tcp_beta. + * These are conservative: averaging over a long + * period of time, and allowing for large individual deviations from + * tp->t_srtt. + */ +#define x_TCP_ALPHA 0.9 +#define x_TCP_BETA 2.0 + +/* + * Force a time value to be in a certain range. + */ +#define x_TCPT_RANGESET(x_tv, x_value, x_tvmin, x_tvmax) { \ + (x_tv) = (x_value); \ + if ((x_tv) < (x_tvmin)) \ + (x_tv) = (x_tvmin); \ + if ((x_tv) > (x_tvmax)) \ + (x_tv) = (x_tvmax); \ +} + +#endif diff --git a/x_include/netinet/x_tcp_var.h b/x_include/netinet/x_tcp_var.h new file mode 100644 index 0000000..b2144c6 --- /dev/null +++ b/x_include/netinet/x_tcp_var.h @@ -0,0 +1,104 @@ +#include "x_.h" + +#ifndef x__NETINET_TCP_VAR_H_ +#define x__NETINET_TCP_VAR_H_ + +#include +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)tcp_var.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Kernel variables for tcp. + */ + +/* + * Tcp control block, one per tcp; fields: + */ +struct x_tcpcb { + struct x_tcpiphdr *x_seg_next; /* sequencing queue */ + struct x_tcpiphdr *x_seg_prev; + x_short x_t_state; /* state of this connection */ + x_short x_t_timer[x_TCPT_NTIMERS]; /* tcp timers */ + x_short x_t_rxtshift; /* log(2) of rexmt exp. backoff */ + struct x_mbuf *x_t_tcpopt; /* tcp options */ + x_u_short x_t_maxseg; /* maximum segment size */ + char x_t_force; /* 1 if forcing out a byte */ + x_u_char x_t_flags; +#define x_TF_ACKNOW 0x01 /* ack peer immediately */ +#define x_TF_DELACK 0x02 /* ack, but try to delay it */ +#define x_TF_NODELAY 0x04 /* don't delay packets to coalesce */ +#define x_TF_NOOPT 0x08 /* don't use tcp options */ +#define x_TF_SENTFIN 0x10 /* have sent FIN */ + struct x_tcpiphdr *x_t_template; /* skeletal packet for transmit */ + struct x_inpcb *x_t_inpcb; /* back pointer to internet pcb */ +/* + * The following fields are used as in the protocol specification. + * See RFC783, Dec. 1981, page 21. + */ +/* send sequence variables */ + x_tcp_seq x_snd_una; /* send unacknowledged */ + x_tcp_seq x_snd_nxt; /* send next */ + x_tcp_seq x_snd_up; /* send urgent pointer */ + x_tcp_seq x_snd_wl1; /* window update seg seq number */ + x_tcp_seq x_snd_wl2; /* window update seg ack number */ + x_tcp_seq x_iss; /* initial send sequence number */ + x_u_short x_snd_wnd; /* send window */ +/* receive sequence variables */ + x_u_short x_rcv_wnd; /* receive window */ + x_tcp_seq x_rcv_nxt; /* receive next */ + x_tcp_seq x_rcv_up; /* receive urgent pointer */ + x_tcp_seq x_irs; /* initial receive sequence number */ +/* + * Additional variables for this implementation. + */ +/* receive variables */ + x_tcp_seq x_rcv_adv; /* advertised window */ +/* retransmit variables */ + x_tcp_seq x_snd_max; /* highest sequence number sent + * used to recognize retransmits + */ +/* congestion control (for source quench) */ + x_u_short x_snd_cwnd; /* congestion-controlled window */ +/* transmit timing stuff */ + x_short x_t_idle; /* inactivity time */ + x_short x_t_rtt; /* round trip time */ + x_u_short x_max_rcvd; /* most peer has sent into window */ + x_tcp_seq x_t_rtseq; /* sequence number being timed */ + float x_t_srtt; /* smoothed round-trip time */ + x_u_short x_max_sndwnd; /* largest window peer has offered */ +/* out-of-band data */ + char x_t_oobflags; /* have some */ + char x_t_iobc; /* input character */ +#define x_TCPOOB_HAVEDATA 0x01 +#define x_TCPOOB_HADDATA 0x02 +}; + +#define x_intotcpcb(x_ip) ((struct x_tcpcb *)(x_ip)->x_inp_ppcb) +#define x_sototcpcb(x_so) (x_intotcpcb(x_sotoinpcb(x_so))) + +struct x_tcpstat { + x_int x_tcps_badsum; + x_int x_tcps_badoff; + x_int x_tcps_hdrops; + x_int x_tcps_badsegs; + x_int x_tcps_unack; +}; + +#ifdef x_KERNEL +struct x_inpcb x_tcb; /* head of queue of active tcpcb's */ +struct x_tcpstat x_tcpstat; /* tcp statistics */ +/*struct tcpiphdr *tcp_template();*/ +/*struct tcpcb *tcp_close(), *tcp_drop();*/ +/*struct tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed();*/ +#endif + +#endif diff --git a/x_include/netinet/x_tcpip.h b/x_include/netinet/x_tcpip.h new file mode 100644 index 0000000..fe8ae99 --- /dev/null +++ b/x_include/netinet/x_tcpip.h @@ -0,0 +1,42 @@ +#include "x_.h" + +#ifndef x__NETINET_TCPIP_H_ +#define x__NETINET_TCPIP_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)tcpip.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Tcp+ip header, after ip options removed. + */ +struct x_tcpiphdr { + struct x_ipovly x_ti_i; /* overlaid ip structure */ + struct x_tcphdr x_ti_t; /* tcp header */ +}; +#define x_ti_next x_ti_i.x_ih_next +#define x_ti_prev x_ti_i.x_ih_prev +#define x_ti_x1 x_ti_i.x_ih_x1 +#define x_ti_pr x_ti_i.x_ih_pr +#define x_ti_len x_ti_i.x_ih_len +#define x_ti_src x_ti_i.x_ih_src +#define x_ti_dst x_ti_i.x_ih_dst +#define x_ti_sport x_ti_t.x_th_sport +#define x_ti_dport x_ti_t.x_th_dport +#define x_ti_seq x_ti_t.x_th_seq +#define x_ti_ack x_ti_t.x_th_ack +#define x_ti_x2 x_ti_t.x_th_x2 +#define x_ti_off x_ti_t.x_th_off +#define x_ti_flags x_ti_t.x_th_flags +#define x_ti_win x_ti_t.x_th_win +#define x_ti_sum x_ti_t.x_th_sum +#define x_ti_urp x_ti_t.x_th_urp + +#endif diff --git a/x_include/netinet/x_udp.h b/x_include/netinet/x_udp.h new file mode 100644 index 0000000..0c8f2a4 --- /dev/null +++ b/x_include/netinet/x_udp.h @@ -0,0 +1,27 @@ +#include "x_.h" + +#ifndef x__NETINET_UDP_H_ +#define x__NETINET_UDP_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)udp.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Udp protocol header. + * Per RFC 768, September, 1981. + */ +struct x_udphdr { + x_u_short x_uh_sport; /* source port */ + x_u_short x_uh_dport; /* destination port */ + x_short x_uh_ulen; /* udp length */ + x_u_short x_uh_sum; /* udp checksum */ +}; + +#endif diff --git a/x_include/netinet/x_udp_var.h b/x_include/netinet/x_udp_var.h new file mode 100644 index 0000000..4204464 --- /dev/null +++ b/x_include/netinet/x_udp_var.h @@ -0,0 +1,50 @@ +#include "x_.h" + +#ifndef x__NETINET_UDP_VAR_H_ +#define x__NETINET_UDP_VAR_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)udp_var.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * UDP kernel structures and variables. + */ +struct x_udpiphdr { + struct x_ipovly x_ui_i; /* overlaid ip structure */ + struct x_udphdr x_ui_u; /* udp header */ +}; +#define x_ui_next x_ui_i.x_ih_next +#define x_ui_prev x_ui_i.x_ih_prev +#define x_ui_x1 x_ui_i.x_ih_x1 +#define x_ui_pr x_ui_i.x_ih_pr +#define x_ui_len x_ui_i.x_ih_len +#define x_ui_src x_ui_i.x_ih_src +#define x_ui_dst x_ui_i.x_ih_dst +#define x_ui_sport x_ui_u.x_uh_sport +#define x_ui_dport x_ui_u.x_uh_dport +#define x_ui_ulen x_ui_u.x_uh_ulen +#define x_ui_sum x_ui_u.x_uh_sum + +struct x_udpstat { + x_int x_udps_hdrops; + x_int x_udps_badsum; + x_int x_udps_badlen; +}; + +#define x_UDP_TTL 30 /* time to live for UDP packets */ + +#ifdef x_KERNEL +struct x_inpcb x_udb; +struct x_udpstat x_udpstat; +#endif + +#endif diff --git a/x_include/netns/x_idp.h b/x_include/netns/x_idp.h new file mode 100644 index 0000000..e01150f --- /dev/null +++ b/x_include/netns/x_idp.h @@ -0,0 +1,29 @@ +#include "x_.h" + +#ifndef x__NETNS_IDP_H_ +#define x__NETNS_IDP_H_ + +#include +#include + +/* + * Copyright (c) 1984, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)idp.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Definitions for NS(tm) Internet Datagram Protocol + */ +struct x_idp { + x_u_short x_idp_sum; /* Checksum */ + x_u_short x_idp_len; /* Length, in bytes, including header */ + x_u_char x_idp_tc; /* Transport Crontrol (i.e. hop count) */ + x_u_char x_idp_pt; /* Packet Type (i.e. level 2 protocol) */ + struct x_ns_addr x_idp_dna; /* Destination Network Address */ + struct x_ns_addr x_idp_sna; /* Source Network Address */ +}; + +#endif diff --git a/x_include/netns/x_idp_var.h b/x_include/netns/x_idp_var.h new file mode 100644 index 0000000..c736003 --- /dev/null +++ b/x_include/netns/x_idp_var.h @@ -0,0 +1,29 @@ +#include "x_.h" + +#ifndef x__NETNS_IDP_VAR_H_ +#define x__NETNS_IDP_VAR_H_ + +/* + * Copyright (c) 1984, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)idp_var.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * IDP Kernel Structures and Variables + */ +struct x_idpstat { + x_int x_idps_badsum; /* checksum bad */ + x_int x_idps_tooshort; /* packet too short */ + x_int x_idps_toosmall; /* not enough data */ + x_int x_idps_badhlen; /* ip header length < data size */ + x_int x_idps_badlen; /* ip length < ip header length */ +}; + +#ifdef x_KERNEL +struct x_idpstat x_idpstat; +#endif + +#endif diff --git a/x_include/netns/x_ns.h b/x_include/netns/x_ns.h new file mode 100644 index 0000000..5d0f626 --- /dev/null +++ b/x_include/netns/x_ns.h @@ -0,0 +1,155 @@ +#include "x_.h" + +#ifndef x__NETNS_NS_H_ +#define x__NETNS_NS_H_ + +#include +#include +#include + +/* + * Copyright (c) 1984, 1985, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ns.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Constants and Structures defined by the Xerox Network Software + * per "Internet Transport Protocols", XSIS 028112, December 1981 + */ + +/* + * Protocols + */ +#define x_NSPROTO_RI 1 /* Routing Information */ +#define x_NSPROTO_ECHO 2 /* Echo Protocol */ +#define x_NSPROTO_ERROR 3 /* Error Protocol */ +#define x_NSPROTO_PE 4 /* Packet Exchange */ +#define x_NSPROTO_SPP 5 /* Sequenced Packet */ +#define x_NSPROTO_RAW 255 /* Placemarker*/ +#define x_NSPROTO_MAX 256 /* Placemarker*/ + +/* + * Port/Socket numbers: network standard functions + */ + +#define x_NSPORT_RI 1 /* Routing Information */ +#define x_NSPORT_ECHO 2 /* Echo */ +#define x_NSPORT_RE 3 /* Router Error */ + +/* + * Ports < NSPORT_RESERVED are reserved for priveleged + * processes (e.g. root). + */ +#define x_NSPORT_RESERVED 3000 + +/* flags passed to ns_output as last parameter */ + +#define x_NS_FORWARDING 0x1 /* most of idp header exists */ +#define x_NS_ROUTETOIF 0x10 /* same as SO_DONTROUTE */ +#define x_NS_ALLOWBROADCAST x_SO_BROADCAST /* can send broadcast packets */ + +#define x_NS_MAXHOPS 15 + +/* flags passed to get/set socket option */ +#define x_SO_HEADERS_ON_INPUT 1 +#define x_SO_HEADERS_ON_OUTPUT 2 +#define x_SO_DEFAULT_HEADERS 3 +#define x_SO_LAST_HEADER 4 +#define x_SO_NSIP_ROUTE 5 +#define x_SO_SEQNO 6 +#define x_SO_ALL_PACKETS 7 +#define x_SO_MTU 8 + +/* + * NS addressing + */ +union x_ns_host { + x_u_char x_c_host[6]; + x_u_short x_s_host[3]; +}; + +union x_ns_net { + x_u_char x_c_net[4]; + x_u_short x_s_net[2]; +}; + +union x_ns_net_u { + union x_ns_net x_net_e; + x_u_long x_long_e; +}; + +struct x_ns_addr { + union x_ns_net x_x_net; + union x_ns_host x_x_host; + x_u_short x_x_port; +}; + +/* + * Socket address, Xerox style + */ +struct x_sockaddr_ns { + x_u_short x_sns_family; + struct x_ns_addr x_sns_addr; + char x_sns_zero[2]; +}; +#define x_sns_port x_sns_addr.x_x_port + +#ifdef x_vax +#define x_ns_netof(x_a) (*(x_long *) & ((x_a).x_x_net)) /* XXX - not needed */ +#endif +#define x_ns_neteqnn(x_a,x_b) (((x_a).x_s_net[0]==(x_b).x_s_net[0]) && \ + ((x_a).x_s_net[1]==(x_b).x_s_net[1])) +#define x_ns_neteq(x_a,x_b) x_ns_neteqnn((x_a).x_x_net, (x_b).x_x_net) +#define x_satons_addr(x_sa) (((struct x_sockaddr_ns *)&(x_sa))->x_sns_addr) +#define x_ns_hosteqnh(x_s,x_t) ((x_s).x_s_host[0] == (x_t).x_s_host[0] && \ + (x_s).x_s_host[1] == (x_t).x_s_host[1] && (x_s).x_s_host[2] == (x_t).x_s_host[2]) +#define x_ns_hosteq(x_s,x_t) (x_ns_hosteqnh((x_s).x_x_host,(x_t).x_x_host)) +#define x_ns_nullhost(x_x) (((x_x).x_x_host.x_s_host[0]==0) && \ + ((x_x).x_x_host.x_s_host[1]==0) && ((x_x).x_x_host.x_s_host[2]==0)) + +/* moved this to net.h as it's shared by netinet/in.h */ +/*#if !defined(vax) && !defined(ntohl) && !defined(lint)*/ +/* + * Macros for number representation conversion. + */ +/*#define ntohl(x) (x)*/ +/*#define ntohs(x) (x)*/ +/*#define htonl(x) (x)*/ +/*#define htons(x) (x)*/ +/*#endif*/ + +/*#if !defined(ntohl) && (defined(vax) || defined(lint))*/ +/*u_short ntohs(), htons();*/ +/*u_long ntohl(), htonl();*/ +/*#endif*/ + +#ifdef x_KERNEL +extern struct x_domain x_nsdomain; +union x_ns_host x_ns_thishost; +union x_ns_host x_ns_zerohost; +union x_ns_host x_ns_broadhost; +union x_ns_net x_ns_zeronet; +union x_ns_net x_ns_broadnet; +/*u_short ns_cksum();*/ +#endif + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* ns/ns_addr.c */ +struct x_ns_addr x_ns_addr __P((char *x_name)); + +/* ns/ns_ntoa.c */ +char *x_ns_ntoa __P((struct x_ns_addr x_addr)); +#endif + +#endif diff --git a/x_include/netns/x_ns_error.h b/x_include/netns/x_ns_error.h new file mode 100644 index 0000000..8631b96 --- /dev/null +++ b/x_include/netns/x_ns_error.h @@ -0,0 +1,74 @@ +#include "x_.h" + +#ifndef x__NETNS_NS_ERROR_H_ +#define x__NETNS_NS_ERROR_H_ + +#include +#include + +/* + * Copyright (c) 1984, 1985, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ns_error.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Xerox NS error messages + */ + +struct x_ns_errp { + x_u_short x_ns_err_num; /* Error Number */ + x_u_short x_ns_err_param; /* Error Parameter */ + struct x_idp x_ns_err_idp; /* Initial segment of offending + packet */ + x_u_char x_ns_err_lev2[12]; /* at least this much higher + level protocol */ +}; +struct x_ns_epidp { + struct x_idp x_ns_ep_idp; + struct x_ns_errp x_ns_ep_errp; +}; + +#define x_NS_ERR_UNSPEC 0 /* Unspecified Error detected at dest. */ +#define x_NS_ERR_BADSUM 1 /* Bad Checksum detected at dest */ +#define x_NS_ERR_NOSOCK 2 /* Specified socket does not exist at dest*/ +#define x_NS_ERR_FULLUP 3 /* Dest. refuses packet due to resource lim.*/ +#define x_NS_ERR_UNSPEC_T 0x200 /* Unspec. Error occured before reaching dest*/ +#define x_NS_ERR_BADSUM_T 0x201 /* Bad Checksum detected in transit */ +#define x_NS_ERR_UNREACH_HOST 0x202 /* Dest cannot be reached from here*/ +#define x_NS_ERR_TOO_OLD 0x203 /* Packet x'd 15 routers without delivery*/ +#define x_NS_ERR_TOO_BIG 0x204 /* Packet too large to be forwarded through + some intermediate gateway. The error + parameter field contains the max packet + size that can be accommodated */ +#define x_NS_ERR_ATHOST 4 +#define x_NS_ERR_ENROUTE 5 +#define x_NS_ERR_MAX (x_NS_ERR_ATHOST + x_NS_ERR_ENROUTE + 1) +#define x_ns_err_x(x_c) (((x_c)&0x200) ? ((x_c) - 0x200 + x_NS_ERR_ATHOST) : x_c ) + +/* + * Variables related to this implementation + * of the network systems error message protocol. + */ +struct x_ns_errstat { +/* statistics related to ns_err packets generated */ + x_int x_ns_es_error; /* # of calls to ns_error */ + x_int x_ns_es_oldshort; /* no error 'cuz old ip too short */ + x_int x_ns_es_oldns_err; /* no error 'cuz old was ns_err */ + x_int x_ns_es_outhist[x_NS_ERR_MAX]; +/* statistics related to input messages processed */ + x_int x_ns_es_badcode; /* ns_err_code out of range */ + x_int x_ns_es_tooshort; /* packet < IDP_MINLEN */ + x_int x_ns_es_checksum; /* bad checksum */ + x_int x_ns_es_badlen; /* calculated bound mismatch */ + x_int x_ns_es_reflect; /* number of responses */ + x_int x_ns_es_inhist[x_NS_ERR_MAX]; +}; + +#ifdef x_KERNEL +struct x_ns_errstat x_ns_errstat; +#endif + +#endif diff --git a/x_include/netns/x_ns_if.h b/x_include/netns/x_ns_if.h new file mode 100644 index 0000000..06b6841 --- /dev/null +++ b/x_include/netns/x_ns_if.h @@ -0,0 +1,64 @@ +#include "x_.h" + +#ifndef x__NETNS_NS_IF_H_ +#define x__NETNS_NS_IF_H_ + +#include +#include +#include + +/* + * Copyright (c) 1985, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ns_if.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Interface address, xerox version. One of these structures + * is allocated for each interface with an internet address. + * The ifaddr structure contains the protocol-independent part + * of the structure and is assumed to be first. + */ + +struct x_ns_ifaddr { + struct x_ifaddr x_ia_ifa; /* protocol-independent info */ +#define x_ia_addr x_ia_ifa.x_ifa_addr +#define x_ia_broadaddr x_ia_ifa.x_ifa_broadaddr +#define x_ia_dstaddr x_ia_ifa.x_ifa_dstaddr +#define x_ia_ifp x_ia_ifa.x_ifa_ifp + union x_ns_net x_ia_net; /* network number of interface */ + x_int x_ia_flags; + struct x_ns_ifaddr *x_ia_next; /* next in list of internet addresses */ +}; + +/* + * Given a pointer to an ns_ifaddr (ifaddr), + * return a pointer to the addr as a sockadd_ns. + */ + +#define x_IA_SNS(x_ia) ((struct x_sockaddr_ns *)(&((struct x_ns_ifaddr *)x_ia)->x_ia_addr)) +/* + * ia_flags + */ +#define x_IFA_ROUTE 0x01 /* routing entry installed */ + +/* This is not the right place for this but where is? */ +#define x_ETHERTYPE_NS 0x0600 + +#ifdef x_NSIP +struct x_nsip_req { + struct x_sockaddr x_rq_ns; /* must be ns format destination */ + struct x_sockaddr x_rq_ip; /* must be ip format gateway */ + x_short x_rq_flags; +}; +#endif + +#ifdef x_KERNEL +struct x_ns_ifaddr *x_ns_ifaddr; +/*struct ns_ifaddr *ns_iaonnetof();*/ +struct x_ifqueue x_nsintrq; /* XNS input packet queue */ +#endif + +#endif diff --git a/x_include/netns/x_ns_pcb.h b/x_include/netns/x_ns_pcb.h new file mode 100644 index 0000000..0bf0d22 --- /dev/null +++ b/x_include/netns/x_ns_pcb.h @@ -0,0 +1,63 @@ +#include "x_.h" + +#ifndef x__NETNS_NS_PCB_H_ +#define x__NETNS_NS_PCB_H_ + +#include +#include +#include + +/* + * Copyright (c) 1984, 1985, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ns_pcb.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Ns protocol interface control block. + */ +struct x_nspcb { + struct x_nspcb *x_nsp_next; /* doubly linked list */ + struct x_nspcb *x_nsp_prev; + struct x_nspcb *x_nsp_head; + struct x_socket *x_nsp_socket; /* back pointer to socket */ + struct x_ns_addr x_nsp_faddr; /* destination address */ + struct x_ns_addr x_nsp_laddr; /* socket's address */ + x_caddr_t x_nsp_pcb; /* protocol specific stuff */ + struct x_route x_nsp_route; /* routing information */ + struct x_ns_addr x_nsp_lastdst; /* validate cached route for dg socks*/ + x_long x_nsp_notify_param; /* extra info passed via ns_pcbnotify*/ + x_short x_nsp_flags; + x_u_char x_nsp_dpt; /* default packet type for idp_output*/ + x_u_char x_nsp_rpt; /* last received packet type by + idp_input() */ +}; + +/* possible flags */ + +#define x_NSP_IN_ABORT 0x1 /* calling abort through socket */ +#define x_NSP_RAWIN 0x2 /* show headers on input */ +#define x_NSP_RAWOUT 0x4 /* show header on output */ +#define x_NSP_ALL_PACKETS 0x8 /* Turn off higher proto processing */ + +#define x_NS_WILDCARD 1 + +#define x_nsp_lport x_nsp_laddr.x_x_port +#define x_nsp_fport x_nsp_faddr.x_x_port + +#define x_sotonspcb(x_so) ((struct x_nspcb *)((x_so)->x_so_pcb)) + +/* + * Nominal space allocated to a ns socket. + */ +#define x_NSSNDQ 2048 +#define x_NSRCVQ 2048 + +#ifdef x_KERNEL +struct x_nspcb x_nspcb; /* head of list */ +/*struct nspcb *ns_pcblookup();*/ +#endif + +#endif diff --git a/x_include/netns/x_sp.h b/x_include/netns/x_sp.h new file mode 100644 index 0000000..f8ad398 --- /dev/null +++ b/x_include/netns/x_sp.h @@ -0,0 +1,34 @@ +#include "x_.h" + +#ifndef x__NETNS_SP_H_ +#define x__NETNS_SP_H_ + +#include + +/* + * Copyright (c) 1984, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)sp.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Definitions for Xerox NS style sequenced packet protocol + */ + +struct x_sphdr { + x_u_char x_sp_cc; /* connection control */ + x_u_char x_sp_dt; /* datastream type */ +#define x_SP_SP 0x80 /* system packet */ +#define x_SP_SA 0x40 /* send acknowledgement */ +#define x_SP_OB 0x20 /* attention (out of band data) */ +#define x_SP_EM 0x10 /* end of message */ + x_u_short x_sp_sid; /* source connection identifier */ + x_u_short x_sp_did; /* destination connection identifier */ + x_u_short x_sp_seq; /* sequence number */ + x_u_short x_sp_ack; /* acknowledge number */ + x_u_short x_sp_alo; /* allocation number */ +}; + +#endif diff --git a/x_include/netns/x_spidp.h b/x_include/netns/x_spidp.h new file mode 100644 index 0000000..830c881 --- /dev/null +++ b/x_include/netns/x_spidp.h @@ -0,0 +1,45 @@ +#include "x_.h" + +#ifndef x__NETNS_SPIDP_H_ +#define x__NETNS_SPIDP_H_ + +#include +#include + +/* + * Copyright (c) 1984, 1985, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)spidp.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Definitions for NS(tm) Internet Datagram Protocol + * containing a Sequenced Packet Protocol packet. + */ +struct x_spidp { + struct x_idp x_si_i; + struct x_sphdr x_si_s; +}; +struct x_spidp_q { + struct x_spidp_q *x_si_next; + struct x_spidp_q *x_si_prev; +}; +#define x_SI(x_x) ((struct x_spidp *)x_x) +#define x_si_sum x_si_i.x_idp_sum +#define x_si_len x_si_i.x_idp_len +#define x_si_tc x_si_i.x_idp_tc +#define x_si_pt x_si_i.x_idp_pt +#define x_si_dna x_si_i.x_idp_dna +#define x_si_sna x_si_i.x_idp_sna +#define x_si_sport x_si_i.x_idp_sna.x_x_port +#define x_si_cc x_si_s.x_sp_cc +#define x_si_dt x_si_s.x_sp_dt +#define x_si_sid x_si_s.x_sp_sid +#define x_si_did x_si_s.x_sp_did +#define x_si_seq x_si_s.x_sp_seq +#define x_si_ack x_si_s.x_sp_ack +#define x_si_alo x_si_s.x_sp_alo + +#endif diff --git a/x_include/netns/x_spp_debug.h b/x_include/netns/x_spp_debug.h new file mode 100644 index 0000000..2e51227 --- /dev/null +++ b/x_include/netns/x_spp_debug.h @@ -0,0 +1,43 @@ +#include "x_.h" + +#ifndef x__NETNS_SPP_DEBUG_H_ +#define x__NETNS_SPP_DEBUG_H_ + +#include +#include +#include + +/* + * Copyright (c) 1984, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)spp_debug.h 7.1 (Berkeley) 6/5/86 + */ + +struct x_spp_debug { + x_u_long x_sd_time; + x_short x_sd_act; + x_short x_sd_ostate; + x_caddr_t x_sd_cb; + x_short x_sd_req; + struct x_spidp x_sd_si; + struct x_sppcb x_sd_sp; +}; + +#define x_SA_INPUT 0 +#define x_SA_OUTPUT 1 +#define x_SA_USER 2 +#define x_SA_RESPOND 3 +#define x_SA_DROP 4 + +#ifdef x_SANAMES +char *x_sanames[] = + { "input", "output", "user", "respond", "drop" }; +#endif + +#define x_SPP_NDEBUG 100 +struct x_spp_debug x_spp_debug[x_SPP_NDEBUG]; +x_int x_spp_debx; + +#endif diff --git a/x_include/netns/x_spp_var.h b/x_include/netns/x_spp_var.h new file mode 100644 index 0000000..7e76566 --- /dev/null +++ b/x_include/netns/x_spp_var.h @@ -0,0 +1,105 @@ +#include "x_.h" + +#ifndef x__NETNS_SPP_VAR_H_ +#define x__NETNS_SPP_VAR_H_ + +#include +#include +#include +#include +#include + +/* + * Copyright (c) 1984, 1985, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)spp_var.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Sp control block, one per connection + */ +struct x_sppcb { + struct x_spidp_q x_s_q; /* queue for out-of-order receipt */ + struct x_nspcb *x_s_nspcb; /* backpointer to internet pcb */ + x_u_char x_s_state; + x_u_char x_s_flags; +#define x_SF_AK 0x01 /* Acknowledgement requested */ +#define x_SF_DELACK 0x02 /* Ak, waiting to see if we xmit*/ +#define x_SF_HI 0x04 /* Show headers on input */ +#define x_SF_HO 0x08 /* Show headers on output */ +#define x_SF_PI 0x10 /* Packet (datagram) interface */ + x_u_short x_s_mtu; /* Max packet size for this stream */ +/* use sequence fields in headers to store sequence numbers for this + connection */ + struct x_spidp x_s_shdr; /* prototype header to transmit */ +#define x_s_cc x_s_shdr.x_si_cc /* connection control (for EM bit) */ +#define x_s_dt x_s_shdr.x_si_dt /* datastream type */ +#define x_s_sid x_s_shdr.x_si_sid /* source connection identifier */ +#define x_s_did x_s_shdr.x_si_did /* destination connection identifier */ +#define x_s_seq x_s_shdr.x_si_seq /* sequence number */ +#define x_s_ack x_s_shdr.x_si_ack /* acknowledge number */ +#define x_s_alo x_s_shdr.x_si_alo /* allocation number */ +#define x_s_dport x_s_shdr.x_si_dna.x_x_port /* where we are sending */ + struct x_sphdr x_s_rhdr; /* last received header (in effect!)*/ + x_u_short x_s_rack; /* their acknowledge number */ + x_u_short x_s_ralo; /* their allocation number */ + x_u_short x_s_snt; /* highest packet # we have sent */ + +/* timeout stuff */ + x_short x_s_idle; /* time idle */ + x_short x_s_timer[x_TCPT_NTIMERS]; /* timers */ + x_short x_s_rxtshift; /* log(2) of rexmt exp. backoff */ + x_u_short x_s_rtseq; /* packet being timed */ + x_short x_s_rtt; /* timer for round trips */ + x_short x_s_srtt; /* averaged timer */ + char x_s_force; /* which timer expired */ + +/* out of band data */ + char x_s_oobflags; +#define x_SF_SOOB 0x08 /* sending out of band data */ +#define x_SF_IOOB 0x10 /* receiving out of band data */ + char x_s_iobc; /* input characters */ +/* debug stuff */ + x_u_short x_s_want; /* Last candidate for sending */ +}; + +#define x_nstosppcb(x_np) ((struct x_sppcb *)(x_np)->x_nsp_pcb) +#define x_sotosppcb(x_so) (x_nstosppcb(x_sotonspcb(x_so))) + +struct x_spp_istat { + x_short x_hdrops; + x_short x_badsum; + x_short x_badlen; + x_short x_slotim; + x_short x_fastim; + x_short x_nonucn; + x_short x_noconn; + x_short x_notme; + x_short x_wrncon; + x_short x_bdreas; + x_short x_gonawy; + x_short x_notyet; + x_short x_lstdup; +}; + +#ifdef x_KERNEL +struct x_spp_istat x_spp_istat; +x_u_short x_spp_iss; +extern struct x_sppcb *x_spp_close(), *x_spp_disconnect(), + *x_spp_usrclosed(), *x_spp_timers(), *x_spp_drop(); +#endif + +#define x_SPP_ISSINCR 128 +/* + * SPP sequence numbers are 16 bit integers operated + * on with modular arithmetic. These macros can be + * used to compare such integers. + */ +#define x_SSEQ_LT(x_a,x_b) (((x_short)((x_a)-(x_b))) < 0) +#define x_SSEQ_LEQ(x_a,x_b) (((x_short)((x_a)-(x_b))) <= 0) +#define x_SSEQ_GT(x_a,x_b) (((x_short)((x_a)-(x_b))) > 0) +#define x_SSEQ_GEQ(x_a,x_b) (((x_short)((x_a)-(x_b))) >= 0) + +#endif diff --git a/x_include/protocols/x_dumprestore.h b/x_include/protocols/x_dumprestore.h new file mode 100644 index 0000000..8fe0557 --- /dev/null +++ b/x_include/protocols/x_dumprestore.h @@ -0,0 +1,67 @@ +#include "x_.h" + +#ifndef x__PROTOCOLS_DUMPRESTORE_H_ +#define x__PROTOCOLS_DUMPRESTORE_H_ + +#include +#include + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)dumprestore.h 5.1 (Berkeley) 6/5/85 + */ + +/* + * TP_BSIZE is the size of file blocks on the dump tapes. + * Note that TP_BSIZE must be a multiple of DEV_BSIZE. + * + * NTREC is the number of TP_BSIZE blocks that are written + * in each tape record. HIGHDENSITYTREC is the number of + * TP_BSIZE blocks that are written in each tape record on + * 6250 BPI or higher density tapes. + * + * TP_NINDIR is the number of indirect pointers in a TS_INODE + * or TS_ADDR record. Note that it must be a power of two. + */ +#define x_TP_BSIZE 1024 +#define x_NTREC 10 +#define x_HIGHDENSITYTREC 32 +#define x_TP_NINDIR (x_TP_BSIZE/2) + +#define x_TS_TAPE 1 +#define x_TS_INODE 2 +#define x_TS_BITS 3 +#define x_TS_ADDR 4 +#define x_TS_END 5 +#define x_TS_CLRI 6 +#define x_OFS_MAGIC (x_int)60011 +#define x_NFS_MAGIC (x_int)60012 +#define x_CHECKSUM (x_int)84446 + +union x_u_spcl { + char x_dummy[x_TP_BSIZE]; + struct x_s_spcl { + x_int x_c_type; + x_time_t x_c_date; + x_time_t x_c_ddate; + x_int x_c_volume; + x_daddr_t x_c_tapea; + x_ino_t x_c_inumber; + x_int x_c_magic; + x_int x_c_checksum; + struct x_dinode x_c_dinode; + x_int x_c_count; + char x_c_addr[x_TP_NINDIR]; + } x_s_spcl; +} x_u_spcl; + +#define x_spcl x_u_spcl.x_s_spcl + +#define x_DUMPOUTFMT "%-16s %c %s" /* for printf */ + /* name, incno, ctime(date) */ +#define x_DUMPINFMT "%16s %c %[^\n]\n" /* inverse for scanf */ + +#endif diff --git a/x_include/protocols/x_routed.h b/x_include/protocols/x_routed.h new file mode 100644 index 0000000..0e10a1b --- /dev/null +++ b/x_include/protocols/x_routed.h @@ -0,0 +1,74 @@ +#include "x_.h" + +#ifndef x__PROTOCOLS_ROUTED_H_ +#define x__PROTOCOLS_ROUTED_H_ + +#include +#include + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)protocol.h 5.1 (Berkeley) 6/4/85 + */ + +/* + * Routing Information Protocol + * + * Derived from Xerox NS Routing Information Protocol + * by changing 32-bit net numbers to sockaddr's and + * padding stuff to 32-bit boundaries. + */ +#define x_RIPVERSION 1 + +struct x_netinfo { + struct x_sockaddr x_rip_dst; /* destination net/host */ + x_int x_rip_metric; /* cost of route */ +}; + +struct x_rip { + x_u_char x_rip_cmd; /* request/response */ + x_u_char x_rip_vers; /* protocol version # */ + x_u_char x_rip_res1[2]; /* pad to 32-bit boundary */ + union { + struct x_netinfo x_ru_nets[1]; /* variable length... */ + char x_ru_tracefile[1]; /* ditto ... */ + } x_ripun; +#define x_rip_nets x_ripun.x_ru_nets +#define x_rip_tracefile x_ripun.x_ru_tracefile +}; + +/* + * Packet types. + */ +#define x_RIPCMD_REQUEST 1 /* want info */ +#define x_RIPCMD_RESPONSE 2 /* responding to request */ +#define x_RIPCMD_TRACEON 3 /* turn tracing on */ +#define x_RIPCMD_TRACEOFF 4 /* turn it off */ + +#define x_RIPCMD_MAX 5 +#ifdef x_RIPCMDS +char *x_ripcmds[x_RIPCMD_MAX] = + { "#0", "REQUEST", "RESPONSE", "TRACEON", "TRACEOFF" }; +#endif + +#define x_HOPCNT_INFINITY 16 /* per Xerox NS */ +#define x_MAXPACKETSIZE 512 /* max broadcast size */ + +/* + * Timer values used in managing the routing table. + * Every update forces an entry's timer to be reset. After + * EXPIRE_TIME without updates, the entry is marked invalid, + * but held onto until GARBAGE_TIME so that others may + * see it "be deleted". + */ +#define x_TIMER_RATE 30 /* alarm clocks every 30 seconds */ + +#define x_SUPPLY_INTERVAL 30 /* time to supply tables */ + +#define x_EXPIRE_TIME 180 /* time to mark entry invalid */ +#define x_GARBAGE_TIME 240 /* time to garbage collect */ + +#endif diff --git a/x_include/protocols/x_rwhod.h b/x_include/protocols/x_rwhod.h new file mode 100644 index 0000000..f69563a --- /dev/null +++ b/x_include/protocols/x_rwhod.h @@ -0,0 +1,41 @@ +#include "x_.h" + +#ifndef x__PROTOCOLS_RWHOD_H_ +#define x__PROTOCOLS_RWHOD_H_ + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)rwhod.h 5.1 (Berkeley) 5/28/85 + */ + +/* + * rwho protocol packet format. + */ +struct x_outmp { + char x_out_line[8]; /* tty name */ + char x_out_name[8]; /* user id */ + x_long x_out_time; /* time on */ +}; + +struct x_whod { + char x_wd_vers; /* protocol version # */ + char x_wd_type; /* packet type, see below */ + char x_wd_pad[2]; + x_int x_wd_sendtime; /* time stamp by sender */ + x_int x_wd_recvtime; /* time stamp applied by receiver */ + char x_wd_hostname[32]; /* hosts's name */ + x_int x_wd_loadav[3]; /* load average as in uptime */ + x_int x_wd_boottime; /* time system booted */ + struct x_whoent { + struct x_outmp x_we_utmp; /* active tty info */ + x_int x_we_idle; /* tty idle time */ + } x_wd_we[1024 / sizeof (struct x_whoent)]; +}; + +#define x_WHODVERSION 1 +#define x_WHODTYPE_STATUS 1 /* host status */ + +#endif diff --git a/x_include/protocols/x_talkd.h b/x_include/protocols/x_talkd.h new file mode 100644 index 0000000..65b1417 --- /dev/null +++ b/x_include/protocols/x_talkd.h @@ -0,0 +1,94 @@ +#include "x_.h" + +#ifndef x__PROTOCOLS_TALKD_H_ +#define x__PROTOCOLS_TALKD_H_ + +#include +#include + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)talkd.h 5.2 (Berkeley) 3/13/86 + */ + +/*#include */ +/*#include */ +/* + * This describes the protocol used by the talk server and clients. + * + * The talk server acts a repository of invitations, responding to + * requests by clients wishing to rendezvous for the purpose of + * holding a conversation. In normal operation, a client, the caller, + * initiates a rendezvous by sending a CTL_MSG to the server of + * type LOOK_UP. This causes the server to search its invitation + * tables to check if an invitation currently exists for the caller + * (to speak to the callee specified in the message). If the lookup + * fails, the caller then sends an ANNOUNCE message causing the server + * to broadcast an announcement on the callee's login ports requesting + * contact. When the callee responds, the local server uses the + * recorded invitation to respond with the appropriate rendezvous + * address and the caller and callee client programs establish a + * stream connection through which the conversation takes place. + */ + +/* + * Client->server request message format. + */ +typedef struct { + x_u_char x_vers; /* protocol version */ + x_u_char x_type; /* request type, see below */ + x_u_char x_answer; /* not used */ + x_u_char x_pad; + x_u_long x_id_num; /* message id */ + struct x_sockaddr x_addr; + struct x_sockaddr x_ctl_addr; + x_long x_pid; /* caller's process id */ +#define x_NAME_SIZE 12 + char x_l_name[x_NAME_SIZE];/* caller's name */ + char x_r_name[x_NAME_SIZE];/* callee's name */ +#define x_TTY_SIZE 16 + char x_r_tty[x_TTY_SIZE];/* callee's tty name */ +} x_CTL_MSG; + +/* + * Server->client response message format. + */ +typedef struct { + x_u_char x_vers; /* protocol version */ + x_u_char x_type; /* type of request message, see below */ + x_u_char x_answer; /* respose to request message, see below */ + x_u_char x_pad; + x_u_long x_id_num; /* message id */ + struct x_sockaddr x_addr; /* address for establishing conversation */ +} x_CTL_RESPONSE; + +#define x_TALK_VERSION 1 /* protocol version */ + +/* message type values */ +#define x_LEAVE_INVITE 0 /* leave invitation with server */ +#define x_LOOK_UP 1 /* check for invitation by callee */ +#define x_DELETE 2 /* delete invitation by caller */ +#define x_ANNOUNCE 3 /* announce invitation by caller */ + +/* answer values */ +#define x_SUCCESS 0 /* operation completed properly */ +#define x_NOT_HERE 1 /* callee not logged in */ +#define x_FAILED 2 /* operation failed for unexplained reason */ +#define x_MACHINE_UNKNOWN 3 /* caller's machine name unknown */ +#define x_PERMISSION_DENIED 4 /* callee's tty doesn't permit announce */ +#define x_UNKNOWN_REQUEST 5 /* request has invalid type value */ +#define x_BADVERSION 6 /* request has invalid protocol version */ +#define x_BADADDR 7 /* request has invalid addr value */ +#define x_BADCTLADDR 8 /* request has invalid ctl_addr value */ + +/* + * Operational parameters. + */ +#define x_MAX_LIFE 60 /* max time daemon saves invitations */ +/* RING_WAIT should be 10's of seconds less than MAX_LIFE */ +#define x_RING_WAIT 30 /* time to wait before resending invitation */ + +#endif diff --git a/x_include/protocols/x_timed.h b/x_include/protocols/x_timed.h new file mode 100644 index 0000000..b2c25db --- /dev/null +++ b/x_include/protocols/x_timed.h @@ -0,0 +1,78 @@ +#include "x_.h" + +#ifndef x__PROTOCOLS_TIMED_H_ +#define x__PROTOCOLS_TIMED_H_ + +#include +#include +#include + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +/* @(#)timed.h 1.6 (Berkeley) 5/28/86 */ + +/* + * Time Synchronization Protocol + */ + +#define x_TSPVERSION 1 +#define x_ANYADDR x_NULL + +struct x_tsp { + x_u_char x_tsp_type; + x_u_char x_tsp_vers; + x_u_short x_tsp_seq; + union { + struct x_timeval x_tspu_time; + char x_tspu_hopcnt; + } x_tsp_u; + char x_tsp_name[x_MAXHOSTNAMELEN]; +}; + +#define x_tsp_time x_tsp_u.x_tspu_time +#define x_tsp_hopcnt x_tsp_u.x_tspu_hopcnt + +/* + * Command types. + */ +#define x_TSP_ANY 0 /* match any types */ +#define x_TSP_ADJTIME 1 /* send adjtime */ +#define x_TSP_ACK 2 /* generic acknowledgement */ +#define x_TSP_MASTERREQ 3 /* ask for master's name */ +#define x_TSP_MASTERACK 4 /* acknowledge master request */ +#define x_TSP_SETTIME 5 /* send network time */ +#define x_TSP_MASTERUP 6 /* inform slaves that master is up */ +#define x_TSP_SLAVEUP 7 /* slave is up but not polled */ +#define x_TSP_ELECTION 8 /* advance candidature for master */ +#define x_TSP_ACCEPT 9 /* support candidature of master */ +#define x_TSP_REFUSE 10 /* reject candidature of master */ +#define x_TSP_CONFLICT 11 /* two or more masters present */ +#define x_TSP_RESOLVE 12 /* masters' conflict resolution */ +#define x_TSP_QUIT 13 /* reject candidature if master is up */ +#define x_TSP_DATE 14 /* reset the time (date command) */ +#define x_TSP_DATEREQ 15 /* remote request to reset the time */ +#define x_TSP_DATEACK 16 /* acknowledge time setting */ +#define x_TSP_TRACEON 17 /* turn tracing on */ +#define x_TSP_TRACEOFF 18 /* turn tracing off */ +#define x_TSP_MSITE 19 /* find out master's site */ +#define x_TSP_MSITEREQ 20 /* remote master's site request */ +#define x_TSP_TEST 21 /* for testing election algo */ +#define x_TSP_SETDATE 22 /* New from date command */ +#define x_TSP_SETDATEREQ 23 /* New remote for above */ +#define x_TSP_LOOP 24 /* loop detection packet */ + +#define x_TSPTYPENUMBER 25 + +#ifdef x_TSPTYPES +char *x_tsptype[x_TSPTYPENUMBER] = + { "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP", + "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT", + "DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ", + "TEST", "SETDATE", "SETDATEREQ", "LOOP" }; +#endif + +#endif diff --git a/x_include/stdarg.h b/x_include/stdarg.h new file mode 100644 index 0000000..e5b1559 --- /dev/null +++ b/x_include/stdarg.h @@ -0,0 +1,9 @@ +#ifndef _STDARG_H_ +#define _STDARG_H_ + +typedef __builtin_va_list va_list; +#define va_start(v, l) __builtin_va_start(v, l) +#define va_end(v) __builtin_va_end(v) +#define va_arg(v, l) __builtin_va_arg(v, l) + +#endif diff --git a/x_include/sys/x_acct.h b/x_include/sys/x_acct.h new file mode 100644 index 0000000..ef20e04 --- /dev/null +++ b/x_include/sys/x_acct.h @@ -0,0 +1,68 @@ +#include "x_.h" + +#ifndef x__SYS_ACCT_H_ +#define x__SYS_ACCT_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)acct.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Accounting structures; + * these use a comp_t type which is a 3 bits base 8 + * exponent, 13 bit fraction ``floating point'' number. + * Units are 1/AHZ seconds. + */ +typedef x_u_short x_comp_t; + +struct x_acct { + char x_ac_comm[10]; /* Accounting command name */ + x_comp_t x_ac_utime; /* Accounting user time */ + x_comp_t x_ac_stime; /* Accounting system time */ + x_comp_t x_ac_etime; /* Accounting elapsed time */ + x_time_t x_ac_btime; /* Beginning time */ + x_uid_t x_ac_uid; /* Accounting user ID */ + x_gid_t x_ac_gid; /* Accounting group ID */ + x_short x_ac_mem; /* average memory usage */ + x_comp_t x_ac_io; /* number of disk IO blocks */ + x_dev_t x_ac_tty; /* control typewriter */ + char x_ac_flag; /* Accounting flag */ +}; + +#define x_AFORK 0001 /* has executed fork, but no exec */ +#define x_ASU 0002 /* used super-user privileges */ +#define x_ACOMPAT 0004 /* used compatibility mode */ +#define x_ACORE 0010 /* dumped core */ +#define x_AXSIG 0020 /* killed by a signal */ + +/* + * 1/AHZ is the granularity of the data encoded in the various + * comp_t fields. This is not necessarily equal to hz. + */ +#define x_AHZ 64 + +#ifdef x_KERNEL +struct x_acct x_acctbuf; +struct x_inode *x_acctp; +#endif + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* sys/acct.c */ +x_int x_acct __P((char *x_f)); +#endif + +#endif diff --git a/x_include/sys/x_bkmac.h b/x_include/sys/x_bkmac.h new file mode 100644 index 0000000..07d917b --- /dev/null +++ b/x_include/sys/x_bkmac.h @@ -0,0 +1,38 @@ +#include "x_.h" + +#ifndef x__SYS_BKMAC_H_ +#define x__SYS_BKMAC_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)bkmac.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Macro definition of bk.c/netinput(). + * This is used to replace a call to + * (*linesw[tp->t_line].l_rint)(c,tp); + * with + * + * if (tp->t_line == NETLDISC) + * BKINPUT(c, tp); + * else + * (*linesw[tp->t_line].l_rint)(c,tp); + */ +#define x_BKINPUT(x_c, x_tp) { \ + if ((x_tp)->x_t_rec == 0) { \ + *(x_tp)->x_t_cp++ = x_c; \ + if (++(x_tp)->x_t_inbuf == 1024 || (x_c) == '\n') { \ + (x_tp)->x_t_rec = 1; \ + x_wakeup((x_caddr_t)&(x_tp)->x_t_rawq); \ + } \ + } \ +} + +#endif diff --git a/x_include/sys/x_buf.h b/x_include/sys/x_buf.h new file mode 100644 index 0000000..259bf73 --- /dev/null +++ b/x_include/sys/x_buf.h @@ -0,0 +1,198 @@ +#include "x_.h" + +#ifndef x__SYS_BUF_H_ +#define x__SYS_BUF_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)buf.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * The header for buffers in the buffer pool and otherwise used + * to describe a block i/o request is given here. The routines + * which manipulate these things are given in bio.c. + * + * Each buffer in the pool is usually doubly linked into 2 lists: + * hashed into a chain by so it can be located in the cache, + * and (usually) on (one of several) queues. These lists are circular and + * doubly linked for easy removal. + * + * There are currently three queues for buffers: + * one for buffers which must be kept permanently (super blocks) + * one for buffers containing ``useful'' information (the cache) + * one for buffers containing ``non-useful'' information + * (and empty buffers, pushed onto the front) + * The latter two queues contain the buffers which are available for + * reallocation, are kept in lru order. When not on one of these queues, + * the buffers are ``checked out'' to drivers which use the available list + * pointers to keep track of them in their i/o active queues. + */ + +/* + * Bufhd structures used at the head of the hashed buffer queues. + * We only need three words for these, so this abbreviated + * definition saves some space. + */ +struct x_bufhd { + x_long x_b_flags; /* see defines below */ + struct x_buf *x_b_forw, *x_b_back; /* fwd/bkwd pointer in chain */ +}; +struct x_buf { + x_long x_b_flags; /* too much goes here to describe */ + struct x_buf *x_b_forw, *x_b_back; /* hash chain (2 way street) */ + struct x_buf *x_av_forw, *x_av_back; /* position on free list if not BUSY */ +#define x_b_actf x_av_forw /* alternate names for driver queue */ +#define x_b_actl x_av_back /* head - isn't history wonderful */ + x_long x_b_bcount; /* transfer count */ + x_long x_b_bufsize; /* size of allocated buffer */ +#define x_b_active x_b_bcount /* driver queue head: drive active */ + x_short x_b_error; /* returned after I/O */ + x_dev_t x_b_dev; /* major+minor device name */ + union { + x_caddr_t x_b_addr; /* low order core address */ + x_int *x_b_words; /* words for clearing */ + struct x_fs *x_b_fs; /* superblocks */ + struct x_csum *x_b_cs; /* superblock summary information */ + struct x_cg *x_b_cg; /* cylinder group block */ + struct x_dinode *x_b_dino; /* ilist */ + x_daddr_t *x_b_daddr; /* indirect block */ + } x_b_un; + x_daddr_t x_b_blkno; /* block # on device */ + x_long x_b_resid; /* words not transferred after error */ +#define x_b_errcnt x_b_resid /* while i/o in progress: # retries */ + struct x_proc *x_b_proc; /* proc doing physical or swap I/O */ + x_int (*x_b_iodone)(); /* function called by iodone */ + x_int x_b_pfcent; /* center page when swapping cluster */ +}; + +#define x_BQUEUES 4 /* number of free buffer queues */ + +#define x_BQ_LOCKED 0 /* super-blocks &c */ +#define x_BQ_LRU 1 /* lru, useful buffers */ +#define x_BQ_AGE 2 /* rubbish */ +#define x_BQ_EMPTY 3 /* buffer headers with no memory */ + +#ifdef x_KERNEL +#define x_BUFHSZ 512 +#define x_RND (x_MAXBSIZE/x_DEV_BSIZE) +#if ((x_BUFHSZ&(x_BUFHSZ-1)) == 0) +#define x_BUFHASH(x_dev, x_dblkno) \ + ((struct x_buf *)&x_bufhash[((x_int)(x_dev)+(((x_int)(x_dblkno))/x_RND))&(x_BUFHSZ-1)]) +#else +#define x_BUFHASH(x_dev, x_dblkno) \ + ((struct x_buf *)&x_bufhash[((x_int)(x_dev)+(((x_int)(x_dblkno))/x_RND)) % x_BUFHSZ]) +#endif + +struct x_buf *x_buf; /* the buffer pool itself */ +char *x_buffers; +x_int x_nbuf; /* number of buffer headers */ +x_int x_bufpages; /* number of memory pages in the buffer pool */ +struct x_buf *x_swbuf; /* swap I/O headers */ +x_int x_nswbuf; +struct x_bufhd x_bufhash[x_BUFHSZ]; /* heads of hash lists */ +struct x_buf x_bfreelist[x_BQUEUES]; /* heads of available lists */ +struct x_buf x_bswlist; /* head of free swap header list */ +struct x_buf *x_bclnlist; /* head of cleaned page list */ + +/*struct buf *alloc();*/ +/*struct buf *realloccg();*/ +/*struct buf *baddr();*/ +/*struct buf *getblk();*/ +/*struct buf *geteblk();*/ +/*struct buf *getnewbuf();*/ +/*struct buf *bread();*/ +/*struct buf *breada();*/ + +/*unsigned minphys();*/ +#endif + +/* + * These flags are kept in b_flags. + */ +#define x_B_WRITE 0x000000 /* non-read pseudo-flag */ +#define x_B_READ 0x000001 /* read when I/O occurs */ +#define x_B_DONE 0x000002 /* transaction finished */ +#define x_B_ERROR 0x000004 /* transaction aborted */ +#define x_B_BUSY 0x000008 /* not on av_forw/back list */ +#define x_B_PHYS 0x000010 /* physical IO */ +#define x_B_XXX 0x000020 /* was B_MAP, alloc UNIBUS on pdp-11 */ +#define x_B_WANTED 0x000040 /* issue wakeup when BUSY goes off */ +#define x_B_AGE 0x000080 /* delayed write for correct aging */ +#define x_B_ASYNC 0x000100 /* don't wait for I/O completion */ +#define x_B_DELWRI 0x000200 /* write at exit of avail list */ +#define x_B_TAPE 0x000400 /* this is a magtape (no bdwrite) */ +#define x_B_UAREA 0x000800 /* add u-area to a swap operation */ +#define x_B_PAGET 0x001000 /* page in/out of page table space */ +#define x_B_DIRTY 0x002000 /* dirty page to be pushed out async */ +#define x_B_PGIN 0x004000 /* pagein op, so swap() can count it */ +#define x_B_CACHE 0x008000 /* did bread find us in the cache ? */ +#define x_B_INVAL 0x010000 /* does not contain valid info */ +#define x_B_LOCKED 0x020000 /* locked in core (not reusable) */ +#define x_B_HEAD 0x040000 /* a buffer header, not a buffer */ +#define x_B_BAD 0x100000 /* bad block revectoring in progress */ +#define x_B_CALL 0x200000 /* call b_iodone from iodone */ + +/* + * Insq/Remq for the buffer hash lists. + */ +#define x_bremhash(x_bp) { \ + (x_bp)->x_b_back->x_b_forw = (x_bp)->x_b_forw; \ + (x_bp)->x_b_forw->x_b_back = (x_bp)->x_b_back; \ +} +#define x_binshash(x_bp, x_dp) { \ + (x_bp)->x_b_forw = (x_dp)->x_b_forw; \ + (x_bp)->x_b_back = (x_dp); \ + (x_dp)->x_b_forw->x_b_back = (x_bp); \ + (x_dp)->x_b_forw = (x_bp); \ +} + +/* + * Insq/Remq for the buffer free lists. + */ +#define x_bremfree(x_bp) { \ + (x_bp)->x_av_back->x_av_forw = (x_bp)->x_av_forw; \ + (x_bp)->x_av_forw->x_av_back = (x_bp)->x_av_back; \ +} +#define x_binsheadfree(x_bp, x_dp) { \ + (x_dp)->x_av_forw->x_av_back = (x_bp); \ + (x_bp)->x_av_forw = (x_dp)->x_av_forw; \ + (x_dp)->x_av_forw = (x_bp); \ + (x_bp)->x_av_back = (x_dp); \ +} +#define x_binstailfree(x_bp, x_dp) { \ + (x_dp)->x_av_back->x_av_forw = (x_bp); \ + (x_bp)->x_av_back = (x_dp)->x_av_back; \ + (x_dp)->x_av_back = (x_bp); \ + (x_bp)->x_av_forw = (x_dp); \ +} + +/* + * Take a buffer off the free list it's on and + * mark it as being use (B_BUSY) by a device. + */ +#define x_notavail(x_bp) { \ + x_int x_x = x_splbio(); \ + x_bremfree(x_bp); \ + (x_bp)->x_b_flags |= x_B_BUSY; \ + x_splx(x_x); \ +} + +#define x_iodone x_biodone +#define x_iowait x_biowait + +/* + * Zero out a buffer's data portion. + */ +#define x_clrbuf(x_bp) { \ + x_blkclr((x_bp)->x_b_un.x_b_addr, (unsigned)(x_bp)->x_b_bcount); \ + (x_bp)->x_b_resid = 0; \ +} + +#endif diff --git a/x_include/sys/x_callout.h b/x_include/sys/x_callout.h new file mode 100644 index 0000000..8a50a8d --- /dev/null +++ b/x_include/sys/x_callout.h @@ -0,0 +1,37 @@ +#include "x_.h" + +#ifndef x__SYS_CALLOUT_H_ +#define x__SYS_CALLOUT_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)callout.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * The callout structure is for + * a routine arranging + * to be called by the clock interrupt + * (clock.c) with a specified argument, + * in a specified amount of time. + * Used, for example, to time tab + * delays on typewriters. + */ + +struct x_callout { + x_int x_c_time; /* incremental time */ + x_caddr_t x_c_arg; /* argument to routine */ + x_int (*x_c_func)(); /* routine */ + struct x_callout *x_c_next; +}; +#ifdef x_KERNEL +struct x_callout *x_callfree, *x_callout, x_calltodo; +x_int x_ncallout; +#endif + +#endif diff --git a/x_include/sys/x_clist.h b/x_include/sys/x_clist.h new file mode 100644 index 0000000..ca27b35 --- /dev/null +++ b/x_include/sys/x_clist.h @@ -0,0 +1,30 @@ +#include "x_.h" + +#ifndef x__SYS_CLIST_H_ +#define x__SYS_CLIST_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)clist.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Raw structures for the character list routines. + */ +struct x_cblock { + struct x_cblock *x_c_next; + char x_c_info[x_CBSIZE]; +}; +#ifdef x_KERNEL +struct x_cblock *x_cfree; +x_int x_nclist; +struct x_cblock *x_cfreelist; +x_int x_cfreecount; +#endif + +#endif diff --git a/x_include/sys/x_cmap.h b/x_include/sys/x_cmap.h new file mode 100644 index 0000000..59ba836 --- /dev/null +++ b/x_include/sys/x_cmap.h @@ -0,0 +1,95 @@ +#include "x_.h" + +#ifndef x__SYS_CMAP_H_ +#define x__SYS_CMAP_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)cmap.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * core map entry + * + * Limits imposed by this structure: + * + * limit cur. size fields + * Physical memory* 64 Mb c_next, c_prev, c_hlink + * Mounted filesystems 255 c_mdev + * size of a process segment 1 Gb c_page + * filesystem size 8 Gb c_blkno + * proc, text table size 64K c_ndx + * + * * memory can be expanded by converting first three entries + * to bit fields of larger than 16 bits, shrinking c_ndx accordingly, + * and increasing MAXMEM below. Also, the type of cmhash + * (below) must be changed to long. + */ +#ifndef x_LOCORE +struct x_cmap { +x_unsigned_short x_c_next, /* index of next free list entry */ + x_c_prev, /* index of previous free list entry */ + x_c_hlink; /* hash link for */ +x_unsigned_short x_c_ndx; /* index of owner proc or text */ +x_unsigned_int x_c_page:21, /* virtual page number in segment */ + x_c_lock:1, /* locked for raw i/o or pagein */ + x_c_want:1, /* wanted */ + x_c_intrans:1, /* intransit bit */ + x_c_free:1, /* on the free list */ + x_c_gone:1, /* associated page has been released */ + x_c_type:2, /* type CSYS or CTEXT or CSTACK or CDATA */ + :4, /* to longword boundary */ + x_c_blkno:24, /* disk block this is a copy of */ + x_c_mdev:8; /* which mounted dev this is from */ +}; +#else +/* + * bit offsets of elements in cmap + */ +#define x_C_INTRANS 87 +#define x_C_FREE 88 +#define x_SZ_CMAP 16 /* sizeof(struct cmap) */ + +#define x_MAXMEM 64*1024 /* maximum memory, in Kbytes */ +#endif + +#define x_CMHEAD 0 + +/* + * Shared text pages are not totally abandoned when a process + * exits, but are remembered while in the free list hashed by + * off the cmhash structure so that they can be reattached + * if another instance of the program runs again soon. + */ +#define x_CMHSIZ 2048 /* SHOULD BE DYNAMIC */ +#define x_CMHASH(x_bn) ((x_bn)&(x_CMHSIZ-1)) + +#ifndef x_LOCORE +#ifdef x_KERNEL +struct x_cmap *x_cmap; +struct x_cmap *x_ecmap; +x_int x_ncmap; +/*struct cmap *mfind();*/ +x_int x_firstfree, x_maxfree; +x_int x_ecmx; /* cmap index of ecmap */ +x_u_short x_cmhash[x_CMHSIZ]; +#endif + +/* bits defined in c_type */ + +#define x_CSYS 0 /* none of below */ +#define x_CTEXT 1 /* belongs to shared text segment */ +#define x_CDATA 2 /* belongs to data segment */ +#define x_CSTACK 3 /* belongs to stack segment */ + +#define x_pgtocm(x_x) (((x_int) ((x_x)-x_firstfree) / x_CLSIZE) + 1) +#define x_cmtopg(x_x) ((((x_x)-1) * x_CLSIZE) + x_firstfree) +#endif + +#endif diff --git a/x_include/sys/x_conf.h b/x_include/sys/x_conf.h new file mode 100644 index 0000000..a99548d --- /dev/null +++ b/x_include/sys/x_conf.h @@ -0,0 +1,87 @@ +#include "x_.h" + +#ifndef x__SYS_CONF_H_ +#define x__SYS_CONF_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)conf.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Declaration of block device + * switch. Each entry (row) is + * the only link between the + * main unix code and the driver. + * The initialization of the + * device switches is in the + * file conf.c. + */ +struct x_bdevsw { + x_int (*x_d_open)(); + x_int (*x_d_close)(); + x_int (*x_d_strategy)(); + x_int (*x_d_dump)(); + x_int (*x_d_psize)(); + x_int x_d_flags; +}; +#ifdef x_KERNEL +struct x_bdevsw x_bdevsw[]; +#endif + +/* + * Character device switch. + */ +struct x_cdevsw { + x_int (*x_d_open)(); + x_int (*x_d_close)(); + x_int (*x_d_read)(); + x_int (*x_d_write)(); + x_int (*x_d_ioctl)(); + x_int (*x_d_stop)(); + x_int (*x_d_reset)(); + struct x_tty *x_d_ttys; + x_int (*x_d_select)(); + x_int (*x_d_mmap)(); +}; +#ifdef x_KERNEL +struct x_cdevsw x_cdevsw[]; +#endif + +/* + * tty line control switch. + */ +struct x_linesw { + x_int (*x_l_open)(); + x_int (*x_l_close)(); + x_int (*x_l_read)(); + x_int (*x_l_write)(); + x_int (*x_l_ioctl)(); + x_int (*x_l_rint)(); + x_int (*x_l_rend)(); + x_int (*x_l_meta)(); + x_int (*x_l_start)(); + x_int (*x_l_modem)(); +}; +#ifdef x_KERNEL +struct x_linesw x_linesw[]; +#endif + +/* + * Swap device information + */ +struct x_swdevt { + x_dev_t x_sw_dev; + x_int x_sw_freed; + x_int x_sw_nblks; +}; +#ifdef x_KERNEL +struct x_swdevt x_swdevt[]; +#endif + +#endif diff --git a/x_include/sys/x_dir.h b/x_include/sys/x_dir.h new file mode 100644 index 0000000..e66a474 --- /dev/null +++ b/x_include/sys/x_dir.h @@ -0,0 +1,143 @@ +#include "x_.h" + +#ifndef x__SYS_DIR_H_ +#define x__SYS_DIR_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)dir.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * A directory consists of some number of blocks of DIRBLKSIZ + * bytes, where DIRBLKSIZ is chosen such that it can be transferred + * to disk in a single atomic operation (e.g. 512 bytes on most machines). + * + * Each DIRBLKSIZ byte block contains some number of directory entry + * structures, which are of variable length. Each directory entry has + * a struct direct at the front of it, containing its inode number, + * the length of the entry, and the length of the name contained in + * the entry. These are followed by the name padded to a 4 byte boundary + * with null bytes. All names are guaranteed null terminated. + * The maximum length of a name in a directory is MAXNAMLEN. + * + * The macro DIRSIZ(dp) gives the amount of space required to represent + * a directory entry. Free space in a directory is represented by + * entries which have dp->d_reclen > DIRSIZ(dp). All DIRBLKSIZ bytes + * in a directory block are claimed by the directory entries. This + * usually results in the last entry in a directory having a large + * dp->d_reclen. When entries are deleted from a directory, the + * space is returned to the previous entry in the same directory + * block by increasing its dp->d_reclen. If the first entry of + * a directory block is free, then its dp->d_ino is set to 0. + * Entries other than the first in a directory do not normally have + * dp->d_ino set to 0. + */ +/* so user programs can just include dir.h */ +/*#if !defined(KERNEL) && !defined(DEV_BSIZE)*/ +/*#define DEV_BSIZE 512*/ +/*#endif*/ +#define x_DIRBLKSIZ x_DEV_BSIZE +#define x_MAXNAMLEN 255 + +struct x_direct { + x_u_long x_d_ino; /* inode number of entry */ + x_u_short x_d_reclen; /* length of this record */ + x_u_short x_d_namlen; /* length of string in d_name */ + char x_d_name[x_MAXNAMLEN + 1]; /* name must be no longer than this */ +}; + +/* + * The DIRSIZ macro gives the minimum record length which will hold + * the directory entry. This requires the amount of space in struct direct + * without the d_name field, plus enough space for the name with a terminating + * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary. + */ +#undef x_DIRSIZ +#define x_DIRSIZ(x_dp) \ + ((sizeof (struct x_direct) - (x_MAXNAMLEN+1)) + (((x_dp)->x_d_namlen+1 + 3) &~ 3)) + +#ifndef x_KERNEL +/* + * Definitions for library routines operating on directories. + */ +typedef struct x__dirdesc { + x_int x_dd_fd; + x_long x_dd_loc; + x_long x_dd_size; + char x_dd_buf[x_DIRBLKSIZ]; +} x_DIR; +#ifndef x_NULL +#define x_NULL 0 +#endif +/*extern DIR *opendir();*/ +/*extern struct direct *readdir();*/ +/*extern long telldir();*/ +/*extern void seekdir();*/ +#define x_rewinddir(x_dirp) x_seekdir((x_dirp), (x_long)0) +/*extern void closedir();*/ +#endif + +#ifdef x_KERNEL +/* + * Template for manipulating directories. + * Should use struct direct's, but the name field + * is MAXNAMLEN - 1, and this just won't do. + */ +struct x_dirtemplate { + x_u_long x_dot_ino; + x_short x_dot_reclen; + x_short x_dot_namlen; + char x_dot_name[4]; /* must be multiple of 4 */ + x_u_long x_dotdot_ino; + x_short x_dotdot_reclen; + x_short x_dotdot_namlen; + char x_dotdot_name[4]; /* ditto */ +}; +#endif + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/closedir.c */ +void x_closedir __P((register x_DIR *x_dirp)); + +/* gen/getwd.c */ +char *x_getwd __P((char *x_pathname)); + +/* gen/opendir.c */ +x_DIR *x_opendir __P((char *x_name)); + +/* gen/readdir.c */ +struct x_direct *x_readdir __P((register x_DIR *x_dirp)); + +/* gen/scandir.c */ +x_int x_scandir __P((char *x_dirname, struct x_direct *(*x_namelist[]), x_int (*x_select)(void), x_int (*x_dcomp)(void))); +x_int x_alphasort __P((struct x_direct **x_d1, struct x_direct **x_d2)); + +/* gen/seekdir.c */ +void x_seekdir __P((register x_DIR *x_dirp, x_long x_loc)); + +/* gen/telldir.c */ +x_long x_telldir __P((x_DIR *x_dirp)); + +/* sys/mkdir.c */ +x_int x_mkdir __P((char *x_p, x_int x_m)); + +/* sys/rmdir.c */ +x_int x_rmdir __P((char *x_p)); +#endif + +#endif diff --git a/x_include/sys/x_dk.h b/x_include/sys/x_dk.h new file mode 100644 index 0000000..1beb106 --- /dev/null +++ b/x_include/sys/x_dk.h @@ -0,0 +1,40 @@ +#include "x_.h" + +#ifndef x__SYS_DK_H_ +#define x__SYS_DK_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)dk.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Instrumentation + */ +#define x_CPUSTATES 4 + +#define x_CP_USER 0 +#define x_CP_NICE 1 +#define x_CP_SYS 2 +#define x_CP_IDLE 3 + +#define x_DK_NDRIVE 4 + +#ifdef x_KERNEL +x_long x_cp_time[x_CPUSTATES]; +x_int x_dk_ndrive; +x_int x_dk_busy; +x_long x_dk_time[x_DK_NDRIVE]; +x_long x_dk_seek[x_DK_NDRIVE]; +x_long x_dk_xfer[x_DK_NDRIVE]; +x_long x_dk_wds[x_DK_NDRIVE]; +float x_dk_mspw[x_DK_NDRIVE]; + +x_long x_tk_nin; +x_long x_tk_nout; +#endif + +#endif diff --git a/x_include/sys/x_dkbad.h b/x_include/sys/x_dkbad.h new file mode 100644 index 0000000..74645ad --- /dev/null +++ b/x_include/sys/x_dkbad.h @@ -0,0 +1,56 @@ +#include "x_.h" + +#ifndef x__SYS_DKBAD_H_ +#define x__SYS_DKBAD_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)dkbad.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Definitions needed to perform bad sector + * revectoring ala DEC STD 144. + * + * The bad sector information is located in the + * first 5 even numbered sectors of the last + * track of the disk pack. There are five + * identical copies of the information, described + * by the dkbad structure. + * + * Replacement sectors are allocated starting with + * the first sector before the bad sector information + * and working backwards towards the beginning of + * the disk. A maximum of 126 bad sectors are supported. + * The position of the bad sector in the bad sector table + * determines which replacement sector it corresponds to. + * + * The bad sector information and replacement sectors + * are conventionally only accessible through the + * 'c' file system partition of the disk. If that + * partition is used for a file system, the user is + * responsible for making sure that it does not overlap + * the bad sector information or any replacement sector.s + */ + +struct x_dkbad { + x_long x_bt_csn; /* cartridge serial number */ + x_u_short x_bt_mbz; /* unused; should be 0 */ + x_u_short x_bt_flag; /* -1 => alignment cartridge */ + struct x_bt_bad { + x_u_short x_bt_cyl; /* cylinder number of bad sector */ + x_u_short x_bt_trksec; /* track and sector number */ + } x_bt_bad[126]; +}; + +#define x_ECC 0 +#define x_SSE 1 +#define x_BSE 2 +#define x_CONT 3 + +#endif diff --git a/x_include/sys/x_dmap.h b/x_include/sys/x_dmap.h new file mode 100644 index 0000000..9ed264d --- /dev/null +++ b/x_include/sys/x_dmap.h @@ -0,0 +1,42 @@ +#include "x_.h" + +#ifndef x__SYS_DMAP_H_ +#define x__SYS_DMAP_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)dmap.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Definitions for the mapping of vitual swap + * space to the physical swap area - the disk map. + */ + +#define x_NDMAP 38 /* size of the swap area map */ + +struct x_dmap { + x_swblk_t x_dm_size; /* current size used by process */ + x_swblk_t x_dm_alloc; /* amount of physical swap space allocated */ + x_swblk_t x_dm_map[x_NDMAP]; /* first disk block number in each chunk */ +}; +#ifdef x_KERNEL +struct x_dmap x_zdmap; +x_int x_dmmin, x_dmmax, x_dmtext; +#endif + +/* + * The following structure is that ``returned'' + * from a call to vstodb(). + */ +struct x_dblock { + x_swblk_t x_db_base; /* base of physical contig drum block */ + x_swblk_t x_db_size; /* size of block */ +}; + +#endif diff --git a/x_include/sys/x_domain.h b/x_include/sys/x_domain.h new file mode 100644 index 0000000..476b91d --- /dev/null +++ b/x_include/sys/x_domain.h @@ -0,0 +1,31 @@ +#include "x_.h" + +#ifndef x__SYS_DOMAIN_H_ +#define x__SYS_DOMAIN_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)domain.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Structure per communications domain. + */ +struct x_domain { + x_int x_dom_family; /* AF_xxx */ + char *x_dom_name; + x_int (*x_dom_init)(); /* initialize domain data structures */ + x_int (*x_dom_externalize)(); /* externalize access rights */ + x_int (*x_dom_dispose)(); /* dispose of internalized rights */ + struct x_protosw *x_dom_protosw, *x_dom_protoswNPROTOSW; + struct x_domain *x_dom_next; +}; + +#ifdef x_KERNEL +struct x_domain *x_domains; +#endif + +#endif diff --git a/x_include/sys/x_errno.h b/x_include/sys/x_errno.h new file mode 100644 index 0000000..cb3b2fe --- /dev/null +++ b/x_include/sys/x_errno.h @@ -0,0 +1,118 @@ +#include "x_.h" + +#ifndef x__SYS_ERRNO_H_ +#define x__SYS_ERRNO_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)errno.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Error codes + */ + +#define x_EPERM 1 /* Not owner */ +#define x_ENOENT 2 /* No such file or directory */ +#define x_ESRCH 3 /* No such process */ +#define x_EINTR 4 /* Interrupted system call */ +#define x_EIO 5 /* I/O error */ +#define x_ENXIO 6 /* No such device or address */ +#define x_E2BIG 7 /* Arg list too long */ +#define x_ENOEXEC 8 /* Exec format error */ +#define x_EBADF 9 /* Bad file number */ +#define x_ECHILD 10 /* No children */ +#define x_EAGAIN 11 /* No more processes */ +#define x_ENOMEM 12 /* Not enough core */ +#define x_EACCES 13 /* Permission denied */ +#define x_EFAULT 14 /* Bad address */ +#define x_ENOTBLK 15 /* Block device required */ +#define x_EBUSY 16 /* Mount device busy */ +#define x_EEXIST 17 /* File exists */ +#define x_EXDEV 18 /* Cross-device link */ +#define x_ENODEV 19 /* No such device */ +#define x_ENOTDIR 20 /* Not a directory*/ +#define x_EISDIR 21 /* Is a directory */ +#define x_EINVAL 22 /* Invalid argument */ +#define x_ENFILE 23 /* File table overflow */ +#define x_EMFILE 24 /* Too many open files */ +#define x_ENOTTY 25 /* Not a typewriter */ +#define x_ETXTBSY 26 /* Text file busy */ +#define x_EFBIG 27 /* File too large */ +#define x_ENOSPC 28 /* No space left on device */ +#define x_ESPIPE 29 /* Illegal seek */ +#define x_EROFS 30 /* Read-only file system */ +#define x_EMLINK 31 /* Too many links */ +#define x_EPIPE 32 /* Broken pipe */ + +/* math software */ +#define x_EDOM 33 /* Argument too large */ +#define x_ERANGE 34 /* Result too large */ + +/* non-blocking and interrupt i/o */ +#define x_EWOULDBLOCK 35 /* Operation would block */ +#define x_EDEADLK x_EWOULDBLOCK /* ditto */ +#define x_EINPROGRESS 36 /* Operation now in progress */ +#define x_EALREADY 37 /* Operation already in progress */ + +/* ipc/network software */ + + /* argument errors */ +#define x_ENOTSOCK 38 /* Socket operation on non-socket */ +#define x_EDESTADDRREQ 39 /* Destination address required */ +#define x_EMSGSIZE 40 /* Message too long */ +#define x_EPROTOTYPE 41 /* Protocol wrong type for socket */ +#define x_ENOPROTOOPT 42 /* Protocol not available */ +#define x_EPROTONOSUPPORT 43 /* Protocol not supported */ +#define x_ESOCKTNOSUPPORT 44 /* Socket type not supported */ +#define x_EOPNOTSUPP 45 /* Operation not supported on socket */ +#define x_EPFNOSUPPORT 46 /* Protocol family not supported */ +#define x_EAFNOSUPPORT 47 /* Address family not supported by protocol family */ +#define x_EADDRINUSE 48 /* Address already in use */ +#define x_EADDRNOTAVAIL 49 /* Can't assign requested address */ + + /* operational errors */ +#define x_ENETDOWN 50 /* Network is down */ +#define x_ENETUNREACH 51 /* Network is unreachable */ +#define x_ENETRESET 52 /* Network dropped connection on reset */ +#define x_ECONNABORTED 53 /* Software caused connection abort */ +#define x_ECONNRESET 54 /* Connection reset by peer */ +#define x_ENOBUFS 55 /* No buffer space available */ +#define x_EISCONN 56 /* Socket is already connected */ +#define x_ENOTCONN 57 /* Socket is not connected */ +#define x_ESHUTDOWN 58 /* Can't send after socket shutdown */ +#define x_ETOOMANYREFS 59 /* Too many references: can't splice */ +#define x_ETIMEDOUT 60 /* Connection timed out */ +#define x_ECONNREFUSED 61 /* Connection refused */ + + /* */ +#define x_ELOOP 62 /* Too many levels of symbolic links */ +#define x_ENAMETOOLONG 63 /* File name too long */ + +/* should be rearranged */ +#define x_EHOSTDOWN 64 /* Host is down */ +#define x_EHOSTUNREACH 65 /* No route to host */ +#define x_ENOTEMPTY 66 /* Directory not empty */ + +/* quotas & mush */ +#define x_EPROCLIM 67 /* Too many processes */ +#define x_EUSERS 68 /* Too many users */ +#define x_EDQUOT 69 /* Disc quota exceeded */ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/perror.c */ +x_int x_perror __P((char *x_s)); +#endif + +#endif diff --git a/x_include/sys/x_exec.h b/x_include/sys/x_exec.h new file mode 100644 index 0000000..b95b868 --- /dev/null +++ b/x_include/sys/x_exec.h @@ -0,0 +1,64 @@ +#include "x_.h" + +#ifndef x__SYS_EXEC_H_ +#define x__SYS_EXEC_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)exec.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Header prepended to each a.out file. + */ +struct x_exec { + x_long x_a_magic; /* magic number */ +x_unsigned_long x_a_text; /* size of text segment */ +x_unsigned_long x_a_data; /* size of initialized data */ +x_unsigned_long x_a_bss; /* size of uninitialized data */ +x_unsigned_long x_a_syms; /* size of symbol table */ +x_unsigned_long x_a_entry; /* entry point */ +x_unsigned_long x_a_trsize; /* size of text relocation */ +x_unsigned_long x_a_drsize; /* size of data relocation */ +}; + +#define x_OMAGIC 0407 /* old impure format */ +#define x_NMAGIC 0410 /* read-only text */ +#define x_ZMAGIC 0413 /* demand load format */ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/execvp.c */ +x_int x_execlp __P((char *x_name, char *x_argv)); +x_int x_execvp __P((char *x_name, char **x_argv)); + +/* gen/system.c */ +x_int x_system __P((char *x_s)); + +/* sys/execl.c */ +void x_execl __P((char *x_f, char *x_a)); + +/* sys/execle.c */ +void x_execle __P((char *x_f, char *x_a)); + +/* sys/exect.c */ +void x_exect __P((char *x_s, char *x_v[], char *x_e[])); + +/* sys/execv.c */ +void x_execv __P((char *x_s, char *x_v[])); + +/* sys/execve.c */ +void x_execve __P((char *x_s, char *x_v[], char *x_e[])); +#endif + +#endif diff --git a/x_include/sys/x_file.h b/x_include/sys/x_file.h new file mode 100644 index 0000000..230e56e --- /dev/null +++ b/x_include/sys/x_file.h @@ -0,0 +1,226 @@ +#include "x_.h" + +#ifndef x__SYS_FILE_H_ +#define x__SYS_FILE_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)file.h 7.1 (Berkeley) 6/4/86 + */ + +#ifdef x_KERNEL +/* + * Descriptor table entry. + * One for each kernel object. + */ +struct x_file { + x_int x_f_flag; /* see below */ + x_short x_f_type; /* descriptor type */ + x_short x_f_count; /* reference count */ + x_short x_f_msgcount; /* references from message queue */ + struct x_fileops { + x_int (*x_fo_rw)(); + x_int (*x_fo_ioctl)(); + x_int (*x_fo_select)(); + x_int (*x_fo_close)(); + } *x_f_ops; + x_caddr_t x_f_data; /* inode */ + x_off_t x_f_offset; +}; + +struct x_file *x_file, *x_fileNFILE; +x_int x_nfile; +/*struct file *getf();*/ +/*struct file *falloc();*/ +#endif + +/* + * flags- also for fcntl call. + */ +#define x_FOPEN (-1) +#define x_FREAD 00001 /* descriptor read/receive'able */ +#define x_FWRITE 00002 /* descriptor write/send'able */ +#ifndef x_F_DUPFD +#define x_FNDELAY 00004 /* no delay */ +#define x_FAPPEND 00010 /* append on each write */ +#endif +#define x_FMARK 00020 /* mark during gc() */ +#define x_FDEFER 00040 /* defer for next gc pass */ +#ifndef x_F_DUPFD +#define x_FASYNC 00100 /* signal pgrp when data ready */ +#endif +#define x_FSHLOCK 00200 /* shared lock present */ +#define x_FEXLOCK 00400 /* exclusive lock present */ + +/* bits to save after open */ +#define x_FMASK 00113 +#define x_FCNTLCANT (x_FREAD|x_FWRITE|x_FMARK|x_FDEFER|x_FSHLOCK|x_FEXLOCK) + +/* open only modes */ +#define x_FCREAT 01000 /* create if nonexistant */ +#define x_FTRUNC 02000 /* truncate to zero length */ +#define x_FEXCL 04000 /* error if already created */ + +#ifndef x_F_DUPFD +/* fcntl(2) requests--from */ +#define x_F_DUPFD 0 /* Duplicate fildes */ +#define x_F_GETFD 1 /* Get fildes flags */ +#define x_F_SETFD 2 /* Set fildes flags */ +#define x_F_GETFL 3 /* Get file flags */ +#define x_F_SETFL 4 /* Set file flags */ +#define x_F_GETOWN 5 /* Get owner */ +#define x_F_SETOWN 6 /* Set owner */ +#endif + +/* + * User definitions. + */ + +/* + * Open call. + */ +#define x_O_RDONLY 000 /* open for reading */ +#define x_O_WRONLY 001 /* open for writing */ +#define x_O_RDWR 002 /* open for read & write */ +#define x_O_NDELAY x_FNDELAY /* non-blocking open */ +#define x_O_APPEND x_FAPPEND /* append on each write */ +#define x_O_CREAT x_FCREAT /* open with file create */ +#define x_O_TRUNC x_FTRUNC /* open with truncation */ +#define x_O_EXCL x_FEXCL /* error on create if file exists */ + +/* + * Flock call. + */ +#define x_LOCK_SH 1 /* shared lock */ +#define x_LOCK_EX 2 /* exclusive lock */ +#define x_LOCK_NB 4 /* don't block when locking */ +#define x_LOCK_UN 8 /* unlock */ + +/* + * Access call. + */ +#define x_F_OK 0 /* does file exist */ +#define x_X_OK 1 /* is it executable by caller */ +#define x_W_OK 2 /* writable by caller */ +#define x_R_OK 4 /* readable by caller */ + +/* + * Lseek call. + */ +#define x_L_SET 0 /* absolute offset */ +#define x_L_INCR 1 /* relative to current offset */ +#define x_L_XTND 2 /* relative to end of file */ + +#ifdef x_KERNEL +#define x_GETF(x_fp, x_fd) { \ + if ((unsigned)(x_fd) >= x_NOFILE || ((x_fp) = x_u.x_u_ofile[x_fd]) == x_NULL) { \ + x_u.x_u_error = x_EBADF; \ + return; \ + } \ +} +#define x_DTYPE_INODE 1 /* file */ +#define x_DTYPE_SOCKET 2 /* communications endpoint */ +#endif + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* sys/access.c */ +x_int x_access __P((char *x_p, x_int x_m)); + +/* sys/chmod.c */ +x_int x_chmod __P((char *x_s, x_int x_m)); + +/* sys/chown.c */ +x_int x_chown __P((char *x_s, x_int x_u, x_int x_g)); + +/* sys/close.c */ +x_int x_close __P((x_int x_f)); + +/* sys/creat.c */ +x_int x_creat __P((char *x_s, x_int x_m)); + +/* sys/dup2.c */ +x_int x_dup2 __P((x_int x_o, x_int x_n)); + +/* sys/dup.c */ +x_int x_dup __P((x_int x_f)); + +/* sys/fchmod.c */ +x_int x_fchmod __P((x_int x_f, x_int x_m)); + +/* sys/fchown.c */ +x_int x_fchown __P((x_int x_f, x_int x_u, x_int x_g)); + +/* sys/fcntl.c */ +x_int x_fcntl __P((x_int x_f, x_int x_c, x_int x_a)); + +/* sys/flock.c */ +x_int x_flock __P((x_int x_f, x_int x_o)); + +/* sys/fsync.c */ +x_int x_fsync __P((x_int x_f)); + +/* sys/ftruncate.c */ +x_int x_ftruncate __P((x_int x_d, x_off_t x_l)); + +/* sys/getdtablesize.c */ +x_int x_getdtablesize __P((void)); + +/* sys/link.c */ +x_int x_link __P((char *x_a, char *x_b)); + +/* sys/lseek.c */ +x_off_t x_lseek __P((x_int x_f, x_off_t x_o, x_int x_d)); + +/* sys/mknod.c */ +x_int x_mknod __P((char *x_n, x_int x_m, x_int x_a)); + +/* sys/open.c */ +x_int x_open __P((char *x_f, x_int x_m, x_int x_stuff)); + +/* sys/pipe.c */ +x_int x_pipe __P((x_int x_f[2])); + +/* sys/read.c */ +x_int x_read __P((x_int x_f, char *x_b, x_int x_l)); + +/* sys/readlink.c */ +x_int x_readlink __P((char *x_p, char *x_b, x_int x_s)); + +/* sys/rename.c */ +x_int x_rename __P((char *x_f, char *x_t)); + +/* sys/symlink.c */ +x_int x_symlink __P((char *x_t, char *x_f)); + +/* sys/sync.c */ +void x_sync __P((void)); + +/* sys/truncate.c */ +x_int x_truncate __P((char *x_p, x_off_t x_l)); + +/* sys/umask.c */ +x_int x_umask __P((x_int x_n)); + +/* sys/unlink.c */ +x_int x_unlink __P((char *x_s)); + +/* sys/write.c */ +x_int x_write __P((x_int x_f, char *x_b, x_int x_l)); +#endif + +#endif diff --git a/x_include/sys/x_fs.h b/x_include/sys/x_fs.h new file mode 100644 index 0000000..73f5981 --- /dev/null +++ b/x_include/sys/x_fs.h @@ -0,0 +1,388 @@ +#include "x_.h" + +#ifndef x__SYS_FS_H_ +#define x__SYS_FS_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)fs.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Each disk drive contains some number of file systems. + * A file system consists of a number of cylinder groups. + * Each cylinder group has inodes and data. + * + * A file system is described by its super-block, which in turn + * describes the cylinder groups. The super-block is critical + * data and is replicated in each cylinder group to protect against + * catastrophic loss. This is done at mkfs time and the critical + * super-block data does not change, so the copies need not be + * referenced further unless disaster strikes. + * + * For file system fs, the offsets of the various blocks of interest + * are given in the super block as: + * [fs->fs_sblkno] Super-block + * [fs->fs_cblkno] Cylinder group block + * [fs->fs_iblkno] Inode blocks + * [fs->fs_dblkno] Data blocks + * The beginning of cylinder group cg in fs, is given by + * the ``cgbase(fs, cg)'' macro. + * + * The first boot and super blocks are given in absolute disk addresses. + */ +#define x_BBSIZE 8192 +#define x_SBSIZE 8192 +#define x_BBLOCK ((x_daddr_t)(0)) +#define x_SBLOCK ((x_daddr_t)(x_BBLOCK + x_BBSIZE / x_DEV_BSIZE)) + +/* + * Addresses stored in inodes are capable of addressing fragments + * of `blocks'. File system blocks of at most size MAXBSIZE can + * be optionally broken into 2, 4, or 8 pieces, each of which is + * addressible; these pieces may be DEV_BSIZE, or some multiple of + * a DEV_BSIZE unit. + * + * Large files consist of exclusively large data blocks. To avoid + * undue wasted disk space, the last data block of a small file may be + * allocated as only as many fragments of a large block as are + * necessary. The file system format retains only a single pointer + * to such a fragment, which is a piece of a single large block that + * has been divided. The size of such a fragment is determinable from + * information in the inode, using the ``blksize(fs, ip, lbn)'' macro. + * + * The file system records space availability at the fragment level; + * to determine block availability, aligned fragments are examined. + * + * The root inode is the root of the file system. + * Inode 0 can't be used for normal purposes and + * historically bad blocks were linked to inode 1, + * thus the root inode is 2. (inode 1 is no longer used for + * this purpose, however numerous dump tapes make this + * assumption, so we are stuck with it) + * The lost+found directory is given the next available + * inode when it is created by ``mkfs''. + */ +#define x_ROOTINO ((x_ino_t)2) /* i number of all roots */ +#define x_LOSTFOUNDINO (x_ROOTINO + 1) + +/* + * Cylinder group related limits. + * + * For each cylinder we keep track of the availability of blocks at different + * rotational positions, so that we can lay out the data to be picked + * up with minimum rotational latency. NRPOS is the number of rotational + * positions which we distinguish. With NRPOS 8 the resolution of our + * summary information is 2ms for a typical 3600 rpm drive. + */ +#define x_NRPOS 8 /* number distinct rotational positions */ + +/* + * MAXIPG bounds the number of inodes per cylinder group, and + * is needed only to keep the structure simpler by having the + * only a single variable size element (the free bit map). + * + * N.B.: MAXIPG must be a multiple of INOPB(fs). + */ +#define x_MAXIPG 2048 /* max number inodes/cyl group */ + +/* + * MINBSIZE is the smallest allowable block size. + * In order to insure that it is possible to create files of size + * 2^32 with only two levels of indirection, MINBSIZE is set to 4096. + * MINBSIZE must be big enough to hold a cylinder group block, + * thus changes to (struct cg) must keep its size within MINBSIZE. + * MAXCPG is limited only to dimension an array in (struct cg); + * it can be made larger as long as that structures size remains + * within the bounds dictated by MINBSIZE. + * Note that super blocks are always of size SBSIZE, + * and that both SBSIZE and MAXBSIZE must be >= MINBSIZE. + */ +#define x_MINBSIZE 4096 +#define x_MAXCPG 32 /* maximum fs_cpg */ + +/* + * The path name on which the file system is mounted is maintained + * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in + * the super block for this name. + * The limit on the amount of summary information per file system + * is defined by MAXCSBUFS. It is currently parameterized for a + * maximum of two million cylinders. + */ +#define x_MAXMNTLEN 512 +#define x_MAXCSBUFS 32 + +/* + * Per cylinder group information; summarized in blocks allocated + * from first cylinder group data blocks. These blocks have to be + * read in from fs_csaddr (size fs_cssize) in addition to the + * super block. + * + * N.B. sizeof(struct csum) must be a power of two in order for + * the ``fs_cs'' macro to work (see below). + */ +struct x_csum { + x_long x_cs_ndir; /* number of directories */ + x_long x_cs_nbfree; /* number of free blocks */ + x_long x_cs_nifree; /* number of free inodes */ + x_long x_cs_nffree; /* number of free frags */ +}; + +/* + * Super block for a file system. + */ +#define x_FS_MAGIC 0x011954 +struct x_fs { + struct x_fs *x_fs_link; /* linked list of file systems */ + struct x_fs *x_fs_rlink; /* used for incore super blocks */ + x_daddr_t x_fs_sblkno; /* addr of super-block in filesys */ + x_daddr_t x_fs_cblkno; /* offset of cyl-block in filesys */ + x_daddr_t x_fs_iblkno; /* offset of inode-blocks in filesys */ + x_daddr_t x_fs_dblkno; /* offset of first data after cg */ + x_long x_fs_cgoffset; /* cylinder group offset in cylinder */ + x_long x_fs_cgmask; /* used to calc mod fs_ntrak */ + x_time_t x_fs_time; /* last time written */ + x_long x_fs_size; /* number of blocks in fs */ + x_long x_fs_dsize; /* number of data blocks in fs */ + x_long x_fs_ncg; /* number of cylinder groups */ + x_long x_fs_bsize; /* size of basic blocks in fs */ + x_long x_fs_fsize; /* size of frag blocks in fs */ + x_long x_fs_frag; /* number of frags in a block in fs */ +/* these are configuration parameters */ + x_long x_fs_minfree; /* minimum percentage of free blocks */ + x_long x_fs_rotdelay; /* num of ms for optimal next block */ + x_long x_fs_rps; /* disk revolutions per second */ +/* these fields can be computed from the others */ + x_long x_fs_bmask; /* ``blkoff'' calc of blk offsets */ + x_long x_fs_fmask; /* ``fragoff'' calc of frag offsets */ + x_long x_fs_bshift; /* ``lblkno'' calc of logical blkno */ + x_long x_fs_fshift; /* ``numfrags'' calc number of frags */ +/* these are configuration parameters */ + x_long x_fs_maxcontig; /* max number of contiguous blks */ + x_long x_fs_maxbpg; /* max number of blks per cyl group */ +/* these fields can be computed from the others */ + x_long x_fs_fragshift; /* block to frag shift */ + x_long x_fs_fsbtodb; /* fsbtodb and dbtofsb shift constant */ + x_long x_fs_sbsize; /* actual size of super block */ + x_long x_fs_csmask; /* csum block offset */ + x_long x_fs_csshift; /* csum block number */ + x_long x_fs_nindir; /* value of NINDIR */ + x_long x_fs_inopb; /* value of INOPB */ + x_long x_fs_nspf; /* value of NSPF */ + x_long x_fs_optim; /* optimization preference, see below */ + x_long x_fs_sparecon[5]; /* reserved for future constants */ +/* sizes determined by number of cylinder groups and their sizes */ + x_daddr_t x_fs_csaddr; /* blk addr of cyl grp summary area */ + x_long x_fs_cssize; /* size of cyl grp summary area */ + x_long x_fs_cgsize; /* cylinder group size */ +/* these fields should be derived from the hardware */ + x_long x_fs_ntrak; /* tracks per cylinder */ + x_long x_fs_nsect; /* sectors per track */ + x_long x_fs_spc; /* sectors per cylinder */ +/* this comes from the disk driver partitioning */ + x_long x_fs_ncyl; /* cylinders in file system */ +/* these fields can be computed from the others */ + x_long x_fs_cpg; /* cylinders per group */ + x_long x_fs_ipg; /* inodes per group */ + x_long x_fs_fpg; /* blocks per group * fs_frag */ +/* this data must be re-computed after crashes */ + struct x_csum x_fs_cstotal; /* cylinder summary information */ +/* these fields are cleared at mount time */ + char x_fs_fmod; /* super block modified flag */ + char x_fs_clean; /* file system is clean flag */ + char x_fs_ronly; /* mounted read-only flag */ + char x_fs_flags; /* currently unused flag */ + char x_fs_fsmnt[x_MAXMNTLEN]; /* name mounted on */ +/* these fields retain the current block allocation info */ + x_long x_fs_cgrotor; /* last cg searched */ + struct x_csum *x_fs_csp[x_MAXCSBUFS];/* list of fs_cs info buffers */ + x_long x_fs_cpc; /* cyl per cycle in postbl */ + x_short x_fs_postbl[x_MAXCPG][x_NRPOS];/* head of blocks for each rotation */ + x_long x_fs_magic; /* magic number */ + x_u_char x_fs_rotbl[1]; /* list of blocks for each rotation */ +/* actually longer */ +}; +/* + * Preference for optimization. + */ +#define x_FS_OPTTIME 0 /* minimize allocation time */ +#define x_FS_OPTSPACE 1 /* minimize disk fragmentation */ + +/* + * Convert cylinder group to base address of its global summary info. + * + * N.B. This macro assumes that sizeof(struct csum) is a power of two. + */ +#define x_fs_cs(x_fs, x_indx) \ + x_fs_csp[(x_indx) >> (x_fs)->x_fs_csshift][(x_indx) & ~(x_fs)->x_fs_csmask] + +/* + * MAXBPC bounds the size of the rotational layout tables and + * is limited by the fact that the super block is of size SBSIZE. + * The size of these tables is INVERSELY proportional to the block + * size of the file system. It is aggravated by sector sizes that + * are not powers of two, as this increases the number of cylinders + * included before the rotational pattern repeats (fs_cpc). + * Its size is derived from the number of bytes remaining in (struct fs) + */ +#define x_MAXBPC (x_SBSIZE - sizeof (struct x_fs)) + +/* + * Cylinder group block for a file system. + */ +#define x_CG_MAGIC 0x090255 +struct x_cg { + struct x_cg *x_cg_link; /* linked list of cyl groups */ + struct x_cg *x_cg_rlink; /* used for incore cyl groups */ + x_time_t x_cg_time; /* time last written */ + x_long x_cg_cgx; /* we are the cgx'th cylinder group */ + x_short x_cg_ncyl; /* number of cyl's this cg */ + x_short x_cg_niblk; /* number of inode blocks this cg */ + x_long x_cg_ndblk; /* number of data blocks this cg */ + struct x_csum x_cg_cs; /* cylinder summary information */ + x_long x_cg_rotor; /* position of last used block */ + x_long x_cg_frotor; /* position of last used frag */ + x_long x_cg_irotor; /* position of last used inode */ + x_long x_cg_frsum[x_MAXFRAG]; /* counts of available frags */ + x_long x_cg_btot[x_MAXCPG]; /* block totals per cylinder */ + x_short x_cg_b[x_MAXCPG][x_NRPOS]; /* positions of free blocks */ + char x_cg_iused[x_MAXIPG/x_NBBY]; /* used inode map */ + x_long x_cg_magic; /* magic number */ + x_u_char x_cg_free[1]; /* free block map */ +/* actually longer */ +}; + +/* + * MAXBPG bounds the number of blocks of data per cylinder group, + * and is limited by the fact that cylinder groups are at most one block. + * Its size is derived from the size of blocks and the (struct cg) size, + * by the number of remaining bits. + */ +#define x_MAXBPG(x_fs) \ + (x_fragstoblks((x_fs), (x_NBBY * ((x_fs)->x_fs_bsize - (sizeof (struct x_cg)))))) + +/* + * Turn file system block numbers into disk block addresses. + * This maps file system blocks to device size blocks. + */ +#define x_fsbtodb(x_fs, x_b) ((x_b) << (x_fs)->x_fs_fsbtodb) +#define x_dbtofsb(x_fs, x_b) ((x_b) >> (x_fs)->x_fs_fsbtodb) + +/* + * Cylinder group macros to locate things in cylinder groups. + * They calc file system addresses of cylinder group data structures. + */ +#define x_cgbase(x_fs, x_c) ((x_daddr_t)((x_fs)->x_fs_fpg * (x_c))) +#define x_cgstart(x_fs, x_c) \ + (x_cgbase(x_fs, x_c) + (x_fs)->x_fs_cgoffset * ((x_c) & ~((x_fs)->x_fs_cgmask))) +#define x_cgsblock(x_fs, x_c) (x_cgstart(x_fs, x_c) + (x_fs)->x_fs_sblkno) /* super blk */ +#define x_cgtod(x_fs, x_c) (x_cgstart(x_fs, x_c) + (x_fs)->x_fs_cblkno) /* cg block */ +#define x_cgimin(x_fs, x_c) (x_cgstart(x_fs, x_c) + (x_fs)->x_fs_iblkno) /* inode blk */ +#define x_cgdmin(x_fs, x_c) (x_cgstart(x_fs, x_c) + (x_fs)->x_fs_dblkno) /* 1st data */ + +/* + * Macros for handling inode numbers: + * inode number to file system block offset. + * inode number to cylinder group number. + * inode number to file system block address. + */ +#define x_itoo(x_fs, x_x) ((x_x) % x_INOPB(x_fs)) +#define x_itog(x_fs, x_x) ((x_x) / (x_fs)->x_fs_ipg) +#define x_itod(x_fs, x_x) \ + ((x_daddr_t)(x_cgimin(x_fs, x_itog(x_fs, x_x)) + \ + (x_blkstofrags((x_fs), (((x_x) % (x_fs)->x_fs_ipg) / x_INOPB(x_fs)))))) + +/* + * Give cylinder group number for a file system block. + * Give cylinder group block number for a file system block. + */ +#define x_dtog(x_fs, x_d) ((x_d) / (x_fs)->x_fs_fpg) +#define x_dtogd(x_fs, x_d) ((x_d) % (x_fs)->x_fs_fpg) + +/* + * Extract the bits for a block from a map. + * Compute the cylinder and rotational position of a cyl block addr. + */ +#define x_blkmap(x_fs, x_map, x_loc) \ + (((x_map)[(x_loc) / x_NBBY] >> ((x_loc) % x_NBBY)) & (0xff >> (x_NBBY - (x_fs)->x_fs_frag))) +#define x_cbtocylno(x_fs, x_bno) \ + ((x_bno) * x_NSPF(x_fs) / (x_fs)->x_fs_spc) +#define x_cbtorpos(x_fs, x_bno) \ + ((x_bno) * x_NSPF(x_fs) % (x_fs)->x_fs_spc % (x_fs)->x_fs_nsect * x_NRPOS / (x_fs)->x_fs_nsect) + +/* + * The following macros optimize certain frequently calculated + * quantities by using shifts and masks in place of divisions + * modulos and multiplications. + */ +#define x_blkoff(x_fs, x_loc) /* calculates (loc % fs->fs_bsize) */ \ + ((x_loc) & ~(x_fs)->x_fs_bmask) +#define x_fragoff(x_fs, x_loc) /* calculates (loc % fs->fs_fsize) */ \ + ((x_loc) & ~(x_fs)->x_fs_fmask) +#define x_lblkno(x_fs, x_loc) /* calculates (loc / fs->fs_bsize) */ \ + ((x_loc) >> (x_fs)->x_fs_bshift) +#define x_numfrags(x_fs, x_loc) /* calculates (loc / fs->fs_fsize) */ \ + ((x_loc) >> (x_fs)->x_fs_fshift) +#define x_blkroundup(x_fs, x_size) /* calculates roundup(size, fs->fs_bsize) */ \ + (((x_size) + (x_fs)->x_fs_bsize - 1) & (x_fs)->x_fs_bmask) +#define x_fragroundup(x_fs, x_size) /* calculates roundup(size, fs->fs_fsize) */ \ + (((x_size) + (x_fs)->x_fs_fsize - 1) & (x_fs)->x_fs_fmask) +#define x_fragstoblks(x_fs, x_frags) /* calculates (frags / fs->fs_frag) */ \ + ((x_frags) >> (x_fs)->x_fs_fragshift) +#define x_blkstofrags(x_fs, x_blks) /* calculates (blks * fs->fs_frag) */ \ + ((x_blks) << (x_fs)->x_fs_fragshift) +#define x_fragnum(x_fs, x_fsb) /* calculates (fsb % fs->fs_frag) */ \ + ((x_fsb) & ((x_fs)->x_fs_frag - 1)) +#define x_blknum(x_fs, x_fsb) /* calculates rounddown(fsb, fs->fs_frag) */ \ + ((x_fsb) &~ ((x_fs)->x_fs_frag - 1)) + +/* + * Determine the number of available frags given a + * percentage to hold in reserve + */ +#define x_freespace(x_fs, x_percentreserved) \ + (x_blkstofrags((x_fs), (x_fs)->x_fs_cstotal.x_cs_nbfree) + \ + (x_fs)->x_fs_cstotal.x_cs_nffree - ((x_fs)->x_fs_dsize * (x_percentreserved) / 100)) + +/* + * Determining the size of a file block in the file system. + */ +#define x_blksize(x_fs, x_ip, x_lbn) \ + (((x_lbn) >= x_NDADDR || (x_ip)->x_i_size >= ((x_lbn) + 1) << (x_fs)->x_fs_bshift) \ + ? (x_fs)->x_fs_bsize \ + : (x_fragroundup(x_fs, x_blkoff(x_fs, (x_ip)->x_i_size)))) +#define x_dblksize(x_fs, x_dip, x_lbn) \ + (((x_lbn) >= x_NDADDR || (x_dip)->x_di_size >= ((x_lbn) + 1) << (x_fs)->x_fs_bshift) \ + ? (x_fs)->x_fs_bsize \ + : (x_fragroundup(x_fs, x_blkoff(x_fs, (x_dip)->x_di_size)))) + +/* + * Number of disk sectors per block; assumes DEV_BSIZE byte sector size. + */ +#define x_NSPB(x_fs) ((x_fs)->x_fs_nspf << (x_fs)->x_fs_fragshift) +#define x_NSPF(x_fs) ((x_fs)->x_fs_nspf) + +/* + * INOPB is the number of inodes in a secondary storage block. + */ +#define x_INOPB(x_fs) ((x_fs)->x_fs_inopb) +#define x_INOPF(x_fs) ((x_fs)->x_fs_inopb >> (x_fs)->x_fs_fragshift) + +/* + * NINDIR is the number of indirects in a file system block. + */ +#define x_NINDIR(x_fs) ((x_fs)->x_fs_nindir) + +#ifdef x_KERNEL +/*struct fs *getfs();*/ +/*struct fs *mountfs();*/ +#endif + +#endif diff --git a/x_include/sys/x_gprof.h b/x_include/sys/x_gprof.h new file mode 100644 index 0000000..03da156 --- /dev/null +++ b/x_include/sys/x_gprof.h @@ -0,0 +1,94 @@ +#include "x_.h" + +#ifndef x__SYS_GPROF_H_ +#define x__SYS_GPROF_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)gprof.h 7.1 (Berkeley) 6/4/86 + */ + +struct x_phdr { + char *x_lpc; + char *x_hpc; + x_int x_ncnt; +}; + + /* + * histogram counters are unsigned shorts (according to the kernel). + */ +#define x_HISTCOUNTER x_unsigned_short + + /* + * fraction of text space to allocate for histogram counters + * here, 1/2 + */ +#define x_HISTFRACTION 2 + + /* + * Fraction of text space to allocate for from hash buckets. + * The value of HASHFRACTION is based on the minimum number of bytes + * of separation between two subroutine call points in the object code. + * Given MIN_SUBR_SEPARATION bytes of separation the value of + * HASHFRACTION is calculated as: + * + * HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1); + * + * For the VAX, the shortest two call sequence is: + * + * calls $0,(r0) + * calls $0,(r0) + * + * which is separated by only three bytes, thus HASHFRACTION is + * calculated as: + * + * HASHFRACTION = 3 / (2 * 2 - 1) = 1 + * + * Note that the division above rounds down, thus if MIN_SUBR_FRACTION + * is less than three, this algorithm will not work! + * + * NB: for the kernel we assert that the shortest two call sequence is: + * + * calls $0,_name + * calls $0,_name + * + * which is separated by seven bytes, thus HASHFRACTION is calculated as: + * + * HASHFRACTION = 7 / (2 * 2 - 1) = 2 + */ +#define x_HASHFRACTION 2 + + /* + * percent of text space to allocate for tostructs + * with a minimum. + */ +#define x_ARCDENSITY 2 +#define x_MINARCS 50 + +struct x_tostruct { + char *x_selfpc; + x_long x_count; + x_unsigned_short x_link; +}; + + /* + * a raw arc, + * with pointers to the calling site and the called site + * and a count. + */ +struct x_rawarc { + x_unsigned_long x_raw_frompc; + x_unsigned_long x_raw_selfpc; + x_long x_raw_count; +}; + + /* + * general rounding functions. + */ +#define x_ROUNDDOWN(x_x,x_y) (((x_x)/(x_y))*(x_y)) +#define x_ROUNDUP(x_x,x_y) ((((x_x)+(x_y)-1)/(x_y))*(x_y)) + +#endif diff --git a/x_include/sys/x_inode.h b/x_include/sys/x_inode.h new file mode 100644 index 0000000..b925368 --- /dev/null +++ b/x_include/sys/x_inode.h @@ -0,0 +1,208 @@ +#include "x_.h" + +#ifndef x__SYS_INODE_H_ +#define x__SYS_INODE_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)inode.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * The I node is the focus of all file activity in UNIX. + * There is a unique inode allocated for each active file, + * each current directory, each mounted-on file, text file, and the root. + * An inode is 'named' by its dev/inumber pair. (iget/iget.c) + * Data in icommon is read in from permanent inode on volume. + */ + +#define x_NDADDR 12 /* direct addresses in inode */ +#define x_NIADDR 3 /* indirect addresses in inode */ + +struct x_inode { + struct x_inode *x_i_chain[2]; /* must be first */ + x_u_short x_i_flag; + x_u_short x_i_count; /* reference count */ + x_dev_t x_i_dev; /* device where inode resides */ + x_u_short x_i_shlockc; /* count of shared locks on inode */ + x_u_short x_i_exlockc; /* count of exclusive locks on inode */ + x_ino_t x_i_number; /* i number, 1-to-1 with device address */ + x_long x_i_id; /* unique identifier */ + struct x_fs *x_i_fs; /* file sys associated with this inode */ + struct x_dquot *x_i_dquot; /* quota structure controlling this file */ + struct x_text *x_i_text; /* text entry, if any (should be region) */ + union { + x_daddr_t x_if_lastr; /* last read (read-ahead) */ + struct x_socket *x_is_socket; + struct { + struct x_inode *x_if_freef; /* free list forward */ + struct x_inode **x_if_freeb; /* free list back */ + } x_i_fr; + } x_i_un; + struct x_icommon { + x_u_short x_ic_mode; /* 0: mode and type of file */ + x_short x_ic_nlink; /* 2: number of links to file */ + x_uid_t x_ic_uid; /* 4: owner's user id */ + x_gid_t x_ic_gid; /* 6: owner's group id */ + x_quad x_ic_size; /* 8: number of bytes in file */ + x_time_t x_ic_atime; /* 16: time last accessed */ + x_long x_ic_atspare; + x_time_t x_ic_mtime; /* 24: time last modified */ + x_long x_ic_mtspare; + x_time_t x_ic_ctime; /* 32: last time inode changed */ + x_long x_ic_ctspare; + x_daddr_t x_ic_db[x_NDADDR]; /* 40: disk block addresses */ + x_daddr_t x_ic_ib[x_NIADDR]; /* 88: indirect blocks */ + x_long x_ic_flags; /* 100: status, currently unused */ + x_long x_ic_blocks; /* 104: blocks actually held */ + x_long x_ic_spare[5]; /* 108: reserved, currently unused */ + } x_i_ic; +}; + +struct x_dinode { + union { + struct x_icommon x_di_icom; + char x_di_size[128]; + } x_di_un; +}; + +#define x_i_mode x_i_ic.x_ic_mode +#define x_i_nlink x_i_ic.x_ic_nlink +#define x_i_uid x_i_ic.x_ic_uid +#define x_i_gid x_i_ic.x_ic_gid +/* ugh! -- must be fixed */ +#ifdef x_vax +#define x_i_size x_i_ic.x_ic_size.x_val[0] +#endif +#define x_i_db x_i_ic.x_ic_db +#define x_i_ib x_i_ic.x_ic_ib +#define x_i_atime x_i_ic.x_ic_atime +#define x_i_mtime x_i_ic.x_ic_mtime +#define x_i_ctime x_i_ic.x_ic_ctime +#define x_i_blocks x_i_ic.x_ic_blocks +#define x_i_rdev x_i_ic.x_ic_db[0] +#define x_i_lastr x_i_un.x_if_lastr +#define x_i_socket x_i_un.x_is_socket +#define x_i_forw x_i_chain[0] +#define x_i_back x_i_chain[1] +#define x_i_freef x_i_un.x_i_fr.x_if_freef +#define x_i_freeb x_i_un.x_i_fr.x_if_freeb + +#define x_di_ic x_di_un.x_di_icom +#define x_di_mode x_di_ic.x_ic_mode +#define x_di_nlink x_di_ic.x_ic_nlink +#define x_di_uid x_di_ic.x_ic_uid +#define x_di_gid x_di_ic.x_ic_gid +#ifdef x_vax +#define x_di_size x_di_ic.x_ic_size.x_val[0] +#endif +#define x_di_db x_di_ic.x_ic_db +#define x_di_ib x_di_ic.x_ic_ib +#define x_di_atime x_di_ic.x_ic_atime +#define x_di_mtime x_di_ic.x_ic_mtime +#define x_di_ctime x_di_ic.x_ic_ctime +#define x_di_rdev x_di_ic.x_ic_db[0] +#define x_di_blocks x_di_ic.x_ic_blocks + +#ifdef x_KERNEL +/* + * Invalidate an inode. Used by the namei cache to detect stale + * information. At an absurd rate of 100 calls/second, the inode + * table invalidation should only occur once every 16 months. + */ +#define x_cacheinval(x_ip) \ + (x_ip)->x_i_id = ++x_nextinodeid; \ + if (x_nextinodeid == 0) \ + x_cacheinvalall(); + +struct x_inode *x_inode; /* the inode table itself */ +struct x_inode *x_inodeNINODE; /* the end of the inode table */ +x_int x_ninode; /* number of slots in the table */ +x_long x_nextinodeid; /* unique id generator */ + +struct x_inode *x_rootdir; /* pointer to inode of root directory */ + +/*struct inode *ialloc();*/ +/*struct inode *iget();*/ +#ifdef x_notdef +/*struct inode *ifind();*/ +#endif +/*struct inode *owner();*/ +/*struct inode *maknode();*/ +/*struct inode *namei();*/ + +/*ino_t dirpref();*/ +#endif + +/* flags */ +#define x_ILOCKED 0x1 /* inode is locked */ +#define x_IUPD 0x2 /* file has been modified */ +#define x_IACC 0x4 /* inode access time to be updated */ +#define x_IMOUNT 0x8 /* inode is mounted on */ +#define x_IWANT 0x10 /* some process waiting on lock */ +#define x_ITEXT 0x20 /* inode is pure text prototype */ +#define x_ICHG 0x40 /* inode has been changed */ +#define x_ISHLOCK 0x80 /* file has shared lock */ +#define x_IEXLOCK 0x100 /* file has exclusive lock */ +#define x_ILWAIT 0x200 /* someone waiting on file lock */ +#define x_IMOD 0x400 /* inode has been modified */ +#define x_IRENAME 0x800 /* inode is being renamed */ + +/* modes */ +#define x_IFMT 0170000 /* type of file */ +#define x_IFCHR 0020000 /* character special */ +#define x_IFDIR 0040000 /* directory */ +#define x_IFBLK 0060000 /* block special */ +#define x_IFREG 0100000 /* regular */ +#define x_IFLNK 0120000 /* symbolic link */ +#define x_IFSOCK 0140000 /* socket */ + +#define x_ISUID 04000 /* set user id on execution */ +#define x_ISGID 02000 /* set group id on execution */ +#define x_ISVTX 01000 /* save swapped text even after use */ +#define x_IREAD 0400 /* read, write, execute permissions */ +#define x_IWRITE 0200 +#define x_IEXEC 0100 + +#define x_ILOCK(x_ip) { \ + while ((x_ip)->x_i_flag & x_ILOCKED) { \ + (x_ip)->x_i_flag |= x_IWANT; \ + x_sleep((x_caddr_t)(x_ip), x_PINOD); \ + } \ + (x_ip)->x_i_flag |= x_ILOCKED; \ +} + +#define x_IUNLOCK(x_ip) { \ + (x_ip)->x_i_flag &= ~x_ILOCKED; \ + if ((x_ip)->x_i_flag&x_IWANT) { \ + (x_ip)->x_i_flag &= ~x_IWANT; \ + x_wakeup((x_caddr_t)(x_ip)); \ + } \ +} + +#define x_IUPDAT(x_ip, x_t1, x_t2, x_waitfor) { \ + if (x_ip->x_i_flag&(x_IUPD|x_IACC|x_ICHG|x_IMOD)) \ + x_iupdat(x_ip, x_t1, x_t2, x_waitfor); \ +} + +#define x_ITIMES(x_ip, x_t1, x_t2) { \ + if ((x_ip)->x_i_flag&(x_IUPD|x_IACC|x_ICHG)) { \ + (x_ip)->x_i_flag |= x_IMOD; \ + if ((x_ip)->x_i_flag&x_IACC) \ + (x_ip)->x_i_atime = (x_t1)->x_tv_sec; \ + if ((x_ip)->x_i_flag&x_IUPD) \ + (x_ip)->x_i_mtime = (x_t2)->x_tv_sec; \ + if ((x_ip)->x_i_flag&x_ICHG) \ + (x_ip)->x_i_ctime = x_time.x_tv_sec; \ + (x_ip)->x_i_flag &= ~(x_IACC|x_IUPD|x_ICHG); \ + } \ +} + +#endif diff --git a/x_include/sys/x_ioctl.h b/x_include/sys/x_ioctl.h new file mode 100644 index 0000000..0716c28 --- /dev/null +++ b/x_include/sys/x_ioctl.h @@ -0,0 +1,306 @@ +#include "x_.h" + +#ifndef x__SYS_IOCTL_H_ +#define x__SYS_IOCTL_H_ + +#include +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ioctl.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Ioctl definitions + */ +/*#ifndef _IOCTL_*/ +/*#define _IOCTL_*/ +#ifdef x_KERNEL +#include "x_ttychars.h" +#include "x_ttydev.h" +#else +#include +#include +#endif + +struct x_tchars { + char x_t_intrc; /* interrupt */ + char x_t_quitc; /* quit */ + char x_t_startc; /* start output */ + char x_t_stopc; /* stop output */ + char x_t_eofc; /* end-of-file */ + char x_t_brkc; /* input delimiter (like nl) */ +}; +struct x_ltchars { + char x_t_suspc; /* stop process signal */ + char x_t_dsuspc; /* delayed stop process signal */ + char x_t_rprntc; /* reprint line */ + char x_t_flushc; /* flush output (toggles) */ + char x_t_werasc; /* word erase */ + char x_t_lnextc; /* literal next character */ +}; + +/* + * Structure for TIOCGETP and TIOCSETP ioctls. + */ + +#ifndef x__SGTTYB_ +#define x__SGTTYB_ +struct x_sgttyb { + char x_sg_ispeed; /* input speed */ + char x_sg_ospeed; /* output speed */ + char x_sg_erase; /* erase character */ + char x_sg_kill; /* kill character */ + x_short x_sg_flags; /* mode flags */ +}; +#endif + +/* + * Window/terminal size structure. + * This information is stored by the kernel + * in order to provide a consistent interface, + * but is not used by the kernel. + * + * Type must be "unsigned short" so that types.h not required. + */ +struct x_winsize { + x_unsigned_short x_ws_row; /* rows, in characters */ + x_unsigned_short x_ws_col; /* columns, in characters */ + x_unsigned_short x_ws_xpixel; /* horizontal size, pixels */ + x_unsigned_short x_ws_ypixel; /* vertical size, pixels */ +}; + +/* + * Pun for SUN. + */ +struct x_ttysize { + x_unsigned_short x_ts_lines; + x_unsigned_short x_ts_cols; + x_unsigned_short x_ts_xxx; + x_unsigned_short x_ts_yyy; +}; +#define x_TIOCGSIZE x_TIOCGWINSZ +#define x_TIOCSSIZE x_TIOCSWINSZ + +#ifndef x__IO +/* + * Ioctl's have the command encoded in the lower word, + * and the size of any in or out parameters in the upper + * word. The high 2 bits of the upper word are used + * to encode the in/out status of the parameter; for now + * we restrict parameters to at most 128 bytes. + */ +#define x_IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */ +#define x_IOC_VOID 0x20000000 /* no parameters */ +#define x_IOC_OUT 0x40000000 /* copy out parameters */ +#define x_IOC_IN 0x80000000 /* copy in parameters */ +#define x_IOC_INOUT (x_IOC_IN|x_IOC_OUT) +/* the 0x20000000 is so we can distinguish new ioctl's from old */ +#define x__IO(x_x,x_y) (x_IOC_VOID|('x'<<8)|x_y) +#define x__IOR(x_x,x_y,x_t) (x_IOC_OUT|((sizeof(x_t)&x_IOCPARM_MASK)<<16)|('x'<<8)|x_y) +#define x__IOW(x_x,x_y,x_t) (x_IOC_IN|((sizeof(x_t)&x_IOCPARM_MASK)<<16)|('x'<<8)|x_y) +/* this should be _IORW, but stdio got there first */ +#define x__IOWR(x_x,x_y,x_t) (x_IOC_INOUT|((sizeof(x_t)&x_IOCPARM_MASK)<<16)|('x'<<8)|x_y) +#endif + +/* + * tty ioctl commands + */ +#define x_TIOCGETD x__IOR(x_t, 0, x_int) /* get line discipline */ +#define x_TIOCSETD x__IOW(x_t, 1, x_int) /* set line discipline */ +#define x_TIOCHPCL x__IO(x_t, 2) /* hang up on last close */ +#define x_TIOCMODG x__IOR(x_t, 3, x_int) /* get modem control state */ +#define x_TIOCMODS x__IOW(x_t, 4, x_int) /* set modem control state */ +#define x_TIOCM_LE 0001 /* line enable */ +#define x_TIOCM_DTR 0002 /* data terminal ready */ +#define x_TIOCM_RTS 0004 /* request to send */ +#define x_TIOCM_ST 0010 /* secondary transmit */ +#define x_TIOCM_SR 0020 /* secondary receive */ +#define x_TIOCM_CTS 0040 /* clear to send */ +#define x_TIOCM_CAR 0100 /* carrier detect */ +#define x_TIOCM_CD x_TIOCM_CAR +#define x_TIOCM_RNG 0200 /* ring */ +#define x_TIOCM_RI x_TIOCM_RNG +#define x_TIOCM_DSR 0400 /* data set ready */ +#define x_TIOCGETP x__IOR(x_t, 8,struct x_sgttyb)/* get parameters -- gtty */ +#define x_TIOCSETP x__IOW(x_t, 9,struct x_sgttyb)/* set parameters -- stty */ +#define x_TIOCSETN x__IOW(x_t,10,struct x_sgttyb)/* as above, but no flushtty */ +#define x_TIOCEXCL x__IO(x_t, 13) /* set exclusive use of tty */ +#define x_TIOCNXCL x__IO(x_t, 14) /* reset exclusive use of tty */ +#define x_TIOCFLUSH x__IOW(x_t, 16, x_int) /* flush buffers */ +#define x_TIOCSETC x__IOW(x_t,17,struct x_tchars)/* set special characters */ +#define x_TIOCGETC x__IOR(x_t,18,struct x_tchars)/* get special characters */ +#define x_TANDEM 0x00000001 /* send stopc on out q full */ +#define x_CBREAK 0x00000002 /* half-cooked mode */ +#define x_LCASE 0x00000004 /* simulate lower case */ +#define x_ECHO 0x00000008 /* echo input */ +#define x_CRMOD 0x00000010 /* map \r to \r\n on output */ +#define x_RAW 0x00000020 /* no i/o processing */ +#define x_ODDP 0x00000040 /* get/send odd parity */ +#define x_EVENP 0x00000080 /* get/send even parity */ +#define x_ANYP 0x000000c0 /* get any parity/send none */ +#define x_NLDELAY 0x00000300 /* \n delay */ +#define x_NL0 0x00000000 +#define x_NL1 0x00000100 /* tty 37 */ +#define x_NL2 0x00000200 /* vt05 */ +#define x_NL3 0x00000300 +#define x_TBDELAY 0x00000c00 /* horizontal tab delay */ +#define x_TAB0 0x00000000 +#define x_TAB1 0x00000400 /* tty 37 */ +#define x_TAB2 0x00000800 +#define x_XTABS 0x00000c00 /* expand tabs on output */ +#define x_CRDELAY 0x00003000 /* \r delay */ +#define x_CR0 0x00000000 +#define x_CR1 0x00001000 /* tn 300 */ +#define x_CR2 0x00002000 /* tty 37 */ +#define x_CR3 0x00003000 /* concept 100 */ +#define x_VTDELAY 0x00004000 /* vertical tab delay */ +#define x_FF0 0x00000000 +#define x_FF1 0x00004000 /* tty 37 */ +#define x_BSDELAY 0x00008000 /* \b delay */ +#define x_BS0 0x00000000 +#define x_BS1 0x00008000 +#define x_ALLDELAY (x_NLDELAY|x_TBDELAY|x_CRDELAY|x_VTDELAY|x_BSDELAY) +#define x_CRTBS 0x00010000 /* do backspacing for crt */ +#define x_PRTERA 0x00020000 /* \ ... / erase */ +#define x_CRTERA 0x00040000 /* " \b " to wipe out char */ +#define x_TILDE 0x00080000 /* hazeltine tilde kludge */ +#define x_MDMBUF 0x00100000 /* start/stop output on carrier intr */ +#define x_LITOUT 0x00200000 /* literal output */ +#define x_TOSTOP 0x00400000 /* SIGSTOP on background output */ +#define x_FLUSHO 0x00800000 /* flush output to terminal */ +#define x_NOHANG 0x01000000 /* no SIGHUP on carrier drop */ +#define x_L001000 0x02000000 +#define x_CRTKIL 0x04000000 /* kill line with " \b " */ +#define x_PASS8 0x08000000 +#define x_CTLECH 0x10000000 /* echo control chars as ^X */ +#define x_PENDIN 0x20000000 /* tp->t_rawq needs reread */ +#define x_DECCTQ 0x40000000 /* only ^Q starts after ^S */ +#define x_NOFLSH 0x80000000 /* no output flush on signal */ +/* locals, from 127 down */ +#define x_TIOCLBIS x__IOW(x_t, 127, x_int) /* bis local mode bits */ +#define x_TIOCLBIC x__IOW(x_t, 126, x_int) /* bic local mode bits */ +#define x_TIOCLSET x__IOW(x_t, 125, x_int) /* set entire local mode word */ +#define x_TIOCLGET x__IOR(x_t, 124, x_int) /* get local modes */ +#define x_LCRTBS (x_CRTBS>>16) +#define x_LPRTERA (x_PRTERA>>16) +#define x_LCRTERA (x_CRTERA>>16) +#define x_LTILDE (x_TILDE>>16) +#define x_LMDMBUF (x_MDMBUF>>16) +#define x_LLITOUT (x_LITOUT>>16) +#define x_LTOSTOP (x_TOSTOP>>16) +#define x_LFLUSHO (x_FLUSHO>>16) +#define x_LNOHANG (x_NOHANG>>16) +#define x_LCRTKIL (x_CRTKIL>>16) +#define x_LPASS8 (x_PASS8>>16) +#define x_LCTLECH (x_CTLECH>>16) +#define x_LPENDIN (x_PENDIN>>16) +#define x_LDECCTQ (x_DECCTQ>>16) +#define x_LNOFLSH (x_NOFLSH>>16) +#define x_TIOCSBRK x__IO(x_t, 123) /* set break bit */ +#define x_TIOCCBRK x__IO(x_t, 122) /* clear break bit */ +#define x_TIOCSDTR x__IO(x_t, 121) /* set data terminal ready */ +#define x_TIOCCDTR x__IO(x_t, 120) /* clear data terminal ready */ +#define x_TIOCGPGRP x__IOR(x_t, 119, x_int) /* get pgrp of tty */ +#define x_TIOCSPGRP x__IOW(x_t, 118, x_int) /* set pgrp of tty */ +#define x_TIOCSLTC x__IOW(x_t,117,struct x_ltchars)/* set local special chars */ +#define x_TIOCGLTC x__IOR(x_t,116,struct x_ltchars)/* get local special chars */ +#define x_TIOCOUTQ x__IOR(x_t, 115, x_int) /* output queue size */ +#define x_TIOCSTI x__IOW(x_t, 114, char) /* simulate terminal input */ +#define x_TIOCNOTTY x__IO(x_t, 113) /* void tty association */ +#define x_TIOCPKT x__IOW(x_t, 112, x_int) /* pty: set/clear packet mode */ +#define x_TIOCPKT_DATA 0x00 /* data packet */ +#define x_TIOCPKT_FLUSHREAD 0x01 /* flush packet */ +#define x_TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ +#define x_TIOCPKT_STOP 0x04 /* stop output */ +#define x_TIOCPKT_START 0x08 /* start output */ +#define x_TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ +#define x_TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ +#define x_TIOCSTOP x__IO(x_t, 111) /* stop output, like ^S */ +#define x_TIOCSTART x__IO(x_t, 110) /* start output, like ^Q */ +#define x_TIOCMSET x__IOW(x_t, 109, x_int) /* set all modem bits */ +#define x_TIOCMBIS x__IOW(x_t, 108, x_int) /* bis modem bits */ +#define x_TIOCMBIC x__IOW(x_t, 107, x_int) /* bic modem bits */ +#define x_TIOCMGET x__IOR(x_t, 106, x_int) /* get all modem bits */ +#define x_TIOCREMOTE x__IOW(x_t, 105, x_int) /* remote input editing */ +#define x_TIOCGWINSZ x__IOR(x_t, 104, struct x_winsize) /* get window size */ +#define x_TIOCSWINSZ x__IOW(x_t, 103, struct x_winsize) /* set window size */ +#define x_TIOCUCNTL x__IOW(x_t, 102, x_int) /* pty: set/clr usr cntl mode */ +#define x_UIOCCMD(x_n) x__IO(x_u, x_n) /* usr cntl op "n" */ + +#define x_OTTYDISC 0 /* old, v7 std tty driver */ +#define x_NETLDISC 1 /* line discip for berk net */ +#define x_NTTYDISC 2 /* new tty discipline */ +#define x_TABLDISC 3 /* tablet discipline */ +#define x_SLIPDISC 4 /* serial IP discipline */ + +#define x_FIOCLEX x__IO(x_f, 1) /* set exclusive use on fd */ +#define x_FIONCLEX x__IO(x_f, 2) /* remove exclusive use */ +/* another local */ +#define x_FIONREAD x__IOR(x_f, 127, x_int) /* get # bytes to read */ +#define x_FIONBIO x__IOW(x_f, 126, x_int) /* set/clear non-blocking i/o */ +#define x_FIOASYNC x__IOW(x_f, 125, x_int) /* set/clear async i/o */ +#define x_FIOSETOWN x__IOW(x_f, 124, x_int) /* set owner */ +#define x_FIOGETOWN x__IOR(x_f, 123, x_int) /* get owner */ + +/* socket i/o controls */ +#define x_SIOCSHIWAT x__IOW(x_s, 0, x_int) /* set high watermark */ +#define x_SIOCGHIWAT x__IOR(x_s, 1, x_int) /* get high watermark */ +#define x_SIOCSLOWAT x__IOW(x_s, 2, x_int) /* set low watermark */ +#define x_SIOCGLOWAT x__IOR(x_s, 3, x_int) /* get low watermark */ +#define x_SIOCATMARK x__IOR(x_s, 7, x_int) /* at oob mark? */ +#define x_SIOCSPGRP x__IOW(x_s, 8, x_int) /* set process group */ +#define x_SIOCGPGRP x__IOR(x_s, 9, x_int) /* get process group */ + +#define x_SIOCADDRT x__IOW(x_r, 10, struct x_rtentry) /* add route */ +#define x_SIOCDELRT x__IOW(x_r, 11, struct x_rtentry) /* delete route */ + +#define x_SIOCSIFADDR x__IOW(x_i, 12, struct x_ifreq) /* set ifnet address */ +#define x_SIOCGIFADDR x__IOWR(x_i,13, struct x_ifreq) /* get ifnet address */ +#define x_SIOCSIFDSTADDR x__IOW(x_i, 14, struct x_ifreq) /* set p-p address */ +#define x_SIOCGIFDSTADDR x__IOWR(x_i,15, struct x_ifreq) /* get p-p address */ +#define x_SIOCSIFFLAGS x__IOW(x_i, 16, struct x_ifreq) /* set ifnet flags */ +#define x_SIOCGIFFLAGS x__IOWR(x_i,17, struct x_ifreq) /* get ifnet flags */ +#define x_SIOCGIFBRDADDR x__IOWR(x_i,18, struct x_ifreq) /* get broadcast addr */ +#define x_SIOCSIFBRDADDR x__IOW(x_i,19, struct x_ifreq) /* set broadcast addr */ +#define x_SIOCGIFCONF x__IOWR(x_i,20, struct x_ifconf) /* get ifnet list */ +#define x_SIOCGIFNETMASK x__IOWR(x_i,21, struct x_ifreq) /* get net addr mask */ +#define x_SIOCSIFNETMASK x__IOW(x_i,22, struct x_ifreq) /* set net addr mask */ +#define x_SIOCGIFMETRIC x__IOWR(x_i,23, struct x_ifreq) /* get IF metric */ +#define x_SIOCSIFMETRIC x__IOW(x_i,24, struct x_ifreq) /* set IF metric */ + +#define x_SIOCSARP x__IOW(x_i, 30, struct x_arpreq) /* set arp entry */ +#define x_SIOCGARP x__IOWR(x_i,31, struct x_arpreq) /* get arp entry */ +#define x_SIOCDARP x__IOW(x_i, 32, struct x_arpreq) /* delete arp entry */ + +/*#endif*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* compat-4.1/gtty.c */ +x_int x_gtty __P((x_int x_fd, struct x_sgttyb *x_ap)); + +/* compat-4.1/stty.c */ +x_int x_stty __P((x_int x_fd, struct x_sgttyb *x_ap)); + +/* gen/isatty.c */ +x_int x_isatty __P((x_int x_f)); + +/* sys/ioctl.c */ +x_int x_ioctl __P((x_int x_d, x_u_long x_r, char *x_p)); +#endif + +#endif diff --git a/x_include/sys/x_kernel.h b/x_include/sys/x_kernel.h new file mode 100644 index 0000000..73b7368 --- /dev/null +++ b/x_include/sys/x_kernel.h @@ -0,0 +1,48 @@ +#include "x_.h" + +#ifndef x__SYS_KERNEL_H_ +#define x__SYS_KERNEL_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)kernel.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Global variables for the kernel + */ + +/*long rmalloc();*/ + +/* 1.1 */ +x_long x_hostid; +char x_hostname[x_MAXHOSTNAMELEN]; +x_int x_hostnamelen; + +/* 1.2 */ +struct x_timeval x_boottime; +struct x_timeval x_time; +struct x_timezone x_tz; /* XXX */ +x_int x_hz; +x_int x_phz; /* alternate clock's frequency */ +x_int x_tick; +x_int x_lbolt; /* awoken once a second */ +/*int realitexpire();*/ + +double x_avenrun[3]; + +#ifdef x_GPROF +extern x_int x_profiling; +extern char *x_s_lowpc; +extern x_u_long x_s_textsize; +extern x_u_short *x_kcount; +#endif + +#endif diff --git a/x_include/sys/x_map.h b/x_include/sys/x_map.h new file mode 100644 index 0000000..12c098d --- /dev/null +++ b/x_include/sys/x_map.h @@ -0,0 +1,56 @@ +#include "x_.h" + +#ifndef x__SYS_MAP_H_ +#define x__SYS_MAP_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)map.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Resource Allocation Maps. + * + * Associated routines manage sub-allocation of an address space using + * an array of segment descriptors. The first element of this array + * is a map structure, describing the arrays extent and the name + * of the controlled object. Each additional structure represents + * a free segment of the address space. + * + * A call to rminit initializes a resource map and may also be used + * to free some address space for the map. Subsequent calls to rmalloc + * and rmfree allocate and free space in the resource map. If the resource + * map becomes too fragmented to be described in the available space, + * then some of the resource is discarded. This may lead to critical + * shortages, but is better than not checking (as the previous versions + * of these routines did) or giving up and calling panic(). The routines + * could use linked lists and call a memory allocator when they run + * out of space, but that would not solve the out of space problem when + * called at interrupt time. + * + * N.B.: The address 0 in the resource address space is not available + * as it is used internally by the resource map routines. + */ +struct x_map { + struct x_mapent *x_m_limit; /* address of last slot in map */ + char *x_m_name; /* name of resource */ +/* we use m_name when the map overflows, in warning messages */ +}; +struct x_mapent { + x_int x_m_size; /* size of this segment of the map */ + x_int x_m_addr; /* resource-space addr of start of segment */ +}; + +#ifdef x_KERNEL +struct x_map *x_swapmap; +x_int x_nswapmap; +struct x_map *x_argmap; +#define x_ARGMAPSIZE 16 +struct x_map *x_kernelmap; +struct x_map *x_mbmap; +#endif + +#endif diff --git a/x_include/sys/x_mbuf.h b/x_include/sys/x_mbuf.h new file mode 100644 index 0000000..bbc7110 --- /dev/null +++ b/x_include/sys/x_mbuf.h @@ -0,0 +1,168 @@ +#include "x_.h" + +#ifndef x__SYS_MBUF_H_ +#define x__SYS_MBUF_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)mbuf.h 7.3 (Berkeley) 9/11/86 + */ + +/* + * Constants related to memory allocator. + */ +#define x_MSIZE 128 /* size of an mbuf */ + +#define x_MMINOFF 12 /* mbuf header length */ +#define x_MTAIL 4 +#define x_MMAXOFF (x_MSIZE-x_MTAIL) /* offset where data ends */ +#define x_MLEN (x_MSIZE-x_MMINOFF-x_MTAIL) /* mbuf data length */ +#define x_NMBCLUSTERS 256 +#define x_NMBPCL (x_CLBYTES/x_MSIZE) /* # mbufs per cluster */ + +/* + * Macros for type conversion + */ + +/* network cluster number to virtual address, and back */ +#define x_cltom(x_x) ((struct x_mbuf *)((x_int)x_mbutl + ((x_x) << x_CLSHIFT))) +#define x_mtocl(x_x) (((x_int)x_x - (x_int)x_mbutl) >> x_CLSHIFT) + +/* address in mbuf to mbuf head */ +#define x_dtom(x_x) ((struct x_mbuf *)((x_int)x_x & ~(x_MSIZE-1))) + +/* mbuf head, to typed data */ +#define x_mtod(x_x,x_t) ((x_t)((x_int)(x_x) + (x_x)->x_m_off)) + +struct x_mbuf { + struct x_mbuf *x_m_next; /* next buffer in chain */ + x_u_long x_m_off; /* offset of data */ + x_short x_m_len; /* amount of data in this mbuf */ + x_short x_m_type; /* mbuf type (0 == free) */ + x_u_char x_m_dat[x_MLEN]; /* data storage */ + struct x_mbuf *x_m_act; /* link in higher-level mbuf list */ +}; + +/* mbuf types */ +#define x_MT_FREE 0 /* should be on free list */ +#define x_MT_DATA 1 /* dynamic (data) allocation */ +#define x_MT_HEADER 2 /* packet header */ +#define x_MT_SOCKET 3 /* socket structure */ +#define x_MT_PCB 4 /* protocol control block */ +#define x_MT_RTABLE 5 /* routing tables */ +#define x_MT_HTABLE 6 /* IMP host tables */ +#define x_MT_ATABLE 7 /* address resolution tables */ +#define x_MT_SONAME 8 /* socket name */ +#define x_MT_ZOMBIE 9 /* zombie proc status */ +#define x_MT_SOOPTS 10 /* socket options */ +#define x_MT_FTABLE 11 /* fragment reassembly header */ +#define x_MT_RIGHTS 12 /* access rights */ +#define x_MT_IFADDR 13 /* interface address */ + +/* flags to m_get */ +#define x_M_DONTWAIT 0 +#define x_M_WAIT 1 + +/* flags to m_pgalloc */ +#define x_MPG_MBUFS 0 /* put new mbufs on free list */ +#define x_MPG_CLUSTERS 1 /* put new clusters on free list */ +#define x_MPG_SPACE 2 /* don't free; caller wants space */ + +/* length to m_copy to copy all */ +#define x_M_COPYALL 1000000000 + +/* + * m_pullup will pull up additional length if convenient; + * should be enough to hold headers of second-level and higher protocols. + */ +#define x_MPULL_EXTRA 32 + +#define x_MGET(x_m, x_i, x_t) \ + { x_int x_ms = x_splimp(); \ + if ((x_m)=x_mfree) \ + { if ((x_m)->x_m_type != x_MT_FREE) x_panic("mget"); (x_m)->x_m_type = x_t; \ + x_mbstat.x_m_mtypes[x_MT_FREE]--; x_mbstat.x_m_mtypes[x_t]++; \ + x_mfree = (x_m)->x_m_next; (x_m)->x_m_next = 0; \ + (x_m)->x_m_off = x_MMINOFF; } \ + else \ + (x_m) = x_m_more(x_i, x_t); \ + x_splx(x_ms); } +/* + * Mbuf page cluster macros. + * MCLALLOC allocates mbuf page clusters. + * Note that it works only with a count of 1 at the moment. + * MCLGET adds such clusters to a normal mbuf. + * m->m_len is set to CLBYTES upon success. + * MCLFREE frees clusters allocated by MCLALLOC. + */ +#define x_MCLALLOC(x_m, x_i) \ + { x_int x_ms = x_splimp(); \ + if (x_mclfree == 0) \ + (void)x_m_clalloc((x_i), x_MPG_CLUSTERS, x_M_DONTWAIT); \ + if ((x_m)=x_mclfree) \ + {++x_mclrefcnt[x_mtocl(x_m)];x_mbstat.x_m_clfree--;x_mclfree = (x_m)->x_m_next;} \ + x_splx(x_ms); } +#define x_M_HASCL(x_m) ((x_m)->x_m_off >= x_MSIZE) +#define x_MTOCL(x_m) ((struct x_mbuf *)(x_mtod((x_m), x_int)&~x_CLOFSET)) + +#define x_MCLGET(x_m) \ + { struct x_mbuf *x_p; \ + x_MCLALLOC(x_p, 1); \ + if (x_p) { \ + (x_m)->x_m_off = (x_int)x_p - (x_int)(x_m); \ + (x_m)->x_m_len = x_CLBYTES; \ + } \ + } +#define x_MCLFREE(x_m) { \ + if (--x_mclrefcnt[x_mtocl(x_m)] == 0) \ + { (x_m)->x_m_next = x_mclfree;x_mclfree = (x_m);x_mbstat.x_m_clfree++;} \ + } +#define x_MFREE(x_m, x_n) \ + { x_int x_ms = x_splimp(); \ + if ((x_m)->x_m_type == x_MT_FREE) x_panic("mfree"); \ + x_mbstat.x_m_mtypes[(x_m)->x_m_type]--; x_mbstat.x_m_mtypes[x_MT_FREE]++; \ + (x_m)->x_m_type = x_MT_FREE; \ + if (x_M_HASCL(x_m)) { \ + (x_n) = x_MTOCL(x_m); \ + x_MCLFREE(x_n); \ + } \ + (x_n) = (x_m)->x_m_next; (x_m)->x_m_next = x_mfree; \ + (x_m)->x_m_off = 0; (x_m)->x_m_act = 0; x_mfree = (x_m); \ + x_splx(x_ms); \ + if (x_m_want) { \ + x_m_want = 0; \ + x_wakeup((x_caddr_t)&x_mfree); \ + } \ + } + +/* + * Mbuf statistics. + */ +struct x_mbstat { + x_short x_m_mbufs; /* mbufs obtained from page pool */ + x_short x_m_clusters; /* clusters obtained from page pool */ + x_short x_m_clfree; /* free clusters */ + x_short x_m_drops; /* times failed to find space */ + x_short x_m_mtypes[256]; /* type specific mbuf allocations */ +}; + +#ifdef x_KERNEL +extern struct x_mbuf x_mbutl[]; /* virtual address of net free mem */ +extern struct x_pte x_Mbmap[]; /* page tables to map Netutl */ +struct x_mbstat x_mbstat; +x_int x_nmbclusters; +struct x_mbuf *x_mfree, *x_mclfree; +char x_mclrefcnt[x_NMBCLUSTERS + 1]; +x_int x_m_want; +/*struct mbuf *m_get(),*m_getclr(),*m_free(),*m_more(),*m_copy(),*m_pullup();*/ +/*caddr_t m_clalloc();*/ +#endif + +#endif diff --git a/x_include/sys/x_mman.h b/x_include/sys/x_mman.h new file mode 100644 index 0000000..bc69e3c --- /dev/null +++ b/x_include/sys/x_mman.h @@ -0,0 +1,30 @@ +#include "x_.h" + +#ifndef x__SYS_MMAN_H_ +#define x__SYS_MMAN_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)mman.h 7.1 (Berkeley) 6/4/86 + */ + +/* protections are chosen from these bits, or-ed together */ +#define x_PROT_READ 0x1 /* pages can be read */ +#define x_PROT_WRITE 0x2 /* pages can be written */ +#define x_PROT_EXEC 0x4 /* pages can be executed */ + +/* sharing types: choose either SHARED or PRIVATE */ +#define x_MAP_SHARED 1 /* share changes */ +#define x_MAP_PRIVATE 2 /* changes are private */ + +/* advice to madvise */ +#define x_MADV_NORMAL 0 /* no further special treatment */ +#define x_MADV_RANDOM 1 /* expect random page references */ +#define x_MADV_SEQUENTIAL 2 /* expect sequential page references */ +#define x_MADV_WILLNEED 3 /* will need these pages */ +#define x_MADV_DONTNEED 4 /* dont need these pages */ + +#endif diff --git a/x_include/sys/x_mount.h b/x_include/sys/x_mount.h new file mode 100644 index 0000000..1fe19e4 --- /dev/null +++ b/x_include/sys/x_mount.h @@ -0,0 +1,48 @@ +#include "x_.h" + +#ifndef x__SYS_MOUNT_H_ +#define x__SYS_MOUNT_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)mount.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Mount structure. + * One allocated on every mount. + * Used to find the super block. + */ +struct x_mount { + x_dev_t x_m_dev; /* device mounted */ + struct x_buf *x_m_bufp; /* pointer to superblock */ + struct x_inode *x_m_inodp; /* pointer to mounted on inode */ + struct x_inode *x_m_qinod; /* QUOTA: pointer to quota file */ +}; +#ifdef x_KERNEL +struct x_mount x_mount[x_NMOUNT]; +#endif + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* sys/mount.c */ +x_int x_mount __P((char *x_s, char *x_n, x_int x_f)); + +/* sys/umount.c */ +x_int x_umount __P((char *x_s)); +#endif + +#endif diff --git a/x_include/sys/x_msgbuf.h b/x_include/sys/x_msgbuf.h new file mode 100644 index 0000000..89b4e11 --- /dev/null +++ b/x_include/sys/x_msgbuf.h @@ -0,0 +1,26 @@ +#include "x_.h" + +#ifndef x__SYS_MSGBUF_H_ +#define x__SYS_MSGBUF_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)msgbuf.h 7.1 (Berkeley) 6/4/86 + */ + +#define x_MSG_MAGIC 0x063061 +#define x_MSG_BSIZE (4096 - 3 * sizeof (x_long)) +struct x_msgbuf { + x_long x_msg_magic; + x_long x_msg_bufx; + x_long x_msg_bufr; + char x_msg_bufc[x_MSG_BSIZE]; +}; +#ifdef x_KERNEL +struct x_msgbuf x_msgbuf; +#endif + +#endif diff --git a/x_include/sys/x_mtio.h b/x_include/sys/x_mtio.h new file mode 100644 index 0000000..88bd745 --- /dev/null +++ b/x_include/sys/x_mtio.h @@ -0,0 +1,77 @@ +#include "x_.h" + +#ifndef x__SYS_MTIO_H_ +#define x__SYS_MTIO_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)mtio.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Structures and definitions for mag tape io control commands + */ + +/* structure for MTIOCTOP - mag tape op command */ +struct x_mtop { + x_short x_mt_op; /* operations defined below */ + x_daddr_t x_mt_count; /* how many of them */ +}; + +/* operations */ +#define x_MTWEOF 0 /* write an end-of-file record */ +#define x_MTFSF 1 /* forward space file */ +#define x_MTBSF 2 /* backward space file */ +#define x_MTFSR 3 /* forward space record */ +#define x_MTBSR 4 /* backward space record */ +#define x_MTREW 5 /* rewind */ +#define x_MTOFFL 6 /* rewind and put the drive offline */ +#define x_MTNOP 7 /* no operation, sets status only */ +#define x_MTCACHE 8 /* enable controller cache */ +#define x_MTNOCACHE 9 /* disable controller cache */ + +/* structure for MTIOCGET - mag tape get status command */ + +struct x_mtget { + x_short x_mt_type; /* type of magtape device */ +/* the following two registers are grossly device dependent */ + x_short x_mt_dsreg; /* ``drive status'' register */ + x_short x_mt_erreg; /* ``error'' register */ +/* end device-dependent registers */ + x_short x_mt_resid; /* residual count */ +/* the following two are not yet implemented */ + x_daddr_t x_mt_fileno; /* file number of current position */ + x_daddr_t x_mt_blkno; /* block number of current position */ +/* end not yet implemented */ +}; + +/* + * Constants for mt_type byte. These are the same + * for controllers compatible with the types listed. + */ +#define x_MT_ISTS 0x01 /* TS-11 */ +#define x_MT_ISHT 0x02 /* TM03 Massbus: TE16, TU45, TU77 */ +#define x_MT_ISTM 0x03 /* TM11/TE10 Unibus */ +#define x_MT_ISMT 0x04 /* TM78/TU78 Massbus */ +#define x_MT_ISUT 0x05 /* SI TU-45 emulation on Unibus */ +#define x_MT_ISCPC 0x06 /* SUN */ +#define x_MT_ISAR 0x07 /* SUN */ +#define x_MT_ISTMSCP 0x08 /* DEC TMSCP protocol (TU81, TK50) */ + +/* mag tape io control commands */ +#define x_MTIOCTOP x__IOW(x_m, 1, struct x_mtop) /* do a mag tape op */ +#define x_MTIOCGET x__IOR(x_m, 2, struct x_mtget) /* get tape status */ +#define x_MTIOCIEOT x__IO(x_m, 3) /* ignore EOT error */ +#define x_MTIOCEEOT x__IO(x_m, 4) /* enable EOT error */ + +#ifndef x_KERNEL +#define x_DEFTAPE "/dev/rmt12" +#endif + +#endif diff --git a/x_include/sys/x_namei.h b/x_include/sys/x_namei.h new file mode 100644 index 0000000..e70d454 --- /dev/null +++ b/x_include/sys/x_namei.h @@ -0,0 +1,99 @@ +#include "x_.h" + +#ifndef x__SYS_NAMEI_H_ +#define x__SYS_NAMEI_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)namei.h 7.1 (Berkeley) 6/4/86 + */ + +/*#ifndef _NAMEI_*/ +/*#define _NAMEI_*/ + +#ifdef x_KERNEL +#include "x_uio.h" +#else +#include +#endif + +/* + * Encapsulation of namei parameters. + * One of these is located in the u. area to + * minimize space allocated on the kernel stack. + */ +struct x_nameidata { + x_caddr_t x_ni_dirp; /* pathname pointer */ + x_short x_ni_nameiop; /* see below */ + x_short x_ni_error; /* error return if any */ + x_off_t x_ni_endoff; /* end of useful stuff in directory */ + struct x_inode *x_ni_pdir; /* inode of parent directory of dirp */ + struct x_iovec x_ni_iovec; /* MUST be pointed to by ni_iov */ + struct x_uio x_ni_uio; /* directory I/O parameters */ + struct x_direct x_ni_dent; /* current directory entry */ +}; + +#define x_ni_base x_ni_iovec.x_iov_base +#define x_ni_count x_ni_iovec.x_iov_len +#define x_ni_iov x_ni_uio.x_uio_iov +#define x_ni_iovcnt x_ni_uio.x_uio_iovcnt +#define x_ni_offset x_ni_uio.x_uio_offset +#define x_ni_segflg x_ni_uio.x_uio_segflg +#define x_ni_resid x_ni_uio.x_uio_resid + +/* + * namei operations and modifiers + */ +#define x_LOOKUP 0 /* perform name lookup only */ +#define x_CREATE 1 /* setup for file creation */ +#define x_DELETE 2 /* setup for file deletion */ +#define x_LOCKPARENT 0x10 /* see the top of namei */ +#define x_NOCACHE 0x20 /* name must not be left in cache */ +#define x_FOLLOW 0x40 /* follow symbolic links */ +#define x_NOFOLLOW 0x0 /* don't follow symbolic links (pseudo) */ + +/* + * This structure describes the elements in the cache of recent + * names looked up by namei. + */ +struct x_namecache { + struct x_namecache *x_nc_forw; /* hash chain, MUST BE FIRST */ + struct x_namecache *x_nc_back; /* hash chain, MUST BE FIRST */ + struct x_namecache *x_nc_nxt; /* LRU chain */ + struct x_namecache **x_nc_prev; /* LRU chain */ + struct x_inode *x_nc_ip; /* inode the name refers to */ + x_ino_t x_nc_ino; /* ino of parent of name */ + x_dev_t x_nc_dev; /* dev of parent of name */ + x_dev_t x_nc_idev; /* dev of the name ref'd */ + x_long x_nc_id; /* referenced inode's id */ + char x_nc_nlen; /* length of name */ +#define x_NCHNAMLEN 15 /* maximum name segment length we bother with */ + char x_nc_name[x_NCHNAMLEN]; /* segment name */ +}; +#ifdef x_KERNEL +struct x_namecache *x_namecache; +x_int x_nchsize; +#endif + +/* + * Stats on usefulness of namei caches. + */ +struct x_nchstats { + x_long x_ncs_goodhits; /* hits that we can reall use */ + x_long x_ncs_badhits; /* hits we must drop */ + x_long x_ncs_falsehits; /* hits with id mismatch */ + x_long x_ncs_miss; /* misses */ + x_long x_ncs_long; /* long names that ignore cache */ + x_long x_ncs_pass2; /* names found with passes == 2 */ + x_long x_ncs_2passes; /* number of times we attempt it */ +}; +/*#endif*/ + +#endif diff --git a/x_include/sys/x_param.h b/x_include/sys/x_param.h new file mode 100644 index 0000000..08b5774 --- /dev/null +++ b/x_include/sys/x_param.h @@ -0,0 +1,201 @@ +#include "x_.h" + +#ifndef x__SYS_PARAM_H_ +#define x__SYS_PARAM_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)param.h 7.1 (Berkeley) 6/4/86 + */ + +#define x_BSD 43 /* 4.3 * 10, as cpp doesn't do floats */ +#define x_BSD4_3 1 + +/* + * Machine type dependent parameters. + */ +#ifdef x_KERNEL +#include "../machine/x_machparam.h" +#else +#include +#endif + +#define x_NPTEPG (x_NBPG/(sizeof (struct x_pte))) + +/* + * Machine-independent constants + */ +#define x_NMOUNT 20 /* number of mountable file systems */ +/* NMOUNT must be <= 255 unless c_mdev (cmap.h) is expanded */ +#define x_MSWAPX x_NMOUNT /* pseudo mount table index for swapdev */ +#define x_MAXUPRC 40 /* max processes per user */ +#define x_NOFILE 64 /* max open files per process */ +#define x_CANBSIZ 256 /* max size of typewriter line */ +#define x_NCARGS 20480 /* # characters in exec arglist */ +#define x_NGROUPS 16 /* max number groups */ + +#define x_NOGROUP 65535 /* marker for empty group set member */ + +/* + * Priorities + */ +#define x_PSWP 0 +#define x_PINOD 10 +#define x_PRIBIO 20 +#define x_PRIUBA 24 +#define x_PZERO 25 +#define x_PPIPE 26 +#define x_PWAIT 30 +#define x_PLOCK 35 +#define x_PSLEP 40 +#define x_PUSER 50 + +#define x_NZERO 0 + +/* + * Signals + */ +/*#ifdef KERNEL*/ +/*#include "signal.h"*/ +/*#else*/ +/*#include */ +/*#endif*/ + +/* moved this to sys/proc.h to avoid a circular dependency */ +/*#define ISSIG(p) \*/ +/* ((p)->p_sig && ((p)->p_flag&STRC || \*/ +/* ((p)->p_sig &~ ((p)->p_sigignore | (p)->p_sigmask))) && issig())*/ + +#define x_NBPW sizeof(x_int) /* number of bytes in an integer */ + +#define x_NULL 0 +#define x_CMASK 022 /* default mask for file creation */ +#define x_NODEV (x_dev_t)(-1) + +/* + * Clustering of hardware pages on machines with ridiculously small + * page sizes is done here. The paging subsystem deals with units of + * CLSIZE pte's describing NBPG (from vm.h) pages each. + * + * NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE + */ +#define x_CLBYTES (x_CLSIZE*x_NBPG) +#define x_CLOFSET (x_CLSIZE*x_NBPG-1) /* for clusters, like PGOFSET */ +#define x_claligned(x_x) ((((x_int)(x_x))&x_CLOFSET)==0) +#define x_CLOFF x_CLOFSET +#define x_CLSHIFT (x_PGSHIFT+x_CLSIZELOG2) + +#if x_CLSIZE==1 +#define x_clbase(x_i) (x_i) +#define x_clrnd(x_i) (x_i) +#else +/* give the base virtual address (first of CLSIZE) */ +#define x_clbase(x_i) ((x_i) &~ (x_CLSIZE-1)) +/* round a number of clicks up to a whole cluster */ +#define x_clrnd(x_i) (((x_i) + (x_CLSIZE-1)) &~ (x_CLSIZE-1)) +#endif + +/* CBLOCK is the size of a clist block, must be power of 2 */ +#define x_CBLOCK 64 +#define x_CBSIZE (x_CBLOCK - sizeof(struct x_cblock *)) /* data chars/clist */ +#define x_CROUND (x_CBLOCK - 1) /* clist rounding */ + +#ifndef x_KERNEL +#include +#else +#ifndef x_LOCORE +#include "x_types.h" +#endif +#endif + +/* + * File system parameters and macros. + * + * The file system is made out of blocks of at most MAXBSIZE units, + * with smaller units (fragments) only in the last direct block. + * MAXBSIZE primarily determines the size of buffers in the buffer + * pool. It may be made larger without any effect on existing + * file systems; however making it smaller make make some file + * systems unmountable. + * + * Note that the blocked devices are assumed to have DEV_BSIZE + * "sectors" and that fragments must be some multiple of this size. + * Block devices are read in BLKDEV_IOSIZE units. This number must + * be a power of two and in the range of + * DEV_BSIZE <= BLKDEV_IOSIZE <= MAXBSIZE + * This size has no effect upon the file system, but is usually set + * to the block size of the root file system, so as to maximize the + * speed of ``fsck''. + */ +#define x_MAXBSIZE 8192 +#define x_DEV_BSIZE 512 +#define x_DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ +#define x_BLKDEV_IOSIZE 2048 +#define x_MAXFRAG 8 + +#define x_btodb(x_bytes) /* calculates (bytes / DEV_BSIZE) */ \ + ((unsigned)(x_bytes) >> x_DEV_BSHIFT) +#define x_dbtob(x_db) /* calculates (db * DEV_BSIZE) */ \ + ((unsigned)(x_db) << x_DEV_BSHIFT) + +/* + * Map a ``block device block'' to a file system block. + * This should be device dependent, and will be after we + * add an entry to cdevsw for that purpose. For now though + * just use DEV_BSIZE. + */ +#define x_bdbtofsb(x_bn) ((x_bn) / (x_BLKDEV_IOSIZE/x_DEV_BSIZE)) + +/* + * MAXPATHLEN defines the longest permissable path length + * after expanding symbolic links. It is used to allocate + * a temporary buffer from the buffer pool in which to do the + * name expansion, hence should be a power of two, and must + * be less than or equal to MAXBSIZE. + * MAXSYMLINKS defines the maximum number of symbolic links + * that may be expanded in a path name. It should be set high + * enough to allow all legitimate uses, but halt infinite loops + * reasonably quickly. + */ +#define x_MAXPATHLEN 1024 +#define x_MAXSYMLINKS 8 + +/* + * bit map related macros + */ +#define x_setbit(x_a,x_i) ((x_a)[(x_i)/x_NBBY] |= 1<<((x_i)%x_NBBY)) +#define x_clrbit(x_a,x_i) ((x_a)[(x_i)/x_NBBY] &= ~(1<<((x_i)%x_NBBY))) +#define x_isset(x_a,x_i) ((x_a)[(x_i)/x_NBBY] & (1<<((x_i)%x_NBBY))) +#define x_isclr(x_a,x_i) (((x_a)[(x_i)/x_NBBY] & (1<<((x_i)%x_NBBY))) == 0) + +/* + * Macros for fast min/max. + */ +#define x_MIN(x_a,x_b) (((x_a)<(x_b))?(x_a):(x_b)) +#define x_MAX(x_a,x_b) (((x_a)>(x_b))?(x_a):(x_b)) + +/* + * Macros for counting and rounding. + */ +/* formerly duplicated in sys/types.h, but we now get it from here */ +/*#ifndef howmany*/ +#define x_howmany(x_x, x_y) (((x_x)+((x_y)-1))/(x_y)) +/*#endif*/ +#define x_roundup(x_x, x_y) ((((x_x)+((x_y)-1))/(x_y))*(x_y)) + +/* + * Maximum size of hostname recognized and stored in the kernel. + */ +#define x_MAXHOSTNAMELEN 64 + +/* moved this from sys/types.h */ +#define x_NBBY 8 /* number of bits in a byte */ + +#endif diff --git a/x_include/sys/x_proc.h b/x_include/sys/x_proc.h new file mode 100644 index 0000000..f2d2611 --- /dev/null +++ b/x_include/sys/x_proc.h @@ -0,0 +1,216 @@ +#include "x_.h" + +#ifndef x__SYS_PROC_H_ +#define x__SYS_PROC_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)proc.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * One structure allocated per active + * process. It contains all data needed + * about the process while the + * process may be swapped out. + * Other per process data (user.h) + * is swapped with the process. + */ +struct x_proc { + struct x_proc *x_p_link; /* linked list of running processes */ + struct x_proc *x_p_rlink; + struct x_proc *x_p_nxt; /* linked list of allocated proc slots */ + struct x_proc **x_p_prev; /* also zombies, and free proc's */ + struct x_pte *x_p_addr; /* u-area kernel map address */ + char x_p_usrpri; /* user-priority based on p_cpu and p_nice */ + char x_p_pri; /* priority, negative is high */ + char x_p_cpu; /* cpu usage for scheduling */ + char x_p_stat; + char x_p_time; /* resident time for scheduling */ + char x_p_nice; /* nice for cpu usage */ + char x_p_slptime; /* time since last block */ + char x_p_cursig; + x_int x_p_sig; /* signals pending to this process */ + x_int x_p_sigmask; /* current signal mask */ + x_int x_p_sigignore; /* signals being ignored */ + x_int x_p_sigcatch; /* signals being caught by user */ + x_int x_p_flag; + x_uid_t x_p_uid; /* user id, used to direct tty signals */ + x_short x_p_pgrp; /* name of process group leader */ + x_short x_p_pid; /* unique process id */ + x_short x_p_ppid; /* process id of parent */ + x_u_short x_p_xstat; /* Exit status for wait */ + struct x_rusage *x_p_ru; /* mbuf holding exit information */ + x_short x_p_poip; /* page outs in progress */ + x_short x_p_szpt; /* copy of page table size */ + x_size_t x_p_tsize; /* size of text (clicks) */ + x_size_t x_p_dsize; /* size of data space (clicks) */ + x_size_t x_p_ssize; /* copy of stack size (clicks) */ + x_size_t x_p_rssize; /* current resident set size in clicks */ + x_size_t x_p_maxrss; /* copy of u.u_limit[MAXRSS] */ + x_size_t x_p_swrss; /* resident set size before last swap */ + x_swblk_t x_p_swaddr; /* disk address of u area when swapped */ + x_caddr_t x_p_wchan; /* event process is awaiting */ + struct x_text *x_p_textp; /* pointer to text structure */ + struct x_pte *x_p_p0br; /* page table base P0BR */ + struct x_proc *x_p_xlink; /* linked list of procs sharing same text */ + x_short x_p_cpticks; /* ticks of cpu time */ + float x_p_pctcpu; /* %cpu for this process during p_time */ + x_short x_p_ndx; /* proc index for memall (because of vfork) */ + x_short x_p_idhash; /* hashed based on p_pid for kill+exit+... */ + struct x_proc *x_p_pptr; /* pointer to process structure of parent */ + struct x_proc *x_p_cptr; /* pointer to youngest living child */ + struct x_proc *x_p_osptr; /* pointer to older sibling processes */ + struct x_proc *x_p_ysptr; /* pointer to younger siblings */ + struct x_itimerval x_p_realtimer; + struct x_quota *x_p_quota; /* quotas for this process */ +}; + +#define x_PIDHSZ 64 +#define x_PIDHASH(x_pid) ((x_pid) & (x_PIDHSZ - 1)) + +#ifdef x_KERNEL +x_short x_pidhash[x_PIDHSZ]; +/*struct proc *pfind();*/ +struct x_proc *x_proc, *x_procNPROC; /* the proc table itself */ +struct x_proc *x_freeproc, *x_zombproc, *x_allproc; + /* lists of procs in various states */ +x_int x_nproc; + +#define x_NQS 32 /* 32 run queues */ +struct x_prochd { + struct x_proc *x_ph_link; /* linked list of running processes */ + struct x_proc *x_ph_rlink; +} x_qs[x_NQS]; +x_int x_whichqs; /* bit mask summarizing non-empty qs's */ +#endif + +/* stat codes */ +#define x_SSLEEP 1 /* awaiting an event */ +#define x_SWAIT 2 /* (abandoned state) */ +#define x_SRUN 3 /* running */ +#define x_SIDL 4 /* intermediate state in process creation */ +#define x_SZOMB 5 /* intermediate state in process termination */ +#define x_SSTOP 6 /* process being traced */ + +/* flag codes */ +#define x_SLOAD 0x0000001 /* in core */ +#define x_SSYS 0x0000002 /* swapper or pager process */ +#define x_SLOCK 0x0000004 /* process being swapped out */ +#define x_SSWAP 0x0000008 /* save area flag */ +#define x_STRC 0x0000010 /* process is being traced */ +#define x_SWTED 0x0000020 /* another tracing flag */ +#define x_SULOCK 0x0000040 /* user settable lock in core */ +#define x_SPAGE 0x0000080 /* process in page wait state */ +#define x_SKEEP 0x0000100 /* another flag to prevent swap out */ +#define x_SOMASK 0x0000200 /* restore old mask after taking signal */ +#define x_SWEXIT 0x0000400 /* working on exiting */ +#define x_SPHYSIO 0x0000800 /* doing physical i/o (bio.c) */ +#define x_SVFORK 0x0001000 /* process resulted from vfork() */ +#define x_SVFDONE 0x0002000 /* another vfork flag */ +#define x_SNOVM 0x0004000 /* no vm, parent in a vfork() */ +#define x_SPAGI 0x0008000 /* init data space on demand, from inode */ +#define x_SSEQL 0x0010000 /* user warned of sequential vm behavior */ +#define x_SUANOM 0x0020000 /* user warned of random vm behavior */ +#define x_STIMO 0x0040000 /* timing out during sleep */ +/* was SDETACH */ +#define x_SOUSIG 0x0100000 /* using old signal mechanism */ +#define x_SOWEUPC 0x0200000 /* owe process an addupc() call at next ast */ +#define x_SSEL 0x0400000 /* selecting; wakeup/waiting danger */ +#define x_SLOGIN 0x0800000 /* a login process (legit child of init) */ +#define x_SPTECHG 0x1000000 /* pte's for process have changed */ + +/* moved this from sys/param.h to avoid a circular dependency */ +#define x_ISSIG(x_p) \ + ((x_p)->x_p_sig && ((x_p)->x_p_flag&x_STRC || \ + ((x_p)->x_p_sig &~ ((x_p)->x_p_sigignore | (x_p)->x_p_sigmask))) && x_issig()) + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/setegid.c */ +x_int x_setegid __P((x_int x_egid)); + +/* gen/seteuid.c */ +x_int x_seteuid __P((x_int x_euid)); + +/* gen/setgid.c */ +x_int x_setgid __P((x_int x_gid)); + +/* gen/setrgid.c */ +x_int x_setrgid __P((x_int x_rgid)); + +/* gen/setruid.c */ +x_int x_setruid __P((x_int x_ruid)); + +/* gen/setuid.c */ +x_int x_setuid __P((x_int x_uid)); + +/* sys/brk.c */ +char *x_brk __P((char *x_a)); + +/* sys/chdir.c */ +x_int x_chdir __P((char *x_s)); + +/* sys/chroot.c */ +x_int x_chroot __P((char *x_d)); + +/* sys/_exit.c */ +void x__exit __P((x_int x_s)); + +/* sys/fork.c */ +x_int x_fork __P((void)); + +/* sys/getegid.c */ +x_gid_t x_getegid __P((void)); + +/* sys/geteuid.c */ +x_uid_t x_geteuid __P((void)); + +/* sys/getgid.c */ +x_gid_t x_getgid __P((void)); + +/* sys/getgroups.c */ +x_int x_getgroups __P((x_int x_n, x_int *x_g)); + +/* sys/getpgrp.c */ +x_int x_getpgrp __P((x_int x_p)); + +/* sys/getpid.c */ +x_int x_getpid __P((void)); + +/* sys/getppid.c */ +x_int x_getppid __P((void)); + +/* sys/getuid.c */ +x_uid_t x_getuid __P((void)); + +/* sys/sbrk.c */ +char *x_sbrk __P((x_int x_i)); + +/* sys/setgroups.c */ +x_int x_setgroups __P((x_int x_n, x_int *x_g)); + +/* sys/setpgrp.c */ +x_int x_setpgrp __P((x_int x_g, x_int x_pg)); + +/* sys/setregid.c */ +x_int x_setregid __P((x_int x_r, x_int x_e)); + +/* sys/setreuid.c */ +x_int x_setreuid __P((x_int x_r, x_int x_e)); +#endif + +#endif diff --git a/x_include/sys/x_protosw.h b/x_include/sys/x_protosw.h new file mode 100644 index 0000000..b0a0cbd --- /dev/null +++ b/x_include/sys/x_protosw.h @@ -0,0 +1,190 @@ +#include "x_.h" + +#ifndef x__SYS_PROTOSW_H_ +#define x__SYS_PROTOSW_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)protosw.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Protocol switch table. + * + * Each protocol has a handle initializing one of these structures, + * which is used for protocol-protocol and system-protocol communication. + * + * A protocol is called through the pr_init entry before any other. + * Thereafter it is called every 200ms through the pr_fasttimo entry and + * every 500ms through the pr_slowtimo for timer based actions. + * The system will call the pr_drain entry if it is low on space and + * this should throw away any non-critical data. + * + * Protocols pass data between themselves as chains of mbufs using + * the pr_input and pr_output hooks. Pr_input passes data up (towards + * UNIX) and pr_output passes it down (towards the imps); control + * information passes up and down on pr_ctlinput and pr_ctloutput. + * The protocol is responsible for the space occupied by any the + * arguments to these entries and must dispose it. + * + * The userreq routine interfaces protocols to the system and is + * described below. + */ +struct x_protosw { + x_short x_pr_type; /* socket type used for */ + struct x_domain *x_pr_domain; /* domain protocol a member of */ + x_short x_pr_protocol; /* protocol number */ + x_short x_pr_flags; /* see below */ +/* protocol-protocol hooks */ + x_int (*x_pr_input)(); /* input to protocol (from below) */ + x_int (*x_pr_output)(); /* output to protocol (from above) */ + x_int (*x_pr_ctlinput)(); /* control input (from below) */ + x_int (*x_pr_ctloutput)(); /* control output (from above) */ +/* user-protocol hook */ + x_int (*x_pr_usrreq)(); /* user request: see list below */ +/* utility hooks */ + x_int (*x_pr_init)(); /* initialization hook */ + x_int (*x_pr_fasttimo)(); /* fast timeout (200ms) */ + x_int (*x_pr_slowtimo)(); /* slow timeout (500ms) */ + x_int (*x_pr_drain)(); /* flush any excess space possible */ +}; + +#define x_PR_SLOWHZ 2 /* 2 slow timeouts per second */ +#define x_PR_FASTHZ 5 /* 5 fast timeouts per second */ + +/* + * Values for pr_flags + */ +#define x_PR_ATOMIC 0x01 /* exchange atomic messages only */ +#define x_PR_ADDR 0x02 /* addresses given with messages */ +/* in the current implementation, PR_ADDR needs PR_ATOMIC to work */ +#define x_PR_CONNREQUIRED 0x04 /* connection required by protocol */ +#define x_PR_WANTRCVD 0x08 /* want PRU_RCVD calls */ +#define x_PR_RIGHTS 0x10 /* passes capabilities */ + +/* + * The arguments to usrreq are: + * (*protosw[].pr_usrreq)(up, req, m, nam, opt); + * where up is a (struct socket *), req is one of these requests, + * m is a optional mbuf chain containing a message, + * nam is an optional mbuf chain containing an address, + * and opt is a pointer to a socketopt structure or nil. + * The protocol is responsible for disposal of the mbuf chain m, + * the caller is responsible for any space held by nam and opt. + * A non-zero return from usrreq gives an + * UNIX error number which should be passed to higher level software. + */ +#define x_PRU_ATTACH 0 /* attach protocol to up */ +#define x_PRU_DETACH 1 /* detach protocol from up */ +#define x_PRU_BIND 2 /* bind socket to address */ +#define x_PRU_LISTEN 3 /* listen for connection */ +#define x_PRU_CONNECT 4 /* establish connection to peer */ +#define x_PRU_ACCEPT 5 /* accept connection from peer */ +#define x_PRU_DISCONNECT 6 /* disconnect from peer */ +#define x_PRU_SHUTDOWN 7 /* won't send any more data */ +#define x_PRU_RCVD 8 /* have taken data; more room now */ +#define x_PRU_SEND 9 /* send this data */ +#define x_PRU_ABORT 10 /* abort (fast DISCONNECT, DETATCH) */ +#define x_PRU_CONTROL 11 /* control operations on protocol */ +#define x_PRU_SENSE 12 /* return status into m */ +#define x_PRU_RCVOOB 13 /* retrieve out of band data */ +#define x_PRU_SENDOOB 14 /* send out of band data */ +#define x_PRU_SOCKADDR 15 /* fetch socket's address */ +#define x_PRU_PEERADDR 16 /* fetch peer's address */ +#define x_PRU_CONNECT2 17 /* connect two sockets */ +/* begin for protocols internal use */ +#define x_PRU_FASTTIMO 18 /* 200ms timeout */ +#define x_PRU_SLOWTIMO 19 /* 500ms timeout */ +#define x_PRU_PROTORCV 20 /* receive from below */ +#define x_PRU_PROTOSEND 21 /* send to below */ + +#define x_PRU_NREQ 21 + +#ifdef x_PRUREQUESTS +char *x_prurequests[] = { + "ATTACH", "DETACH", "BIND", "LISTEN", + "CONNECT", "ACCEPT", "DISCONNECT", "SHUTDOWN", + "RCVD", "SEND", "ABORT", "CONTROL", + "SENSE", "RCVOOB", "SENDOOB", "SOCKADDR", + "PEERADDR", "CONNECT2", "FASTTIMO", "SLOWTIMO", + "PROTORCV", "PROTOSEND", +}; +#endif + +/* + * The arguments to the ctlinput routine are + * (*protosw[].pr_ctlinput)(cmd, arg); + * where cmd is one of the commands below, and arg is + * an optional argument (caddr_t). + * + * N.B. The IMP code, in particular, pressumes the values + * of some of the commands; change with extreme care. + * TODO: + * spread out codes so new ICMP codes can be + * accomodated more easily + */ +#define x_PRC_IFDOWN 0 /* interface transition */ +#define x_PRC_ROUTEDEAD 1 /* select new route if possible */ +#define x_PRC_QUENCH 4 /* some said to slow down */ +#define x_PRC_MSGSIZE 5 /* message size forced drop */ +#define x_PRC_HOSTDEAD 6 /* normally from IMP */ +#define x_PRC_HOSTUNREACH 7 /* ditto */ +#define x_PRC_UNREACH_NET 8 /* no route to network */ +#define x_PRC_UNREACH_HOST 9 /* no route to host */ +#define x_PRC_UNREACH_PROTOCOL 10 /* dst says bad protocol */ +#define x_PRC_UNREACH_PORT 11 /* bad port # */ +#define x_PRC_UNREACH_NEEDFRAG 12 /* IP_DF caused drop */ +#define x_PRC_UNREACH_SRCFAIL 13 /* source route failed */ +#define x_PRC_REDIRECT_NET 14 /* net routing redirect */ +#define x_PRC_REDIRECT_HOST 15 /* host routing redirect */ +#define x_PRC_REDIRECT_TOSNET 16 /* redirect for type of service & net */ +#define x_PRC_REDIRECT_TOSHOST 17 /* redirect for tos & host */ +#define x_PRC_TIMXCEED_INTRANS 18 /* packet lifetime expired in transit */ +#define x_PRC_TIMXCEED_REASS 19 /* lifetime expired on reass q */ +#define x_PRC_PARAMPROB 20 /* header incorrect */ + +#define x_PRC_NCMDS 21 + +#ifdef x_PRCREQUESTS +char *x_prcrequests[] = { + "IFDOWN", "ROUTEDEAD", "#2", "#3", + "QUENCH", "MSGSIZE", "HOSTDEAD", "HOSTUNREACH", + "NET-UNREACH", "HOST-UNREACH", "PROTO-UNREACH", "PORT-UNREACH", + "FRAG-UNREACH", "SRCFAIL-UNREACH", "NET-REDIRECT", "HOST-REDIRECT", + "TOSNET-REDIRECT", "TOSHOST-REDIRECT", "TX-INTRANS", "TX-REASS", + "PARAMPROB" +}; +#endif + +/* + * The arguments to ctloutput are: + * (*protosw[].pr_ctloutput)(req, so, level, optname, optval); + * req is one of the actions listed below, so is a (struct socket *), + * level is an indication of which protocol layer the option is intended. + * optname is a protocol dependent socket option request, + * optval is a pointer to a mbuf-chain pointer, for value-return results. + * The protocol is responsible for disposal of the mbuf chain *optval + * if supplied, + * the caller is responsible for any space held by *optval, when returned. + * A non-zero return from usrreq gives an + * UNIX error number which should be passed to higher level software. + */ +#define x_PRCO_GETOPT 0 +#define x_PRCO_SETOPT 1 + +#define x_PRCO_NCMDS 2 + +#ifdef x_PRCOREQUESTS +char *x_prcorequests[] = { + "GETOPT", "SETOPT", +}; +#endif + +#ifdef x_KERNEL +/*extern struct protosw *pffindproto(), *pffindtype();*/ +#endif + +#endif diff --git a/x_include/sys/x_ptrace.h b/x_include/sys/x_ptrace.h new file mode 100644 index 0000000..ea5772f --- /dev/null +++ b/x_include/sys/x_ptrace.h @@ -0,0 +1,43 @@ +#include "x_.h" + +#ifndef x__SYS_PTRACE_H_ +#define x__SYS_PTRACE_H_ + +/* + * Copyright (c) 1980, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ptrace.h 7.1 (Berkeley) 6/4/86 + */ + +/*#ifndef _PTRACE_*/ +/*#define _PTRACE_*/ + +#define x_PT_TRACE_ME 0 /* child declares it's being traced */ +#define x_PT_READ_I 1 /* read word in child's I space */ +#define x_PT_READ_D 2 /* read word in child's D space */ +#define x_PT_READ_U 3 /* read word in child's user structure */ +#define x_PT_WRITE_I 4 /* write word in child's I space */ +#define x_PT_WRITE_D 5 /* write word in child's D space */ +#define x_PT_WRITE_U 6 /* write word in child's user structure */ +#define x_PT_CONTINUE 7 /* continue the child */ +#define x_PT_KILL 8 /* kill the child process */ +#define x_PT_STEP 9 /* single step the child */ + +/*#endif*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* sys/ptrace.c */ +x_int x_ptrace __P((x_int x_r, x_int x_p, x_int *x_a, x_int x_d)); +#endif + +#endif diff --git a/x_include/sys/x_quota.h b/x_include/sys/x_quota.h new file mode 100644 index 0000000..53a4dc9 --- /dev/null +++ b/x_include/sys/x_quota.h @@ -0,0 +1,170 @@ +#include "x_.h" + +#ifndef x__SYS_QUOTA_H_ +#define x__SYS_QUOTA_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)quota.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * MELBOURNE DISC QUOTAS + * + * Various junk to do with various quotas (etc) imposed upon + * the average user (big brother finally hits UNIX). + * + * The following structure exists in core for each logged on user. + * It contains global junk relevant to that user's quotas. + * + * The u_quota field of each user struct contains a pointer to + * the quota struct relevant to the current process, this is changed + * by 'setuid' sys call, &/or by the Q_SETUID quota() call. + */ +struct x_quota { + struct x_quota *x_q_forw, *x_q_back; /* hash chain, MUST be first */ + x_short x_q_cnt; /* ref count (# processes) */ + x_uid_t x_q_uid; /* real uid of owner */ + x_int x_q_flags; /* struct management flags */ +#define x_Q_LOCK 0x01 /* quota struct locked (for disc i/o) */ +#define x_Q_WANT 0x02 /* issue a wakeup when lock goes off */ +#define x_Q_NEW 0x04 /* new quota - no proc1 msg sent yet */ +#define x_Q_NDQ 0x08 /* account has NO disc quota */ + struct x_quota *x_q_freef, **x_q_freeb; + struct x_dquot *x_q_dq[x_NMOUNT]; /* disc quotas for mounted filesys's */ +}; + +#define x_NOQUOTA ((struct x_quota *) 0) + +#if defined(x_KERNEL) && defined(x_QUOTA) +struct x_quota *x_quota, *x_quotaNQUOTA; +x_int x_nquota; +/*struct quota *getquota(), *qfind();*/ +#endif + +/* + * The following structure defines the format of the disc quota file + * (as it appears on disc) - the file is an array of these structures + * indexed by user number. The setquota sys call establishes the inode + * for each quota file (a pointer is retained in the mount structure). + * + * The following constants define the number of warnings given a user + * before the soft limits are treated as hard limits (usually resulting + * in an allocation failure). The warnings are normally manipulated + * each time a user logs in through the Q_DOWARN quota call. If + * the user logs in and is under the soft limit the warning count + * is reset to MAX_*_WARN, otherwise a message is printed and the + * warning count is decremented. This makes MAX_*_WARN equivalent to + * the number of logins before soft limits are treated as hard limits. + */ +#define x_MAX_IQ_WARN 3 +#define x_MAX_DQ_WARN 3 + +struct x_dqblk { + x_u_long x_dqb_bhardlimit; /* absolute limit on disc blks alloc */ + x_u_long x_dqb_bsoftlimit; /* preferred limit on disc blks */ + x_u_long x_dqb_curblocks; /* current block count */ + x_u_short x_dqb_ihardlimit; /* maximum # allocated inodes + 1 */ + x_u_short x_dqb_isoftlimit; /* preferred inode limit */ + x_u_short x_dqb_curinodes; /* current # allocated inodes */ + x_u_char x_dqb_bwarn; /* # warnings left about excessive disc use */ + x_u_char x_dqb_iwarn; /* # warnings left about excessive inodes */ +}; + +/* + * The following structure records disc usage for a user on a filesystem. + * There is one allocated for each quota that exists on any filesystem + * for the current user. A cache is kept of other recently used entries. + */ +struct x_dquot { + struct x_dquot *x_dq_forw, *x_dq_back;/* MUST be first entry */ + union { + struct x_quota *x_Dq_own; /* the quota that points to this */ + struct { /* free list */ + struct x_dquot *x_Dq_freef, **x_Dq_freeb; + } x_dq_f; + } x_dq_u; + x_short x_dq_flags; +#define x_DQ_LOCK 0x01 /* this quota locked (no MODS) */ +#define x_DQ_WANT 0x02 /* wakeup on unlock */ +#define x_DQ_MOD 0x04 /* this quota modified since read */ +#define x_DQ_FAKE 0x08 /* no limits here, just usage */ +#define x_DQ_BLKS 0x10 /* has been warned about blk limit */ +#define x_DQ_INODS 0x20 /* has been warned about inode limit */ + x_short x_dq_cnt; /* count of active references */ + x_uid_t x_dq_uid; /* user this applies to */ + x_dev_t x_dq_dev; /* filesystem this relates to */ + struct x_dqblk x_dq_dqb; /* actual usage & quotas */ +}; + +#define x_dq_own x_dq_u.x_Dq_own +#define x_dq_freef x_dq_u.x_dq_f.x_Dq_freef +#define x_dq_freeb x_dq_u.x_dq_f.x_Dq_freeb +#define x_dq_bhardlimit x_dq_dqb.x_dqb_bhardlimit +#define x_dq_bsoftlimit x_dq_dqb.x_dqb_bsoftlimit +#define x_dq_curblocks x_dq_dqb.x_dqb_curblocks +#define x_dq_ihardlimit x_dq_dqb.x_dqb_ihardlimit +#define x_dq_isoftlimit x_dq_dqb.x_dqb_isoftlimit +#define x_dq_curinodes x_dq_dqb.x_dqb_curinodes +#define x_dq_bwarn x_dq_dqb.x_dqb_bwarn +#define x_dq_iwarn x_dq_dqb.x_dqb_iwarn + +#define x_NODQUOT ((struct x_dquot *) 0) +#define x_LOSTDQUOT ((struct x_dquot *) 1) + +#if defined(x_KERNEL) && defined(x_QUOTA) +struct x_dquot *x_dquot, *x_dquotNDQUOT; +x_int x_ndquot; +/*struct dquot *discquota(), *inoquota(), *dqalloc(), *dqp();*/ +#endif + +/* + * Definitions for the 'quota' system call. + */ +#define x_Q_SETDLIM 1 /* set disc limits & usage */ +#define x_Q_GETDLIM 2 /* get disc limits & usage */ +#define x_Q_SETDUSE 3 /* set disc usage only */ +#define x_Q_SYNC 4 /* update disc copy of quota usages */ +#define x_Q_SETUID 16 /* change proc to use quotas for uid */ +#define x_Q_SETWARN 25 /* alter inode/block warning counts */ +#define x_Q_DOWARN 26 /* warn user about excessive space/inodes */ + +/* + * Used in Q_SETDUSE. + */ +struct x_dqusage { + x_u_short x_du_curinodes; + x_u_long x_du_curblocks; +}; + +/* + * Used in Q_SETWARN. + */ +struct x_dqwarn { + x_u_char x_dw_bwarn; + x_u_char x_dw_iwarn; +}; + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* sys/quota.c */ +x_int x_quota __P((x_int x_c, x_int x_u, x_int x_a, char *x_ad)); + +/* sys/setquota.c */ +x_int x_setquota __P((char *x_s, char *x_f)); +#endif + +#endif diff --git a/x_include/sys/x_reboot.h b/x_include/sys/x_reboot.h new file mode 100644 index 0000000..3004c7e --- /dev/null +++ b/x_include/sys/x_reboot.h @@ -0,0 +1,49 @@ +#include "x_.h" + +#ifndef x__SYS_REBOOT_H_ +#define x__SYS_REBOOT_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)reboot.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Arguments to reboot system call. + * These are passed to boot program in r11, + * and on to init. + */ +#define x_RB_AUTOBOOT 0 /* flags for system auto-booting itself */ + +#define x_RB_ASKNAME 0x01 /* ask for file name to reboot from */ +#define x_RB_SINGLE 0x02 /* reboot to single user only */ +#define x_RB_NOSYNC 0x04 /* dont sync before reboot */ +#define x_RB_HALT 0x08 /* don't reboot, just halt */ +#define x_RB_INITNAME 0x10 /* name given for /etc/init */ +#define x_RB_DFLTROOT 0x20 /* use compiled-in rootdev */ + +#define x_RB_PANIC 0 /* reboot due to panic */ +#define x_RB_BOOT 1 /* reboot due to boot() */ + +/* + * Constants for converting boot-style device number to type, + * adaptor (uba, mba, etc), unit number and partition number. + * Type (== major device number) is in the low byte + * for backward compatibility. Except for that of the "magic + * number", each mask applies to the shifted value. + */ +#define x_B_ADAPTORSHIFT 24 +#define x_B_ADAPTORMASK 0x0f +#define x_B_UNITSHIFT 16 +#define x_B_UNITMASK 0xff +#define x_B_PARTITIONSHIFT 8 +#define x_B_PARTITIONMASK 0xff +#define x_B_TYPESHIFT 0 +#define x_B_TYPEMASK 0xff +#define x_B_MAGICMASK 0xf0000000 +#define x_B_DEVMAGIC 0xa0000000 + +#endif diff --git a/x_include/sys/x_resource.h b/x_include/sys/x_resource.h new file mode 100644 index 0000000..149b75a --- /dev/null +++ b/x_include/sys/x_resource.h @@ -0,0 +1,101 @@ +#include "x_.h" + +#ifndef x__SYS_RESOURCE_H_ +#define x__SYS_RESOURCE_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)resource.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Process priority specifications to get/setpriority. + */ +#define x_PRIO_MIN -20 +#define x_PRIO_MAX 20 + +#define x_PRIO_PROCESS 0 +#define x_PRIO_PGRP 1 +#define x_PRIO_USER 2 + +/* + * Resource utilization information. + */ + +#define x_RUSAGE_SELF 0 +#define x_RUSAGE_CHILDREN -1 + +struct x_rusage { + struct x_timeval x_ru_utime; /* user time used */ + struct x_timeval x_ru_stime; /* system time used */ + x_long x_ru_maxrss; +#define x_ru_first x_ru_ixrss + x_long x_ru_ixrss; /* integral shared memory size */ + x_long x_ru_idrss; /* integral unshared data " */ + x_long x_ru_isrss; /* integral unshared stack " */ + x_long x_ru_minflt; /* page reclaims */ + x_long x_ru_majflt; /* page faults */ + x_long x_ru_nswap; /* swaps */ + x_long x_ru_inblock; /* block input operations */ + x_long x_ru_oublock; /* block output operations */ + x_long x_ru_msgsnd; /* messages sent */ + x_long x_ru_msgrcv; /* messages received */ + x_long x_ru_nsignals; /* signals received */ + x_long x_ru_nvcsw; /* voluntary context switches */ + x_long x_ru_nivcsw; /* involuntary " */ +#define x_ru_last x_ru_nivcsw +}; + +/* + * Resource limits + */ +#define x_RLIMIT_CPU 0 /* cpu time in milliseconds */ +#define x_RLIMIT_FSIZE 1 /* maximum file size */ +#define x_RLIMIT_DATA 2 /* data size */ +#define x_RLIMIT_STACK 3 /* stack size */ +#define x_RLIMIT_CORE 4 /* core file size */ +#define x_RLIMIT_RSS 5 /* resident set size */ + +#define x_RLIM_NLIMITS 6 /* number of resource limits */ + +#define x_RLIM_INFINITY 0x7fffffff + +struct x_rlimit { + x_int x_rlim_cur; /* current (soft) limit */ + x_int x_rlim_max; /* maximum value for rlim_cur */ +}; + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* compat-4.1/nice.c */ +x_int x_nice __P((x_int x_incr)); + +/* sys/getpriority.c */ +x_int x_getpriority __P((x_int x_w, x_int x_who)); + +/* sys/getrlimit.c */ +x_int x_getrlimit __P((x_int x_res, struct x_rlimit *x_rip)); + +/* sys/getrusage.c */ +x_int x_getrusage __P((x_int x_res, struct x_rusage *x_rip)); + +/* sys/setpriority.c */ +x_int x_setpriority __P((x_int x_w, x_int x_who, x_int x_pri)); + +/* sys/setrlimit.c */ +x_int x_setrlimit __P((x_int x_res, struct x_rlimit *x_rip)); +#endif + +#endif diff --git a/x_include/sys/x_seg.h b/x_include/sys/x_seg.h new file mode 100644 index 0000000..30addb7 --- /dev/null +++ b/x_include/sys/x_seg.h @@ -0,0 +1,23 @@ +#include "x_.h" + +#ifndef x__SYS_SEG_H_ +#define x__SYS_SEG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)seg.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Mapper addresses and bits + */ + +#define x_RO x_PG_URKR /* access abilities */ +#define x_RW x_PG_UW + +#endif diff --git a/x_include/sys/x_select.h b/x_include/sys/x_select.h new file mode 100644 index 0000000..fa5bcbb --- /dev/null +++ b/x_include/sys/x_select.h @@ -0,0 +1,52 @@ +#include "x_.h" + +#ifndef x__SYS_SELECT_H_ +#define x__SYS_SELECT_H_ + +#include +#include +#include + +/*#include */ + +/* moved this from sys/types.h */ +/* + * Select uses bit masks of file descriptors in longs. + * These macros manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here + * should be >= NOFILE (param.h). + */ +#ifndef x_FD_SETSIZE +#define x_FD_SETSIZE 256 +#endif + +typedef x_long x_fd_mask; +#define x_NFDBITS (sizeof(x_fd_mask) * x_NBBY) /* bits per mask */ +/* this was duplicated in sys/param.h, get it from there */ +/*#ifndef howmany*/ +/*#define howmany(x, y) (((x)+((y)-1))/(y))*/ +/*#endif*/ + +typedef struct x_fd_set { + x_fd_mask x_fds_bits[x_howmany(x_FD_SETSIZE, x_NFDBITS)]; +} x_fd_set; + +#define x_FD_SET(x_n, x_p) ((x_p)->x_fds_bits[(x_n)/x_NFDBITS] |= (1 << ((x_n) % x_NFDBITS))) +#define x_FD_CLR(x_n, x_p) ((x_p)->x_fds_bits[(x_n)/x_NFDBITS] &= ~(1 << ((x_n) % x_NFDBITS))) +#define x_FD_ISSET(x_n, x_p) ((x_p)->x_fds_bits[(x_n)/x_NFDBITS] & (1 << ((x_n) % x_NFDBITS))) +#define x_FD_ZERO(x_p) x_bzero((char *)(x_p), sizeof(*(x_p))) + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* sys/select.c */ +x_int x_select __P((x_int x_n, x_fd_set *x_r, x_fd_set *x_w, x_fd_set *x_e, struct x_timeval *x_t)); +#endif + +#endif diff --git a/x_include/sys/x_signal.h b/x_include/sys/x_signal.h new file mode 100644 index 0000000..191a9f0 --- /dev/null +++ b/x_include/sys/x_signal.h @@ -0,0 +1,164 @@ +#include "x_.h" + +#ifndef x__SYS_SIGNAL_H_ +#define x__SYS_SIGNAL_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)signal.h 7.1 (Berkeley) 6/4/86 + */ + +#ifndef x_NSIG +#define x_NSIG 32 + +#define x_SIGHUP 1 /* hangup */ +#define x_SIGINT 2 /* interrupt */ +#define x_SIGQUIT 3 /* quit */ +#define x_SIGILL 4 /* illegal instruction (not reset when caught) */ +#define x_ILL_RESAD_FAULT 0x0 /* reserved addressing fault */ +#define x_ILL_PRIVIN_FAULT 0x1 /* privileged instruction fault */ +#define x_ILL_RESOP_FAULT 0x2 /* reserved operand fault */ +/* CHME, CHMS, CHMU are not yet given back to users reasonably */ +#define x_SIGTRAP 5 /* trace trap (not reset when caught) */ +#define x_SIGIOT 6 /* IOT instruction */ +#define x_SIGABRT x_SIGIOT /* compatibility */ +#define x_SIGEMT 7 /* EMT instruction */ +#define x_SIGFPE 8 /* floating point exception */ +#define x_FPE_INTOVF_TRAP 0x1 /* integer overflow */ +#define x_FPE_INTDIV_TRAP 0x2 /* integer divide by zero */ +#define x_FPE_FLTOVF_TRAP 0x3 /* floating overflow */ +#define x_FPE_FLTDIV_TRAP 0x4 /* floating/decimal divide by zero */ +#define x_FPE_FLTUND_TRAP 0x5 /* floating underflow */ +#define x_FPE_DECOVF_TRAP 0x6 /* decimal overflow */ +#define x_FPE_SUBRNG_TRAP 0x7 /* subscript out of range */ +#define x_FPE_FLTOVF_FAULT 0x8 /* floating overflow fault */ +#define x_FPE_FLTDIV_FAULT 0x9 /* divide by zero floating fault */ +#define x_FPE_FLTUND_FAULT 0xa /* floating underflow fault */ +#define x_SIGKILL 9 /* kill (cannot be caught or ignored) */ +#define x_SIGBUS 10 /* bus error */ +#define x_SIGSEGV 11 /* segmentation violation */ +#define x_SIGSYS 12 /* bad argument to system call */ +#define x_SIGPIPE 13 /* write on a pipe with no one to read it */ +#define x_SIGALRM 14 /* alarm clock */ +#define x_SIGTERM 15 /* software termination signal from kill */ +#define x_SIGURG 16 /* urgent condition on IO channel */ +#define x_SIGSTOP 17 /* sendable stop signal not from tty */ +#define x_SIGTSTP 18 /* stop signal from tty */ +#define x_SIGCONT 19 /* continue a stopped process */ +#define x_SIGCHLD 20 /* to parent on child stop or exit */ +#define x_SIGCLD x_SIGCHLD /* compatibility */ +#define x_SIGTTIN 21 /* to readers pgrp upon background tty read */ +#define x_SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ +#define x_SIGIO 23 /* input/output possible signal */ +#define x_SIGXCPU 24 /* exceeded CPU time limit */ +#define x_SIGXFSZ 25 /* exceeded file size limit */ +#define x_SIGVTALRM 26 /* virtual time alarm */ +#define x_SIGPROF 27 /* profiling time alarm */ +#define x_SIGWINCH 28 /* window size changes */ +#define x_SIGUSR1 30 /* user defined signal 1 */ +#define x_SIGUSR2 31 /* user defined signal 2 */ + +#ifndef x_KERNEL +x_int (*x_signal())(); +#endif + +/* + * Signal vector "template" used in sigvec call. + */ +struct x_sigvec { + x_int (*x_sv_handler)(); /* signal handler */ + x_int x_sv_mask; /* signal mask to apply */ + x_int x_sv_flags; /* see signal options below */ +}; +#define x_SV_ONSTACK 0x0001 /* take signal on signal stack */ +#define x_SV_INTERRUPT 0x0002 /* do not restart system on signal return */ +#define x_sv_onstack x_sv_flags /* isn't compatibility wonderful! */ + +/* + * Structure used in sigstack call. + */ +struct x_sigstack { + char *x_ss_sp; /* signal stack pointer */ + x_int x_ss_onstack; /* current status */ +}; + +/* + * 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 properly restore state if + * a non-standard exit is performed. + */ +struct x_sigcontext { + x_int x_sc_onstack; /* sigstack state to restore */ + x_int x_sc_mask; /* signal mask to restore */ + x_int x_sc_sp; /* sp to restore */ + x_int x_sc_fp; /* fp to restore */ + x_int x_sc_ap; /* ap to restore */ + x_int x_sc_pc; /* pc to restore */ + x_int x_sc_ps; /* psl to restore */ +}; + +#define x_BADSIG (x_int (*)())-1 +#define x_SIG_DFL (x_int (*)())0 +#define x_SIG_IGN (x_int (*)())1 + +#ifdef x_KERNEL +#define x_SIG_CATCH (x_int (*)())2 +#define x_SIG_HOLD (x_int (*)())3 +#endif +#endif + +/* + * Macro for converting signal number to a mask suitable for + * sigblock(). + */ +#define x_sigmask(x_m) (1 << ((x_m)-1)) + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/psignal.c */ +x_int x_psignal __P((x_unsigned_int x_sig, char *x_s)); + +/* gen/siginterrupt.c */ +x_int x_siginterrupt __P((x_int x_sig, x_int x_flag)); + +/* gen/signal.c */ +x_int (*x_signal __P((x_int x_s, x_int (*x_a)(void)))) __P((void)); + +/* sys/kill.c */ +x_int x_kill __P((x_int x_p, x_int x_s)); + +/* sys/killpg.c */ +x_int x_killpg __P((x_int x_pg, x_int x_s)); + +/* sys/sigblock.c */ +x_int x_sigblock __P((x_int x_m)); + +/* sys/sigpause.c */ +void x_sigpause __P((x_int x_m)); + +/* sys/sigreturn.c */ +x_int x_sigreturn __P((struct x_sigcontext *x_scp)); + +/* sys/sigsetmask.c */ +x_int x_sigsetmask __P((x_int x_m)); + +/* sys/sigstack.c */ +x_int x_sigstack __P((struct x_sigstack *x_ss, struct x_sigstack *x_oss)); + +/* sys/sigvec.c */ +x_int x_sigvec __P((x_int x_c, struct x_sigvec *x_f, struct x_sigvec *x_m)); +#endif + +#endif diff --git a/x_include/sys/x_socket.h b/x_include/sys/x_socket.h new file mode 100644 index 0000000..6ef58cd --- /dev/null +++ b/x_include/sys/x_socket.h @@ -0,0 +1,212 @@ +#include "x_.h" + +#ifndef x__SYS_SOCKET_H_ +#define x__SYS_SOCKET_H_ + +#include + +/* + * Copyright (c) 1982,1985, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)socket.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Definitions related to sockets: types, address families, options. + */ + +/* + * Types + */ +#define x_SOCK_STREAM 1 /* stream socket */ +#define x_SOCK_DGRAM 2 /* datagram socket */ +#define x_SOCK_RAW 3 /* raw-protocol interface */ +#define x_SOCK_RDM 4 /* reliably-delivered message */ +#define x_SOCK_SEQPACKET 5 /* sequenced packet stream */ + +/* + * Option flags per-socket. + */ +#define x_SO_DEBUG 0x0001 /* turn on debugging info recording */ +#define x_SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define x_SO_REUSEADDR 0x0004 /* allow local address reuse */ +#define x_SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define x_SO_DONTROUTE 0x0010 /* just use interface addresses */ +#define x_SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ +#define x_SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ +#define x_SO_LINGER 0x0080 /* linger on close if data present */ +#define x_SO_OOBINLINE 0x0100 /* leave received OOB data in line */ + +/* + * Additional options, not kept in so_options. + */ +#define x_SO_SNDBUF 0x1001 /* send buffer size */ +#define x_SO_RCVBUF 0x1002 /* receive buffer size */ +#define x_SO_SNDLOWAT 0x1003 /* send low-water mark */ +#define x_SO_RCVLOWAT 0x1004 /* receive low-water mark */ +#define x_SO_SNDTIMEO 0x1005 /* send timeout */ +#define x_SO_RCVTIMEO 0x1006 /* receive timeout */ +#define x_SO_ERROR 0x1007 /* get error status and clear */ +#define x_SO_TYPE 0x1008 /* get socket type */ + +/* + * Structure used for manipulating linger option. + */ +struct x_linger { + x_int x_l_onoff; /* option on/off */ + x_int x_l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define x_SOL_SOCKET 0xffff /* options for socket level */ + +/* + * Address families. + */ +#define x_AF_UNSPEC 0 /* unspecified */ +#define x_AF_UNIX 1 /* local to host (pipes, portals) */ +#define x_AF_INET 2 /* internetwork: UDP, TCP, etc. */ +#define x_AF_IMPLINK 3 /* arpanet imp addresses */ +#define x_AF_PUP 4 /* pup protocols: e.g. BSP */ +#define x_AF_CHAOS 5 /* mit CHAOS protocols */ +#define x_AF_NS 6 /* XEROX NS protocols */ +#define x_AF_NBS 7 /* nbs protocols */ +#define x_AF_ECMA 8 /* european computer manufacturers */ +#define x_AF_DATAKIT 9 /* datakit protocols */ +#define x_AF_CCITT 10 /* CCITT protocols, X.25 etc */ +#define x_AF_SNA 11 /* IBM SNA */ +#define x_AF_DECnet 12 /* DECnet */ +#define x_AF_DLI 13 /* Direct data link interface */ +#define x_AF_LAT 14 /* LAT */ +#define x_AF_HYLINK 15 /* NSC Hyperchannel */ +#define x_AF_APPLETALK 16 /* Apple Talk */ + +#define x_AF_MAX 17 + +/* + * Structure used by kernel to store most + * addresses. + */ +struct x_sockaddr { + x_u_short x_sa_family; /* address family */ + char x_sa_data[14]; /* up to 14 bytes of direct address */ +}; + +/* + * Structure used by kernel to pass protocol + * information in raw sockets. + */ +struct x_sockproto { + x_u_short x_sp_family; /* address family */ + x_u_short x_sp_protocol; /* protocol */ +}; + +/* + * Protocol families, same as address families for now. + */ +#define x_PF_UNSPEC x_AF_UNSPEC +#define x_PF_UNIX x_AF_UNIX +#define x_PF_INET x_AF_INET +#define x_PF_IMPLINK x_AF_IMPLINK +#define x_PF_PUP x_AF_PUP +#define x_PF_CHAOS x_AF_CHAOS +#define x_PF_NS x_AF_NS +#define x_PF_NBS x_AF_NBS +#define x_PF_ECMA x_AF_ECMA +#define x_PF_DATAKIT x_AF_DATAKIT +#define x_PF_CCITT x_AF_CCITT +#define x_PF_SNA x_AF_SNA +#define x_PF_DECnet x_AF_DECnet +#define x_PF_DLI x_AF_DLI +#define x_PF_LAT x_AF_LAT +#define x_PF_HYLINK x_AF_HYLINK +#define x_PF_APPLETALK x_AF_APPLETALK + +#define x_PF_MAX x_AF_MAX + +/* + * Maximum queue length specifiable by listen. + */ +#define x_SOMAXCONN 5 + +/* + * Message header for recvmsg and sendmsg calls. + */ +struct x_msghdr { + x_caddr_t x_msg_name; /* optional address */ + x_int x_msg_namelen; /* size of address */ + struct x_iovec *x_msg_iov; /* scatter/gather array */ + x_int x_msg_iovlen; /* # elements in msg_iov */ + x_caddr_t x_msg_accrights; /* access rights sent/received */ + x_int x_msg_accrightslen; +}; + +#define x_MSG_OOB 0x1 /* process out-of-band data */ +#define x_MSG_PEEK 0x2 /* peek at incoming message */ +#define x_MSG_DONTROUTE 0x4 /* send without using routing tables */ + +#define x_MSG_MAXIOVLEN 16 + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* sys/accept.c */ +x_int x_accept __P((x_int x_s, struct x_sockaddr *x_a, x_int *x_l)); + +/* sys/bind.c */ +x_int x_bind __P((x_int x_s, struct x_sockaddr *x_n, x_int x_l)); + +/* sys/connect.c */ +x_int x_connect __P((x_int x_s, struct x_sockaddr *x_n, x_int x_l)); + +/* sys/getpeername.c */ +x_int x_getpeername __P((x_int x_s, struct x_sockaddr *x_n, x_int *x_l)); + +/* sys/getsockname.c */ +x_int x_getsockname __P((x_int x_s, char *x_name, x_int *x_namelen)); + +/* sys/getsockopt.c */ +x_int x_getsockopt __P((x_int x_s, x_int x_level, x_int x_opt, char *x_buf, x_int *x_len)); + +/* sys/listen.c */ +x_int x_listen __P((x_int x_s, x_int x_b)); + +/* sys/recv.c */ +x_int x_recv __P((x_int x_s, char *x_b, x_int x_l, x_int x_f)); + +/* sys/recvfrom.c */ +x_int x_recvfrom __P((x_int x_s, char *x_b, x_int x_l, x_int x_f, struct x_sockaddr *x_fr, x_int *x_fl)); + +/* sys/recvmsg.c */ +x_int x_recvmsg __P((x_int x_s, struct x_msghdr x_m[], x_int x_f)); + +/* sys/send.c */ +x_int x_send __P((x_int x_s, char *x_m, x_int x_l, x_int x_f)); + +/* sys/sendmsg.c */ +x_int x_sendmsg __P((x_int x_s, struct x_msghdr x_m[], x_int x_l)); + +/* sys/sendto.c */ +x_int x_sendto __P((x_int x_s, char *x_m, x_int x_l, x_int x_f, struct x_sockaddr *x_t, x_int x_tl)); + +/* sys/setsockopt.c */ +x_int x_setsockopt __P((x_int x_s, x_int x_level, x_int x_opt, char *x_buf, x_int x_len)); + +/* sys/socket.c */ +x_int x_socket __P((x_int x_a, x_int x_t, x_int x_p)); + +/* sys/socketpair.c */ +x_int x_socketpair __P((x_int x_d, x_int x_t, x_int x_p, x_int x_s[2])); +#endif + +#endif diff --git a/x_include/sys/x_socketvar.h b/x_include/sys/x_socketvar.h new file mode 100644 index 0000000..c54720a --- /dev/null +++ b/x_include/sys/x_socketvar.h @@ -0,0 +1,158 @@ +#include "x_.h" + +#ifndef x__SYS_SOCKETVAR_H_ +#define x__SYS_SOCKETVAR_H_ + +#include +#include +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)socketvar.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Kernel structure per socket. + * Contains send and receive buffer queues, + * handle on protocol and pointer to protocol + * private data and error information. + */ +struct x_socket { + x_short x_so_type; /* generic type, see socket.h */ + x_short x_so_options; /* from socket call, see socket.h */ + x_short x_so_linger; /* time to linger while closing */ + x_short x_so_state; /* internal state flags SS_*, below */ + x_caddr_t x_so_pcb; /* protocol control block */ + struct x_protosw *x_so_proto; /* protocol handle */ +/* + * Variables for connection queueing. + * Socket where accepts occur is so_head in all subsidiary sockets. + * If so_head is 0, socket is not related to an accept. + * For head socket so_q0 queues partially completed connections, + * while so_q is a queue of connections ready to be accepted. + * If a connection is aborted and it has so_head set, then + * it has to be pulled out of either so_q0 or so_q. + * We allow connections to queue up based on current queue lengths + * and limit on number of queued connections for this socket. + */ + struct x_socket *x_so_head; /* back pointer to accept socket */ + struct x_socket *x_so_q0; /* queue of partial connections */ + x_short x_so_q0len; /* partials on so_q0 */ + struct x_socket *x_so_q; /* queue of incoming connections */ + x_short x_so_qlen; /* number of connections on so_q */ + x_short x_so_qlimit; /* max number queued connections */ +/* + * Variables for socket buffering. + */ + struct x_sockbuf { + x_u_short x_sb_cc; /* actual chars in buffer */ + x_u_short x_sb_hiwat; /* max actual char count */ + x_u_short x_sb_mbcnt; /* chars of mbufs used */ + x_u_short x_sb_mbmax; /* max chars of mbufs to use */ + x_u_short x_sb_lowat; /* low water mark (not used yet) */ + x_short x_sb_timeo; /* timeout (not used yet) */ + struct x_mbuf *x_sb_mb; /* the mbuf chain */ + struct x_proc *x_sb_sel; /* process selecting read/write */ + x_short x_sb_flags; /* flags, see below */ + } x_so_rcv, x_so_snd; +#define x_SB_MAX 65535 /* max chars in sockbuf */ +#define x_SB_LOCK 0x01 /* lock on data queue (so_rcv only) */ +#define x_SB_WANT 0x02 /* someone is waiting to lock */ +#define x_SB_WAIT 0x04 /* someone is waiting for data/space */ +#define x_SB_SEL 0x08 /* buffer is selected */ +#define x_SB_COLL 0x10 /* collision selecting */ + x_short x_so_timeo; /* connection timeout */ + x_u_short x_so_error; /* error affecting connection */ + x_u_short x_so_oobmark; /* chars to oob mark */ + x_short x_so_pgrp; /* pgrp for signals */ +}; + +/* + * Socket state bits. + */ +#define x_SS_NOFDREF 0x001 /* no file table ref any more */ +#define x_SS_ISCONNECTED 0x002 /* socket connected to a peer */ +#define x_SS_ISCONNECTING 0x004 /* in process of connecting to peer */ +#define x_SS_ISDISCONNECTING 0x008 /* in process of disconnecting */ +#define x_SS_CANTSENDMORE 0x010 /* can't send more data to peer */ +#define x_SS_CANTRCVMORE 0x020 /* can't receive more data from peer */ +#define x_SS_RCVATMARK 0x040 /* at mark on input */ + +#define x_SS_PRIV 0x080 /* privileged for broadcast, raw... */ +#define x_SS_NBIO 0x100 /* non-blocking ops */ +#define x_SS_ASYNC 0x200 /* async i/o notify */ + +/* + * Macros for sockets and socket buffering. + */ + +/* how much space is there in a socket buffer (so->so_snd or so->so_rcv) */ +#define x_sbspace(x_sb) \ + (x_MIN((x_int)((x_sb)->x_sb_hiwat - (x_sb)->x_sb_cc),\ + (x_int)((x_sb)->x_sb_mbmax - (x_sb)->x_sb_mbcnt))) + +/* do we have to send all at once on a socket? */ +#define x_sosendallatonce(x_so) \ + ((x_so)->x_so_proto->x_pr_flags & x_PR_ATOMIC) + +/* can we read something from so? */ +#define x_soreadable(x_so) \ + ((x_so)->x_so_rcv.x_sb_cc || ((x_so)->x_so_state & x_SS_CANTRCVMORE) || \ + (x_so)->x_so_qlen || (x_so)->x_so_error) + +/* can we write something to so? */ +#define x_sowriteable(x_so) \ + (x_sbspace(&(x_so)->x_so_snd) > 0 && \ + (((x_so)->x_so_state&x_SS_ISCONNECTED) || \ + ((x_so)->x_so_proto->x_pr_flags&x_PR_CONNREQUIRED)==0) || \ + ((x_so)->x_so_state & x_SS_CANTSENDMORE) || \ + (x_so)->x_so_error) + +/* adjust counters in sb reflecting allocation of m */ +#define x_sballoc(x_sb, x_m) { \ + (x_sb)->x_sb_cc += (x_m)->x_m_len; \ + (x_sb)->x_sb_mbcnt += x_MSIZE; \ + if ((x_m)->x_m_off > x_MMAXOFF) \ + (x_sb)->x_sb_mbcnt += x_CLBYTES; \ +} + +/* adjust counters in sb reflecting freeing of m */ +#define x_sbfree(x_sb, x_m) { \ + (x_sb)->x_sb_cc -= (x_m)->x_m_len; \ + (x_sb)->x_sb_mbcnt -= x_MSIZE; \ + if ((x_m)->x_m_off > x_MMAXOFF) \ + (x_sb)->x_sb_mbcnt -= x_CLBYTES; \ +} + +/* set lock on sockbuf sb */ +#define x_sblock(x_sb) { \ + while ((x_sb)->x_sb_flags & x_SB_LOCK) { \ + (x_sb)->x_sb_flags |= x_SB_WANT; \ + x_sleep((x_caddr_t)&(x_sb)->x_sb_flags, x_PZERO+1); \ + } \ + (x_sb)->x_sb_flags |= x_SB_LOCK; \ +} + +/* release lock on sockbuf sb */ +#define x_sbunlock(x_sb) { \ + (x_sb)->x_sb_flags &= ~x_SB_LOCK; \ + if ((x_sb)->x_sb_flags & x_SB_WANT) { \ + (x_sb)->x_sb_flags &= ~x_SB_WANT; \ + x_wakeup((x_caddr_t)&(x_sb)->x_sb_flags); \ + } \ +} + +#define x_sorwakeup(x_so) x_sowakeup((x_so), &(x_so)->x_so_rcv) +#define x_sowwakeup(x_so) x_sowakeup((x_so), &(x_so)->x_so_snd) + +#ifdef x_KERNEL +/*struct socket *sonewconn();*/ +#endif + +#endif diff --git a/x_include/sys/x_stat.h b/x_include/sys/x_stat.h new file mode 100644 index 0000000..13a1223 --- /dev/null +++ b/x_include/sys/x_stat.h @@ -0,0 +1,69 @@ +#include "x_.h" + +#ifndef x__SYS_STAT_H_ +#define x__SYS_STAT_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)stat.h 7.1 (Berkeley) 6/4/86 + */ + +struct x_stat { + x_dev_t x_st_dev; + x_ino_t x_st_ino; + x_unsigned_short x_st_mode; + x_short x_st_nlink; + x_uid_t x_st_uid; + x_gid_t x_st_gid; + x_dev_t x_st_rdev; + x_off_t x_st_size; + x_time_t x_st_atime; + x_int x_st_spare1; + x_time_t x_st_mtime; + x_int x_st_spare2; + x_time_t x_st_ctime; + x_int x_st_spare3; + x_long x_st_blksize; + x_long x_st_blocks; + x_long x_st_spare4[2]; +}; + +#define x_S_IFMT 0170000 /* type of file */ +#define x_S_IFDIR 0040000 /* directory */ +#define x_S_IFCHR 0020000 /* character special */ +#define x_S_IFBLK 0060000 /* block special */ +#define x_S_IFREG 0100000 /* regular */ +#define x_S_IFLNK 0120000 /* symbolic link */ +#define x_S_IFSOCK 0140000/* socket */ +#define x_S_ISUID 0004000 /* set user id on execution */ +#define x_S_ISGID 0002000 /* set group id on execution */ +#define x_S_ISVTX 0001000 /* save swapped text even after use */ +#define x_S_IREAD 0000400 /* read permission, owner */ +#define x_S_IWRITE 0000200 /* write permission, owner */ +#define x_S_IEXEC 0000100 /* execute/search permission, owner */ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* sys/fstat.c */ +x_int x_fstat __P((x_int x_f, struct x_stat *x_b)); + +/* sys/lstat.c */ +x_int x_lstat __P((char *x_s, struct x_stat *x_b)); + +/* sys/stat.c */ +x_int x_stat __P((char *x_s, struct x_stat *x_b)); +#endif + +#endif diff --git a/x_include/sys/x_syslog.h b/x_include/sys/x_syslog.h new file mode 100644 index 0000000..7d5e271 --- /dev/null +++ b/x_include/sys/x_syslog.h @@ -0,0 +1,87 @@ +#include "x_.h" + +#ifndef x__SYS_SYSLOG_H_ +#define x__SYS_SYSLOG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)syslog.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Facility codes + */ + +#define x_LOG_KERN (0<<3) /* kernel messages */ +#define x_LOG_USER (1<<3) /* random user-level messages */ +#define x_LOG_MAIL (2<<3) /* mail system */ +#define x_LOG_DAEMON (3<<3) /* system daemons */ +#define x_LOG_AUTH (4<<3) /* security/authorization messages */ +#define x_LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ +#define x_LOG_LPR (6<<3) /* line printer subsystem */ + /* other codes through 15 reserved for system use */ +#define x_LOG_LOCAL0 (16<<3) /* reserved for local use */ +#define x_LOG_LOCAL1 (17<<3) /* reserved for local use */ +#define x_LOG_LOCAL2 (18<<3) /* reserved for local use */ +#define x_LOG_LOCAL3 (19<<3) /* reserved for local use */ +#define x_LOG_LOCAL4 (20<<3) /* reserved for local use */ +#define x_LOG_LOCAL5 (21<<3) /* reserved for local use */ +#define x_LOG_LOCAL6 (22<<3) /* reserved for local use */ +#define x_LOG_LOCAL7 (23<<3) /* reserved for local use */ + +#define x_LOG_NFACILITIES 24 /* maximum number of facilities */ +#define x_LOG_FACMASK 0x03f8 /* mask to extract facility part */ + +/* + * Priorities (these are ordered) + */ + +#define x_LOG_EMERG 0 /* system is unusable */ +#define x_LOG_ALERT 1 /* action must be taken immediately */ +#define x_LOG_CRIT 2 /* critical conditions */ +#define x_LOG_ERR 3 /* error conditions */ +#define x_LOG_WARNING 4 /* warning conditions */ +#define x_LOG_NOTICE 5 /* normal but signification condition */ +#define x_LOG_INFO 6 /* informational */ +#define x_LOG_DEBUG 7 /* debug-level messages */ + +#define x_LOG_PRIMASK 0x0007 /* mask to extract priority part (internal) */ + +/* + * arguments to setlogmask. + */ +#define x_LOG_MASK(x_pri) (1 << (x_pri)) /* mask for one priority */ +#define x_LOG_UPTO(x_pri) ((1 << ((x_pri)+1)) - 1) /* all priorities through pri */ + +/* + * Option flags for openlog. + * + * LOG_ODELAY no longer does anything; LOG_NDELAY is the + * inverse of what it used to be. + */ +#define x_LOG_PID 0x01 /* log the pid with each message */ +#define x_LOG_CONS 0x02 /* log on the console if errors in sending */ +#define x_LOG_ODELAY 0x04 /* delay open until syslog() is called */ +#define x_LOG_NDELAY 0x08 /* don't delay open */ +#define x_LOG_NOWAIT 0x10 /* if forking to log on console, don't wait() */ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/syslog.c */ +x_int x_syslog __P((x_int x_pri, char *x_fmt, x_int x_p0, x_int x_p1, x_int x_p2, x_int x_p3, x_int x_p4)); +x_int x_openlog __P((char *x_ident, x_int x_logstat, x_int x_logfac)); +x_int x_closelog __P((void)); +x_int x_setlogmask __P((x_int x_pmask)); +#endif + +#endif diff --git a/x_include/sys/x_systm.h b/x_include/sys/x_systm.h new file mode 100644 index 0000000..fc9124e --- /dev/null +++ b/x_include/sys/x_systm.h @@ -0,0 +1,93 @@ +#include "x_.h" + +#ifndef x__SYS_SYSTM_H_ +#define x__SYS_SYSTM_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)systm.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Random set of variables + * used by more than one + * routine. + */ +extern char x_version[]; /* system version */ + +/* + * Nblkdev is the number of entries + * (rows) in the block switch. It is + * set in binit/bio.c by making + * a pass over the switch. + * Used in bounds checking on major + * device numbers. + */ +x_int x_nblkdev; + +/* + * Number of character switch entries. + * Set by cinit/prim.c + */ +x_int x_nchrdev; + +x_int x_nswdev; /* number of swap devices */ +x_int x_mpid; /* generic for unique process id's */ +char x_runin; /* scheduling flag */ +char x_runout; /* scheduling flag */ +x_int x_runrun; /* scheduling flag */ +char x_kmapwnt; /* kernel map want flag */ +char x_curpri; /* more scheduling */ + +x_int x_maxmem; /* actual max memory per process */ +x_int x_physmem; /* physical memory on this CPU */ + +x_int x_nswap; /* size of swap space */ +x_int x_updlock; /* lock for sync */ +x_daddr_t x_rablock; /* block to be read ahead */ +x_int x_rasize; /* size of block in rablock */ +extern x_int x_intstack[]; /* stack for interrupts */ +x_dev_t x_rootdev; /* device of the root */ +x_dev_t x_dumpdev; /* device to take dumps on */ +x_long x_dumplo; /* offset into dumpdev */ +x_dev_t x_swapdev; /* swapping device */ +x_dev_t x_argdev; /* device for argument lists */ + +#ifdef x_vax +extern x_int x_icode[]; /* user init code */ +extern x_int x_szicode; /* its size */ +#endif + +/*daddr_t bmap();*/ +/*caddr_t calloc();*/ +/*int memall();*/ +/*int vmemall();*/ +/*caddr_t wmemall();*/ +/*swblk_t vtod();*/ + +/* + * Structure of the system-entry table + */ +extern struct x_sysent { + x_int x_sy_narg; /* total number of arguments */ + x_int (*x_sy_call)(); /* handler */ +} x_sysent[]; + +x_int x_noproc; /* no one is running just now */ +char *x_panicstr; +x_int x_wantin; +x_int x_boothowto; /* reboot flags, from console subsystem */ +x_int x_selwait; + +extern char x_vmmap[]; /* poor name! */ + +/* casts to keep lint happy */ +#define x_insque(x_q,x_p) x__insque((x_caddr_t)x_q,(x_caddr_t)x_p) +#define x_remque(x_q) x__remque((x_caddr_t)x_q) + +#endif diff --git a/x_include/sys/x_tablet.h b/x_include/sys/x_tablet.h new file mode 100644 index 0000000..a56c83d --- /dev/null +++ b/x_include/sys/x_tablet.h @@ -0,0 +1,76 @@ +#include "x_.h" + +#ifndef x__SYS_TABLET_H_ +#define x__SYS_TABLET_H_ + +#include + +/* + * Copyright (c) 1985, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)tablet.h 7.1 (Berkeley) 6/4/86 + */ + +/*#ifndef _TABLET_*/ +/* + * Tablet line discipline. + */ +#ifdef x_KERNEL +#include "../h/x_ioctl.h" +#else +#include +#endif + +/* + * Reads on the tablet return one of the following + * structures, depending on the underlying tablet type. + * The first two are defined such that a read of + * sizeof (gtcopos) on a non-gtco tablet will return + * meaningful info. The in-proximity bit is simulated + * where the tablet does not directly provide the information. + */ +struct x_tbpos { + x_int x_xpos, x_ypos; /* raw x-y coordinates */ + x_short x_status; /* buttons/pen down */ +#define x_TBINPROX 0100000 /* pen in proximity of tablet */ + x_short x_scount; /* sample count */ +}; + +struct x_gtcopos { + x_int x_xpos, x_ypos; /* raw x-y coordinates */ + x_short x_status; /* as above */ + x_short x_scount; /* sample count */ + x_short x_xtilt, x_ytilt; /* raw tilt */ + x_short x_pressure; + x_short x_pad; /* pad to longword boundary */ +}; + +struct x_polpos { + x_short x_p_x, x_p_y, x_p_z; /* raw 3-space coordinates */ + x_short x_p_azi, x_p_pit, x_p_rol; /* azimuth, pitch, and roll */ + x_short x_p_stat; /* status, as above */ + char x_p_key; /* calculator input keyboard */ +}; + +#define x_BIOSMODE x__IOW(x_b, 1, x_int) /* set mode bit(s) */ +#define x_BIOGMODE x__IOR(x_b, 2, x_int) /* get mode bit(s) */ +#define x_TBMODE 0xfff0 /* mode bits: */ +#define x_TBPOINT 0x0010 /* single point */ +#define x_TBRUN 0x0000 /* runs contin. */ +#define x_TBSTOP 0x0020 /* shut-up */ +#define x_TBGO 0x0000 /* ~TBSTOP */ +#define x_TBTYPE 0x000f /* tablet type: */ +#define x_TBUNUSED 0x0000 +#define x_TBHITACHI 0x0001 /* hitachi tablet */ +#define x_TBTIGER 0x0002 /* hitachi tiger */ +#define x_TBGTCO 0x0003 /* gtco */ +#define x_TBPOL 0x0004 /* polhemus 3space */ +#define x_TBHDG 0x0005 /* hdg-1111b, low res */ +#define x_TBHDGHIRES 0x0006 /* hdg-1111b, high res */ +#define x_BIOSTYPE x__IOW(x_b, 3, x_int) /* set tablet type */ +#define x_BIOGTYPE x__IOR(x_b, 4, x_int) /* get tablet type*/ +/*#endif*/ + +#endif diff --git a/x_include/sys/x_text.h b/x_include/sys/x_text.h new file mode 100644 index 0000000..09c250f --- /dev/null +++ b/x_include/sys/x_text.h @@ -0,0 +1,69 @@ +#include "x_.h" + +#ifndef x__SYS_TEXT_H_ +#define x__SYS_TEXT_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)text.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Text structure. + * One allocated per pure + * procedure on swap device. + * Manipulated by text.c + */ +#define x_NXDAD 12 /* param.h:MAXTSIZ / vmparam.h:DMTEXT */ + +struct x_text { + struct x_text *x_x_forw; /* forward link in free list */ + struct x_text **x_x_back; /* backward link in free list */ + x_swblk_t x_x_daddr[x_NXDAD]; /* disk addresses of dmtext-page segments */ + x_swblk_t x_x_ptdaddr; /* disk address of page table */ + x_size_t x_x_size; /* size (clicks) */ + struct x_proc *x_x_caddr; /* ptr to linked proc, if loaded */ + struct x_inode *x_x_iptr; /* inode of prototype */ + x_short x_x_rssize; + x_short x_x_swrss; + x_short x_x_count; /* reference count */ + x_short x_x_ccount; /* number of loaded references */ + char x_x_flag; /* traced, written flags */ + char x_x_slptime; + x_short x_x_poip; /* page out in progress count */ +}; + +#ifdef x_KERNEL +struct x_text *x_text, *x_textNTEXT; +x_int x_ntext; +#endif + +#define x_XTRC 0x01 /* Text may be written, exclusive use */ +#define x_XWRIT 0x02 /* Text written into, must swap out */ +#define x_XLOAD 0x04 /* Currently being read from file */ +#define x_XLOCK 0x08 /* Being swapped in or out */ +#define x_XWANT 0x10 /* Wanted for swapping */ +#define x_XPAGI 0x20 /* Page in on demand from inode */ +#define x_XUNUSED 0x40 /* unused since swapped out for cache */ + +/* + * Text table statistics + */ +struct x_xstats { + x_u_long x_alloc; /* calls to xalloc */ + x_u_long x_alloc_inuse; /* found in use/sticky */ + x_u_long x_alloc_cachehit; /* found in cache */ + x_u_long x_alloc_cacheflush; /* flushed cached text */ + x_u_long x_alloc_unused; /* flushed unused cached text */ + x_u_long x_free; /* calls to xfree */ + x_u_long x_free_inuse; /* still in use/sticky */ + x_u_long x_free_cache; /* placed in cache */ + x_u_long x_free_cacheswap; /* swapped out to place in cache */ +}; + +#endif diff --git a/x_include/sys/x_time.h b/x_include/sys/x_time.h new file mode 100644 index 0000000..f34975b --- /dev/null +++ b/x_include/sys/x_time.h @@ -0,0 +1,111 @@ +#include "x_.h" + +#ifndef x__SYS_TIME_H_ +#define x__SYS_TIME_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)time.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Structure returned by gettimeofday(2) system call, + * and used in other calls. + */ +struct x_timeval { + x_long x_tv_sec; /* seconds */ + x_long x_tv_usec; /* and microseconds */ +}; + +struct x_timezone { + x_int x_tz_minuteswest; /* minutes west of Greenwich */ + x_int x_tz_dsttime; /* type of dst correction */ +}; +#define x_DST_NONE 0 /* not on dst */ +#define x_DST_USA 1 /* USA style dst */ +#define x_DST_AUST 2 /* Australian style dst */ +#define x_DST_WET 3 /* Western European dst */ +#define x_DST_MET 4 /* Middle European dst */ +#define x_DST_EET 5 /* Eastern European dst */ +#define x_DST_CAN 6 /* Canada */ + +/* + * Operations on timevals. + * + * NB: timercmp does not work for >= or <=. + */ +#define x_timerisset(x_tvp) ((x_tvp)->x_tv_sec || (x_tvp)->x_tv_usec) +#define x_timercmp(x_tvp, x_uvp, x_cmp) \ + ((x_tvp)->x_tv_sec x_cmp (x_uvp)->x_tv_sec || \ + (x_tvp)->x_tv_sec == (x_uvp)->x_tv_sec && (x_tvp)->x_tv_usec x_cmp (x_uvp)->x_tv_usec) +#define x_timerclear(x_tvp) (x_tvp)->x_tv_sec = (x_tvp)->x_tv_usec = 0 + +/* + * Names of the interval timers, and structure + * defining a timer setting. + */ +#define x_ITIMER_REAL 0 +#define x_ITIMER_VIRTUAL 1 +#define x_ITIMER_PROF 2 + +struct x_itimerval { + struct x_timeval x_it_interval; /* timer interval */ + struct x_timeval x_it_value; /* current value */ +}; + +#ifndef x_KERNEL +#include +#endif + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* compat-4.1/utime.c */ +x_int x_utime __P((char *x_name, x_int x_otv[])); + +/* gen/alarm.c */ +x_int x_alarm __P((x_int x_secs)); + +/* gen/sleep.c */ +x_int x_sleep __P((x_unsigned_int x_n)); + +/* gen/time.c */ +x_long x_time __P((x_time_t *x_t)); + +/* gen/ualarm.c */ +x_unsigned_int x_ualarm __P((register x_unsigned_int x_usecs, register x_unsigned_int x_reload)); + +/* gen/usleep.c */ +x_int x_usleep __P((x_unsigned_int x_n)); + +/* sys/adjtime.c */ +x_int x_adjtime __P((struct x_timeval *x_delta, struct x_timeval *x_odelta)); + +/* sys/getitimer.c */ +x_int x_getitimer __P((x_int x_w, struct x_itimerval *x_v)); + +/* sys/gettimeofday.c */ +x_int x_gettimeofday __P((struct x_timeval *x_t, struct x_timezone *x_z)); + +/* sys/setitimer.c */ +x_int x_setitimer __P((x_int x_w, struct x_itimerval *x_v, struct x_itimerval *x_ov)); + +/* sys/settimeofday.c */ +x_int x_settimeofday __P((struct x_timeval *x_t, struct x_timezone *x_z)); + +/* sys/utimes.c */ +x_int x_utimes __P((char *x_f, struct x_timeval x_t[2])); +#endif + +#endif diff --git a/x_include/sys/x_timeb.h b/x_include/sys/x_timeb.h new file mode 100644 index 0000000..d7fe5cc --- /dev/null +++ b/x_include/sys/x_timeb.h @@ -0,0 +1,39 @@ +#include "x_.h" + +#ifndef x__SYS_TIMEB_H_ +#define x__SYS_TIMEB_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)timeb.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Structure returned by ftime system call + */ +struct x_timeb { + x_time_t x_time; + x_unsigned_short x_millitm; + x_short x_timezone; + x_short x_dstflag; +}; + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* compat-4.1/ftime.c */ +x_int x_ftime __P((register struct x_timeb *x_tp)); +#endif + +#endif diff --git a/x_include/sys/x_times.h b/x_include/sys/x_times.h new file mode 100644 index 0000000..fb6c9f9 --- /dev/null +++ b/x_include/sys/x_times.h @@ -0,0 +1,39 @@ +#include "x_.h" + +#ifndef x__SYS_TIMES_H_ +#define x__SYS_TIMES_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)times.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Structure returned by times() + */ +struct x_tms { + x_time_t x_tms_utime; /* user time */ + x_time_t x_tms_stime; /* system time */ + x_time_t x_tms_cutime; /* user time, children */ + x_time_t x_tms_cstime; /* system time, children */ +}; + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* compat-4.1/times.c */ +x_int x_times __P((register struct x_tms *x_tmsp)); +#endif + +#endif diff --git a/x_include/sys/x_trace.h b/x_include/sys/x_trace.h new file mode 100644 index 0000000..93c85af --- /dev/null +++ b/x_include/sys/x_trace.h @@ -0,0 +1,93 @@ +#include "x_.h" + +#ifndef x__SYS_TRACE_H_ +#define x__SYS_TRACE_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)trace.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * File system buffer tracing points; all trace + */ +#define x_TR_BREADHIT 0 /* buffer read found in cache */ +#define x_TR_BREADMISS 1 /* buffer read not in cache */ +#define x_TR_BWRITE 2 /* buffer written */ +#define x_TR_BREADHITRA 3 /* buffer read-ahead found in cache */ +#define x_TR_BREADMISSRA 4 /* buffer read-ahead not in cache */ +#define x_TR_XFODMISS 5 /* exe fod read */ +#define x_TR_XFODHIT 6 /* exe fod read */ +#define x_TR_BRELSE 7 /* brelse */ +#define x_TR_BREALLOC 8 /* expand/contract a buffer */ + +/* + * Memory allocator trace points; all trace the amount of memory involved + */ +#define x_TR_MALL 10 /* memory allocated */ + +/* + * Paging trace points: all are + */ +#define x_TR_INTRANS 20 /* page intransit block */ +#define x_TR_EINTRANS 21 /* page intransit wait done */ +#define x_TR_FRECLAIM 22 /* reclaim from free list */ +#define x_TR_RECLAIM 23 /* reclaim from loop */ +#define x_TR_XSFREC 24 /* reclaim from free list instead of drum */ +#define x_TR_XIFREC 25 /* reclaim from free list instead of fsys */ +#define x_TR_WAITMEM 26 /* wait for memory in pagein */ +#define x_TR_EWAITMEM 27 /* end memory wait in pagein */ +#define x_TR_ZFOD 28 /* zfod page fault */ +#define x_TR_EXFOD 29 /* exec fod page fault */ +#define x_TR_VRFOD 30 /* vread fod page fault */ +#define x_TR_CACHEFOD 31 /* fod in file system cache */ +#define x_TR_SWAPIN 32 /* drum page fault */ +#define x_TR_PGINDONE 33 /* page in done */ +#define x_TR_SWAPIO 34 /* swap i/o request arrives */ + +/* + * System call trace points. + */ +#define x_TR_VADVISE 40 /* vadvise occurred with */ + +/* + * Miscellaneous + */ +#define x_TR_STAMP 45 /* user said vtrace(VTR_STAMP, value); */ + +/* + * This defines the size of the trace flags array. + */ +#define x_TR_NFLAGS 100 /* generous */ + +#define x_TRCSIZ 4096 + +/* + * Specifications of the vtrace() system call, which takes one argument. + */ +#define x_VTRACE 64+51 + +#define x_VTR_DISABLE 0 /* set a trace flag to 0 */ +#define x_VTR_ENABLE 1 /* set a trace flag to 1 */ +#define x_VTR_VALUE 2 /* return value of a trace flag */ +#define x_VTR_UALARM 3 /* set alarm to go off (sig 16) */ + /* in specified number of hz */ +#define x_VTR_STAMP 4 /* user specified stamp */ +#ifdef x_KERNEL +#ifdef x_TRACE +char x_traceflags[x_TR_NFLAGS]; +struct x_proc *x_traceproc; +x_int x_tracebuf[x_TRCSIZ]; +x_unsigned_int x_tracex; +x_int x_tracewhich; +#define x_pack(x_a,x_b) ((x_a)<<16)|(x_b) +#define x_trace(x_a,x_b,x_c) if (x_traceflags[x_a]) x_trace1(x_a,x_b,x_c) +#else +#define x_trace(x_a,x_b,x_b) ; +#endif +#endif + +#endif diff --git a/x_include/sys/x_tty.h b/x_include/sys/x_tty.h new file mode 100644 index 0000000..48037d9 --- /dev/null +++ b/x_include/sys/x_tty.h @@ -0,0 +1,150 @@ +#include "x_.h" + +#ifndef x__SYS_TTY_H_ +#define x__SYS_TTY_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)tty.h 7.1 (Berkeley) 6/4/86 + */ + +#ifdef x_KERNEL +#include "x_ttychars.h" +#include "x_ttydev.h" +#else +#include +#include +#endif + +/* + * A clist structure is the head of a linked list queue + * of characters. The characters are stored in blocks + * containing a link and CBSIZE (param.h) characters. + * The routines in tty_subr.c manipulate these structures. + */ +struct x_clist { + x_int x_c_cc; /* character count */ + char *x_c_cf; /* pointer to first char */ + char *x_c_cl; /* pointer to last char */ +}; + +/* + * Per-tty structure. + * + * Should be split in two, into device and tty drivers. + * Glue could be masks of what to echo and circular buffer + * (low, high, timeout). + */ +struct x_tty { + union { + struct { + struct x_clist x_T_rawq; + struct x_clist x_T_canq; + } x_t_t; +#define x_t_rawq x_t_nu.x_t_t.x_T_rawq /* raw characters or partial line */ +#define x_t_canq x_t_nu.x_t_t.x_T_canq /* raw characters or partial line */ + struct { + struct x_buf *x_T_bufp; + char *x_T_cp; + x_int x_T_inbuf; + x_int x_T_rec; + } x_t_n; +#define x_t_bufp x_t_nu.x_t_n.x_T_bufp /* buffer allocated to protocol */ +#define x_t_cp x_t_nu.x_t_n.x_T_cp /* pointer into the ripped off buffer */ +#define x_t_inbuf x_t_nu.x_t_n.x_T_inbuf /* number chars in the buffer */ +#define x_t_rec x_t_nu.x_t_n.x_T_rec /* have a complete record */ + } x_t_nu; + struct x_clist x_t_outq; /* device */ + x_int (*x_t_oproc)(); /* device */ + struct x_proc *x_t_rsel; /* tty */ + struct x_proc *x_t_wsel; + x_caddr_t x_T_LINEP; /* ### */ + x_caddr_t x_t_addr; /* ??? */ + x_dev_t x_t_dev; /* device */ + x_int x_t_flags; /* some of both */ + x_int x_t_state; /* some of both */ + x_short x_t_pgrp; /* tty */ + char x_t_delct; /* tty */ + char x_t_line; /* glue */ + char x_t_col; /* tty */ + char x_t_ispeed, x_t_ospeed; /* device */ + char x_t_rocount, x_t_rocol; /* tty */ + struct x_ttychars x_t_chars; /* tty */ + struct x_winsize x_t_winsize; /* window size */ +/* be careful of tchars & co. */ +/* these macros can be reinstated later, in just the *.c files that use them */ +/* otherwise they're too dangerous, they conflict with ioctl.h which we need */ +/*#define t_erase t_chars.tc_erase*/ +/*#define t_kill t_chars.tc_kill*/ +/*#define t_intrc t_chars.tc_intrc*/ +/*#define t_quitc t_chars.tc_quitc*/ +/*#define t_startc t_chars.tc_startc*/ +/*#define t_stopc t_chars.tc_stopc*/ +/*#define t_eofc t_chars.tc_eofc*/ +/*#define t_brkc t_chars.tc_brkc*/ +/*#define t_suspc t_chars.tc_suspc*/ +/*#define t_dsuspc t_chars.tc_dsuspc*/ +/*#define t_rprntc t_chars.tc_rprntc*/ +/*#define t_flushc t_chars.tc_flushc*/ +/*#define t_werasc t_chars.tc_werasc*/ +/*#define t_lnextc t_chars.tc_lnextc*/ +}; + +#define x_TTIPRI 28 +#define x_TTOPRI 29 + +/* limits */ +#define x_NSPEEDS 16 +#define x_TTMASK 15 +#define x_OBUFSIZ 100 +#define x_TTYHOG 255 +#ifdef x_KERNEL +x_short x_tthiwat[x_NSPEEDS], x_ttlowat[x_NSPEEDS]; +#define x_TTHIWAT(x_tp) x_tthiwat[(x_tp)->x_t_ospeed&x_TTMASK] +#define x_TTLOWAT(x_tp) x_ttlowat[(x_tp)->x_t_ospeed&x_TTMASK] +extern struct x_ttychars x_ttydefaults; +#endif + +/* internal state bits */ +#define x_TS_TIMEOUT 0x000001 /* delay timeout in progress */ +#define x_TS_WOPEN 0x000002 /* waiting for open to complete */ +#define x_TS_ISOPEN 0x000004 /* device is open */ +#define x_TS_FLUSH 0x000008 /* outq has been flushed during DMA */ +#define x_TS_CARR_ON 0x000010 /* software copy of carrier-present */ +#define x_TS_BUSY 0x000020 /* output in progress */ +#define x_TS_ASLEEP 0x000040 /* wakeup when output done */ +#define x_TS_XCLUDE 0x000080 /* exclusive-use flag against open */ +#define x_TS_TTSTOP 0x000100 /* output stopped by ctl-s */ +#define x_TS_HUPCLS 0x000200 /* hang up upon last close */ +#define x_TS_TBLOCK 0x000400 /* tandem queue blocked */ +#define x_TS_RCOLL 0x000800 /* collision in read select */ +#define x_TS_WCOLL 0x001000 /* collision in write select */ +#define x_TS_NBIO 0x002000 /* tty in non-blocking mode */ +#define x_TS_ASYNC 0x004000 /* tty in async i/o mode */ +/* state for intra-line fancy editing work */ +#define x_TS_BKSL 0x010000 /* state for lowercase \ work */ +#define x_TS_QUOT 0x020000 /* last character input was \ */ +#define x_TS_ERASE 0x040000 /* within a \.../ for PRTRUB */ +#define x_TS_LNCH 0x080000 /* next character is literal */ +#define x_TS_TYPEN 0x100000 /* retyping suspended input (PENDIN) */ +#define x_TS_CNTTB 0x200000 /* counting tab width; leave FLUSHO alone */ + +#define x_TS_LOCAL (x_TS_BKSL|x_TS_QUOT|x_TS_ERASE|x_TS_LNCH|x_TS_TYPEN|x_TS_CNTTB) + +/* define partab character types */ +#define x_ORDINARY 0 +#define x_CONTROL 1 +#define x_BACKSPACE 2 +#define x_NEWLINE 3 +#define x_TAB 4 +#define x_VTAB 5 +#define x_RETURN 6 + +#endif diff --git a/x_include/sys/x_ttychars.h b/x_include/sys/x_ttychars.h new file mode 100644 index 0000000..f1d51e2 --- /dev/null +++ b/x_include/sys/x_ttychars.h @@ -0,0 +1,57 @@ +#include "x_.h" + +#ifndef x__SYS_TTYCHARS_H_ +#define x__SYS_TTYCHARS_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ttychars.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * User visible structures and constants + * related to terminal handling. + */ +/*#ifndef _TTYCHARS_*/ +/*#define _TTYCHARS_*/ +struct x_ttychars { + char x_tc_erase; /* erase last character */ + char x_tc_kill; /* erase entire line */ + char x_tc_intrc; /* interrupt */ + char x_tc_quitc; /* quit */ + char x_tc_startc; /* start output */ + char x_tc_stopc; /* stop output */ + char x_tc_eofc; /* end-of-file */ + char x_tc_brkc; /* input delimiter (like nl) */ + char x_tc_suspc; /* stop process signal */ + char x_tc_dsuspc; /* delayed stop process signal */ + char x_tc_rprntc; /* reprint line */ + char x_tc_flushc; /* flush output (toggles) */ + char x_tc_werasc; /* word erase */ + char x_tc_lnextc; /* literal next character */ +}; + +#define x_CTRL(x_c) ('c'&037) + +/* default special characters */ +#define x_CERASE 0177 +#define x_CKILL x_CTRL(x_u) +#define x_CINTR x_CTRL(x_c) +#define x_CQUIT 034 /* FS, ^\ */ +#define x_CSTART x_CTRL(x_q) +#define x_CSTOP x_CTRL(x_s) +#define x_CEOF x_CTRL(x_d) +#define x_CEOT x_CEOF +#define x_CBRK 0377 +#define x_CSUSP x_CTRL(x_z) +#define x_CDSUSP x_CTRL(x_y) +#define x_CRPRNT x_CTRL(x_r) +#define x_CFLUSH x_CTRL(x_o) +#define x_CWERASE x_CTRL(x_w) +#define x_CLNEXT x_CTRL(x_v) +/*#endif*/ + +#endif diff --git a/x_include/sys/x_ttydev.h b/x_include/sys/x_ttydev.h new file mode 100644 index 0000000..8456ec6 --- /dev/null +++ b/x_include/sys/x_ttydev.h @@ -0,0 +1,58 @@ +#include "x_.h" + +#ifndef x__SYS_TTYDEV_H_ +#define x__SYS_TTYDEV_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ttydev.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Terminal definitions related to underlying hardware. + */ +/*#ifndef _TTYDEV_*/ +/*#define _TTYDEV_*/ + +/* + * Speeds + */ +#define x_B0 0 +#define x_B50 1 +#define x_B75 2 +#define x_B110 3 +#define x_B134 4 +#define x_B150 5 +#define x_B200 6 +#define x_B300 7 +#define x_B600 8 +#define x_B1200 9 +#define x_B1800 10 +#define x_B2400 11 +#define x_B4800 12 +#define x_B9600 13 +#define x_EXTA 14 +#define x_EXTB 15 + +#ifdef x_KERNEL +/* + * Hardware bits. + * SHOULD NOT BE HERE. + */ +#define x_DONE 0200 +#define x_IENABLE 0100 + +/* + * Modem control commands. + */ +#define x_DMSET 0 +#define x_DMBIS 1 +#define x_DMBIC 2 +#define x_DMGET 3 +#endif +/*#endif*/ + +#endif diff --git a/x_include/sys/x_types.h b/x_include/sys/x_types.h new file mode 100644 index 0000000..28b248f --- /dev/null +++ b/x_include/sys/x_types.h @@ -0,0 +1,83 @@ +#include "x_.h" + +#ifndef x__SYS_TYPES_H_ +#define x__SYS_TYPES_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)types.h 7.1 (Berkeley) 6/4/86 + */ + +/*#ifndef _TYPES_*/ +/*#define _TYPES_*/ +/* + * Basic system types and major/minor device constructing/busting macros. + */ + +/* major part of a device */ +#define x_major(x_x) ((x_int)(((unsigned)(x_x)>>8)&0377)) + +/* minor part of a device */ +#define x_minor(x_x) ((x_int)((x_x)&0377)) + +/* make a device number */ +#define x_makedev(x_x,x_y) ((x_dev_t)(((x_x)<<8) | (x_y))) + +typedef unsigned char x_u_char; +typedef x_unsigned_short x_u_short; +typedef x_unsigned_int x_u_int; +typedef x_unsigned_long x_u_long; +typedef x_unsigned_short x_ushort; /* sys III compat */ + +#ifdef x_vax +typedef struct x__physadr { x_int x_r[1]; } *x_physadr; +typedef struct x_label_t { + x_int x_val[14]; +} x_label_t; +#endif +typedef struct x__quad { x_long x_val[2]; } x_quad; +typedef x_long x_daddr_t; +typedef char * x_caddr_t; +typedef x_u_long x_ino_t; +typedef x_long x_swblk_t; +typedef x_long x_size_t; +typedef x_long x_time_t; +typedef x_short x_dev_t; +typedef x_long x_off_t; +typedef x_u_short x_uid_t; +typedef x_u_short x_gid_t; + +/* moved this to sys/param.h */ +/*#define NBBY 8*/ /* number of bits in a byte */ +/* moved this to sys/select.h */ +/* + * Select uses bit masks of file descriptors in longs. + * These macros manipulate such bit fields (the filesystem macros use chars). + * FD_SETSIZE may be defined by the user, but the default here + * should be >= NOFILE (param.h). + */ +/*#ifndef FD_SETSIZE*/ +/*#define FD_SETSIZE 256*/ +/*#endif*/ + +/*typedef long fd_mask;*/ +/*#define NFDBITS (sizeof(fd_mask) * NBBY)*/ /* bits per mask */ +/*#ifndef howmany*/ +/*#define howmany(x, y) (((x)+((y)-1))/(y))*/ +/*#endif*/ + +/*typedef struct fd_set {*/ +/* fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];*/ +/*} fd_set;*/ + +/*#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))*/ +/*#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))*/ +/*#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))*/ +/*#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))*/ + +/*#endif*/ + +#endif diff --git a/x_include/sys/x_uio.h b/x_include/sys/x_uio.h new file mode 100644 index 0000000..f976156 --- /dev/null +++ b/x_include/sys/x_uio.h @@ -0,0 +1,58 @@ +#include "x_.h" + +#ifndef x__SYS_UIO_H_ +#define x__SYS_UIO_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)uio.h 7.1 (Berkeley) 6/4/86 + */ + +/*#ifndef _UIO_*/ +/*#define _UIO_*/ + +struct x_iovec { + x_caddr_t x_iov_base; + x_int x_iov_len; +}; + +struct x_uio { + struct x_iovec *x_uio_iov; + x_int x_uio_iovcnt; + x_off_t x_uio_offset; + x_int x_uio_segflg; + x_int x_uio_resid; +}; + +enum x_uio_rw { x_UIO_READ, x_UIO_WRITE }; + +/* + * Segment flag values (should be enum). + */ +#define x_UIO_USERSPACE 0 /* from user data space */ +#define x_UIO_SYSSPACE 1 /* from system space */ +#define x_UIO_USERISPACE 2 /* from user I space */ +/*#endif*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* sys/readv.c */ +x_int x_readv __P((x_int x_d, struct x_iovec *x_v, x_int x_l)); + +/* sys/writev.c */ +x_int x_writev __P((x_int x_f, struct x_iovec *x_v, x_int x_l)); +#endif + +#endif diff --git a/x_include/sys/x_un.h b/x_include/sys/x_un.h new file mode 100644 index 0000000..bb05c5e --- /dev/null +++ b/x_include/sys/x_un.h @@ -0,0 +1,26 @@ +#include "x_.h" + +#ifndef x__SYS_UN_H_ +#define x__SYS_UN_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)un.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Definitions for UNIX IPC domain. + */ +struct x_sockaddr_un { + x_short x_sun_family; /* AF_UNIX */ + char x_sun_path[108]; /* path name (gag) */ +}; + +#ifdef x_KERNEL +/*int unp_discard();*/ +#endif + +#endif diff --git a/x_include/sys/x_unpcb.h b/x_include/sys/x_unpcb.h new file mode 100644 index 0000000..15ce80d --- /dev/null +++ b/x_include/sys/x_unpcb.h @@ -0,0 +1,55 @@ +#include "x_.h" + +#ifndef x__SYS_UNPCB_H_ +#define x__SYS_UNPCB_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)unpcb.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Protocol control block for an active + * instance of a UNIX internal protocol. + * + * A socket may be associated with an inode in the + * file system. If so, the unp_inode pointer holds + * a reference count to this inode, which should be irele'd + * when the socket goes away. + * + * A socket may be connected to another socket, in which + * case the control block of the socket to which it is connected + * is given by unp_conn. + * + * A socket may be referenced by a number of sockets (e.g. several + * sockets may be connected to a datagram socket.) These sockets + * are in a linked list starting with unp_refs, linked through + * unp_nextref and null-terminated. Note that a socket may be referenced + * by a number of other sockets and may also reference a socket (not + * necessarily one which is referencing it). This generates + * the need for unp_refs and unp_nextref to be separate fields. + * + * Stream sockets keep copies of receive sockbuf sb_cc and sb_mbcnt + * so that changes in the sockbuf may be computed to modify + * back pressure on the sender accordingly. + */ +struct x_unpcb { + struct x_socket *x_unp_socket; /* pointer back to socket */ + struct x_inode *x_unp_inode; /* if associated with file */ + x_ino_t x_unp_ino; /* fake inode number */ + struct x_unpcb *x_unp_conn; /* control block of connected socket */ + struct x_unpcb *x_unp_refs; /* referencing socket linked list */ + struct x_unpcb *x_unp_nextref; /* link in unp_refs list */ + struct x_mbuf *x_unp_addr; /* bound address of socket */ + x_int x_unp_cc; /* copy of rcv.sb_cc */ + x_int x_unp_mbcnt; /* copy of rcv.sb_mbcnt */ +}; + +#define x_sotounpcb(x_so) ((struct x_unpcb *)((x_so)->x_so_pcb)) + +#endif diff --git a/x_include/sys/x_user.h b/x_include/sys/x_user.h new file mode 100644 index 0000000..a4f1b5c --- /dev/null +++ b/x_include/sys/x_user.h @@ -0,0 +1,163 @@ +#include "x_.h" + +#ifndef x__SYS_USER_H_ +#define x__SYS_USER_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)user.h 7.1 (Berkeley) 6/4/86 + */ + +#ifdef x_KERNEL +#include "../machine/x_pcb.h" +#include "x_dmap.h" +#include "x_time.h" +#include "x_resource.h" +#include "x_namei.h" +#else +#include +#include +#include +#include +#include +#endif + +/* + * Per process structure containing data that + * isn't needed in core when the process is swapped out. + */ + +#define x_MAXCOMLEN 16 /* <= MAXNAMLEN, >= sizeof(ac_comm) */ + +struct x_user { + struct x_pcb x_u_pcb; + struct x_proc *x_u_procp; /* pointer to proc structure */ + x_int *x_u_ar0; /* address of users saved R0 */ + char x_u_comm[x_MAXCOMLEN + 1]; + +/* syscall parameters, results and catches */ + x_int x_u_arg[8]; /* arguments to current system call */ + x_int *x_u_ap; /* pointer to arglist */ + x_label_t x_u_qsave; /* for non-local gotos on interrupts */ + union { /* syscall return values */ + struct { + x_int x_R_val1; + x_int x_R_val2; + } x_u_rv; +#define x_r_val1 x_u_rv.x_R_val1 +#define x_r_val2 x_u_rv.x_R_val2 + x_off_t x_r_off; + x_time_t x_r_time; + } x_u_r; + char x_u_error; /* return error code */ + char x_u_eosys; /* special action on end of syscall */ + +/* 1.1 - processes and protection */ + x_uid_t x_u_uid; /* effective user id */ + x_uid_t x_u_ruid; /* real user id */ + x_gid_t x_u_gid; /* effective group id */ + x_gid_t x_u_rgid; /* real group id */ + x_gid_t x_u_groups[x_NGROUPS]; /* groups, 0 terminated */ + +/* 1.2 - memory management */ + x_size_t x_u_tsize; /* text size (clicks) */ + x_size_t x_u_dsize; /* data size (clicks) */ + x_size_t x_u_ssize; /* stack size (clicks) */ + struct x_dmap x_u_dmap; /* disk map for data segment */ + struct x_dmap x_u_smap; /* disk map for stack segment */ + struct x_dmap x_u_cdmap, x_u_csmap; /* shadows of u_dmap, u_smap, for + use of parent during fork */ + x_label_t x_u_ssave; /* label variable for swapping */ + x_size_t x_u_odsize, x_u_ossize; /* for (clumsy) expansion swaps */ + x_time_t x_u_outime; /* user time at last sample */ + +/* 1.3 - signal management */ + x_int (*x_u_signal[x_NSIG])(); /* disposition of signals */ + x_int x_u_sigmask[x_NSIG]; /* signals to be blocked */ + x_int x_u_sigonstack; /* signals to take on sigstack */ + x_int x_u_sigintr; /* signals that interrupt syscalls */ + x_int x_u_oldmask; /* saved mask from before sigpause */ + x_int x_u_code; /* ``code'' to trap */ + struct x_sigstack x_u_sigstack; /* sp & on stack state variable */ +#define x_u_onstack x_u_sigstack.x_ss_onstack +#define x_u_sigsp x_u_sigstack.x_ss_sp + +/* 1.4 - descriptor management */ + struct x_file *x_u_ofile[x_NOFILE]; /* file structures for open files */ + char x_u_pofile[x_NOFILE]; /* per-process flags of open files */ + x_int x_u_lastfile; /* high-water mark of u_ofile */ +#define x_UF_EXCLOSE 0x1 /* auto-close on exec */ +#define x_UF_MAPPED 0x2 /* mapped from device */ + struct x_inode *x_u_cdir; /* current directory */ + struct x_inode *x_u_rdir; /* root directory of current process */ + struct x_tty *x_u_ttyp; /* controlling tty pointer */ + x_dev_t x_u_ttyd; /* controlling tty dev */ + x_short x_u_cmask; /* mask for file creation */ + +/* 1.5 - timing and statistics */ + struct x_rusage x_u_ru; /* stats for this proc */ + struct x_rusage x_u_cru; /* sum of stats for reaped children */ + struct x_itimerval x_u_timer[3]; + x_int x_u_XXX[3]; + struct x_timeval x_u_start; + x_short x_u_acflag; + + struct x_uprof { /* profile arguments */ + x_short *x_pr_base; /* buffer base */ + x_unsigned_int x_pr_size; /* buffer size */ + x_unsigned_int x_pr_off; /* pc offset */ + x_unsigned_int x_pr_scale; /* pc scaling */ + } x_u_prof; + +/* 1.6 - resource controls */ + struct x_rlimit x_u_rlimit[x_RLIM_NLIMITS]; + struct x_quota *x_u_quota; /* user's quota structure */ + x_int x_u_qflags; /* per process quota flags */ + +/* namei & co. */ + struct x_nameicache { /* last successful directory search */ + x_int x_nc_prevoffset; /* offset at which last entry found */ + x_ino_t x_nc_inumber; /* inum of cached directory */ + x_dev_t x_nc_dev; /* dev of cached directory */ + x_time_t x_nc_time; /* time stamp for cache entry */ + } x_u_ncache; + struct x_nameidata x_u_nd; + + x_int x_u_stack[1]; +}; + +/* u_eosys values */ +#define x_JUSTRETURN 1 +#define x_RESTARTSYS 2 +#define x_NORMALRETURN 3 + +/* u_error codes */ +#ifdef x_KERNEL +#include "x_errno.h" +#else +#include +#endif + +#ifdef x_KERNEL +extern struct x_user x_u; +extern struct x_user x_swaputl; +extern struct x_user x_forkutl; +extern struct x_user x_xswaputl; +extern struct x_user x_xswap2utl; +extern struct x_user x_pushutl; +extern struct x_user x_vfutl; +#endif + +#endif diff --git a/x_include/sys/x_vadvise.h b/x_include/sys/x_vadvise.h new file mode 100644 index 0000000..e6cbaf8 --- /dev/null +++ b/x_include/sys/x_vadvise.h @@ -0,0 +1,29 @@ +#include "x_.h" + +#ifndef x__SYS_VADVISE_H_ +#define x__SYS_VADVISE_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)vadvise.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Parameters to vadvise() to tell system of particular paging + * behaviour: + * VA_NORM Normal strategy + * VA_ANOM Sampling page behaviour is not a win, don't bother + * Suitable during GCs in LISP, or sequential or random + * page referencing. + * VA_SEQL Sequential behaviour expected. + * VA_FLUSH Invalidate all page table entries. + */ +#define x_VA_NORM 0 +#define x_VA_ANOM 1 +#define x_VA_SEQL 2 +#define x_VA_FLUSH 3 + +#endif diff --git a/x_include/sys/x_vcmd.h b/x_include/sys/x_vcmd.h new file mode 100644 index 0000000..9defad5 --- /dev/null +++ b/x_include/sys/x_vcmd.h @@ -0,0 +1,31 @@ +#include "x_.h" + +#ifndef x__SYS_VCMD_H_ +#define x__SYS_VCMD_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)vcmd.h 7.1 (Berkeley) 6/4/86 + */ + +#ifndef x__IOCTL_ +#ifdef x_KERNEL +#include "x_ioctl.h" +#else +#include +#endif +#endif + +#define x_VPRINT 0100 +#define x_VPLOT 0200 +#define x_VPRINTPLOT 0400 + +#define x_VGETSTATE x__IOR(x_v, 0, x_int) +#define x_VSETSTATE x__IOW(x_v, 1, x_int) + +#endif diff --git a/x_include/sys/x_vlimit.h b/x_include/sys/x_vlimit.h new file mode 100644 index 0000000..01ad068 --- /dev/null +++ b/x_include/sys/x_vlimit.h @@ -0,0 +1,42 @@ +#include "x_.h" + +#ifndef x__SYS_VLIMIT_H_ +#define x__SYS_VLIMIT_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)vlimit.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Limits for u.u_limit[i], per process, inherited. + */ +#define x_LIM_NORAISE 0 /* if <> 0, can't raise limits */ +#define x_LIM_CPU 1 /* max secs cpu time */ +#define x_LIM_FSIZE 2 /* max size of file created */ +#define x_LIM_DATA 3 /* max growth of data space */ +#define x_LIM_STACK 4 /* max growth of stack */ +#define x_LIM_CORE 5 /* max size of ``core'' file */ +#define x_LIM_MAXRSS 6 /* max desired data+stack core usage */ + +#define x_NLIMITS 6 + +#define x_INFINITY 0x7fffffff + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* compat-4.1/vlimit.c */ +x_int x_vlimit __P((x_int x_limit, x_int x_value)); +#endif + +#endif diff --git a/x_include/sys/x_vm.h b/x_include/sys/x_vm.h new file mode 100644 index 0000000..0619738 --- /dev/null +++ b/x_include/sys/x_vm.h @@ -0,0 +1,31 @@ +#include "x_.h" + +#ifndef x__SYS_VM_H_ +#define x__SYS_VM_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)vm.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * #include "../h/vm.h" + * or #include in a user program + * is a quick way to include all the vm header files. + */ +#ifdef x_KERNEL +#include "x_vmparam.h" +#include "x_vmmac.h" +#include "x_vmmeter.h" +#include "x_vmsystm.h" +#else +#include +#include +#include +#include +#endif + +#endif diff --git a/x_include/sys/x_vmmac.h b/x_include/sys/x_vmmac.h new file mode 100644 index 0000000..e6d7c5d --- /dev/null +++ b/x_include/sys/x_vmmac.h @@ -0,0 +1,182 @@ +#include "x_.h" + +#ifndef x__SYS_VMMAC_H_ +#define x__SYS_VMMAC_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)vmmac.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Virtual memory related conversion macros + */ + +/* Core clicks to number of pages of page tables needed to map that much */ +#define x_ctopt(x_x) (((x_x)+x_NPTEPG-1)/x_NPTEPG) + +#ifdef x_vax +/* Virtual page numbers to text|data|stack segment page numbers and back */ +#define x_vtotp(x_p, x_v) ((x_int)(x_v)) +#define x_vtodp(x_p, x_v) ((x_int)((x_v) - x_stoc(x_ctos((x_p)->x_p_tsize)))) +#define x_vtosp(x_p, x_v) ((x_int)(x_BTOPUSRSTACK - 1 - (x_v))) +#define x_tptov(x_p, x_i) ((unsigned)(x_i)) +#define x_dptov(x_p, x_i) ((unsigned)(x_stoc(x_ctos((x_p)->x_p_tsize)) + (x_i))) +#define x_sptov(x_p, x_i) ((unsigned)(x_BTOPUSRSTACK - 1 - (x_i))) + +/* Tell whether virtual page numbers are in text|data|stack segment */ +#define x_isassv(x_p, x_v) ((x_v) >= x_BTOPUSRSTACK - (x_p)->x_p_ssize) +#define x_isatsv(x_p, x_v) ((x_v) < (x_p)->x_p_tsize) +#define x_isadsv(x_p, x_v) ((x_v) >= x_stoc(x_ctos((x_p)->x_p_tsize)) && \ + (x_v) < (x_p)->x_p_tsize + (x_p)->x_p_dsize) +#else +/* Virtual page numbers to text|data|stack segment page numbers and back */ +#define x_vtotp(x_p, x_v) ((x_int)(x_v)-x_LOWPAGES) +#define x_vtodp(x_p, x_v) ((x_int)((x_v) - x_stoc(x_ctos((x_p)->x_p_tsize)) - x_LOWPAGES)) +#define x_vtosp(x_p, x_v) ((x_int)(x_BTOPUSRSTACK - 1 - (x_v))) +#define x_tptov(x_p, x_i) ((unsigned)(x_i) + x_LOWPAGES) +#define x_dptov(x_p, x_i) ((unsigned)(x_stoc(x_ctos((x_p)->x_p_tsize)) + (x_i) + x_LOWPAGES)) +#define x_sptov(x_p, x_i) ((unsigned)(x_BTOPUSRSTACK - 1 - (x_i))) + +/* Tell whether virtual page numbers are in text|data|stack segment */ +#define x_isassv(x_p, x_v) ((x_v) >= x_BTOPUSRSTACK - (x_p)->x_p_ssize) +#define x_isatsv(x_p, x_v) (((x_v) - x_LOWPAGES) < (x_p)->x_p_tsize) +#define x_isadsv(x_p, x_v) (((x_v) - x_LOWPAGES) >= x_stoc(x_ctos((x_p)->x_p_tsize)) && \ + !x_isassv(x_p, x_v)) +#endif + +/* Tell whether pte's are text|data|stack */ +#define x_isaspte(x_p, x_pte) ((x_pte) > x_sptopte(x_p, (x_p)->x_p_ssize)) +#define x_isatpte(x_p, x_pte) ((x_pte) < x_dptopte(x_p, 0)) +#define x_isadpte(x_p, x_pte) (!x_isaspte(x_p, x_pte) && !x_isatpte(x_p, x_pte)) + +/* Text|data|stack pte's to segment page numbers and back */ +#define x_ptetotp(x_p, x_pte) ((x_pte) - (x_p)->x_p_p0br) +#define x_ptetodp(x_p, x_pte) (((x_pte) - (x_p)->x_p_p0br) - (x_p)->x_p_tsize) +#define x_ptetosp(x_p, x_pte) (((x_p)->x_p_addr - (x_pte)) - 1) + +#define x_tptopte(x_p, x_i) ((x_p)->x_p_p0br + (x_i)) +#define x_dptopte(x_p, x_i) ((x_p)->x_p_p0br + ((x_p)->x_p_tsize + (x_i))) +#define x_sptopte(x_p, x_i) ((x_p)->x_p_addr - (1 + (x_i))) + +/* Convert a virtual page number to a pte address. */ +#define x_vtopte(x_p, x_v) \ + (((x_v) < (x_p)->x_p_tsize + (x_p)->x_p_dsize) ? ((x_p)->x_p_p0br + (x_v)) : \ + ((x_p)->x_p_addr - (x_BTOPUSRSTACK - (x_v)))) +#ifdef x_notdef +/*struct pte *vtopte();*/ +#endif + +/* Bytes to pages without rounding, and back */ +#define x_btop(x_x) (((unsigned)(x_x)) >> x_PGSHIFT) +#define x_ptob(x_x) ((x_caddr_t)((x_x) << x_PGSHIFT)) + +/* Turn virtual addresses into kernel map indices */ +#define x_kmxtob(x_a) (x_usrpt + (x_a) * x_NPTEPG) +#define x_btokmx(x_b) (((x_b) - x_usrpt) / x_NPTEPG) + +/* User area address and pcb bases */ +#define x_uaddr(x_p) (&((x_p)->x_p_p0br[(x_p)->x_p_szpt * x_NPTEPG - x_UPAGES])) +#ifdef x_vax +#define x_pcbb(x_p) ((x_p)->x_p_addr[0].x_pg_pfnum) +#endif + +/* Average new into old with aging factor time */ +#define x_ave(x_smooth, x_cnt, x_time) \ + x_smooth = ((x_time - 1) * (x_smooth) + (x_cnt)) / (x_time) + +/* Abstract machine dependent operations */ +#ifdef x_vax +#define x_setp0br(x_x) (x_u.x_u_pcb.x_pcb_p0br = (x_x), x_mtpr(x_P0BR, x_x)) +#define x_setp0lr(x_x) (x_u.x_u_pcb.x_pcb_p0lr = \ + (x_x) | (x_u.x_u_pcb.x_pcb_p0lr & x_AST_CLR), \ + x_mtpr(x_P0LR, x_x)) +#define x_setp1br(x_x) (x_u.x_u_pcb.x_pcb_p1br = (x_x), x_mtpr(x_P1BR, x_x)) +#define x_setp1lr(x_x) (x_u.x_u_pcb.x_pcb_p1lr = (x_x), x_mtpr(x_P1LR, x_x)) +#define x_initp1br(x_x) ((x_x) - x_P1PAGES) +#endif + +#define x_outofmem() x_wakeup((x_caddr_t)&x_proc[2]); + +/* + * Page clustering macros. + * + * dirtycl(pte) is the page cluster dirty? + * anycl(pte,fld) does any pte in the cluster has fld set? + * zapcl(pte,fld) = val set all fields fld in the cluster to val + * distcl(pte) distribute high bits to cluster; note that + * distcl copies everything but pg_pfnum, + * INCLUDING pg_m!!! + * + * In all cases, pte must be the low pte in the cluster, even if + * the segment grows backwards (e.g. the stack). + */ +#define x_H(x_pte) ((struct x_hpte *)(x_pte)) + +#if x_CLSIZE==1 +#define x_dirtycl(x_pte) x_dirty(x_pte) +#define x_anycl(x_pte,x_fld) ((x_pte)->x_fld) +#define x_zapcl(x_pte,x_fld) (x_pte)->x_fld +#define x_distcl(x_pte) +#endif + +#if x_CLSIZE==2 +#define x_dirtycl(x_pte) (x_dirty(x_pte) || x_dirty((x_pte)+1)) +#define x_anycl(x_pte,x_fld) ((x_pte)->x_fld || (((x_pte)+1)->x_fld)) +#define x_zapcl(x_pte,x_fld) (x_pte)[1].x_fld = (x_pte)[0].x_fld +#endif + +#if x_CLSIZE==4 +#define x_dirtycl(x_pte) \ + (x_dirty(x_pte) || x_dirty((x_pte)+1) || x_dirty((x_pte)+2) || x_dirty((x_pte)+3)) +#define x_anycl(x_pte,x_fld) \ + ((x_pte)->x_fld || (((x_pte)+1)->x_fld) || (((x_pte)+2)->x_fld) || (((x_pte)+3)->x_fld)) +#define x_zapcl(x_pte,x_fld) \ + (x_pte)[3].x_fld = (x_pte)[2].x_fld = (x_pte)[1].x_fld = (x_pte)[0].x_fld +#endif + +#ifndef x_distcl +#define x_distcl(x_pte) x_zapcl(x_H(x_pte),x_pg_high) +#endif + +/* + * Lock a page frame. + */ +#define x_MLOCK(x_c) { \ + while ((x_c)->x_c_lock) { \ + (x_c)->x_c_want = 1; \ + x_sleep((x_caddr_t)(x_c), x_PSWP+1); \ + } \ + (x_c)->x_c_lock = 1; \ +} +/* + * Unlock a page frame. + */ +#define x_MUNLOCK(x_c) { \ + if (x_c->x_c_want) { \ + x_wakeup((x_caddr_t)x_c); \ + x_c->x_c_want = 0; \ + } \ + x_c->x_c_lock = 0; \ +} + +/* + * BEWARE THIS DEFINITION WORKS ONLY WITH COUNT OF 1 + */ +/* moved this from sys/vmmac.h to avoid a circular dependency */ +#define x_mapin(x_pte, x_v, x_pfnum, x_count, x_prot) \ + (*(x_int *)(x_pte) = (x_pfnum) | (x_prot), x_mtpr(x_TBIS, x_ptob(x_v))) + +#endif diff --git a/x_include/sys/x_vmmeter.h b/x_include/sys/x_vmmeter.h new file mode 100644 index 0000000..fb835e0 --- /dev/null +++ b/x_include/sys/x_vmmeter.h @@ -0,0 +1,115 @@ +#include "x_.h" + +#ifndef x__SYS_VMMETER_H_ +#define x__SYS_VMMETER_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)vmmeter.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Virtual memory related instrumentation + */ +struct x_vmmeter { +#define x_v_first x_v_swtch + x_unsigned_int x_v_swtch; /* context switches */ + x_unsigned_int x_v_trap; /* calls to trap */ + x_unsigned_int x_v_syscall; /* calls to syscall() */ + x_unsigned_int x_v_intr; /* device interrupts */ + x_unsigned_int x_v_soft; /* software interrupts */ + x_unsigned_int x_v_pdma; /* pseudo-dma interrupts */ + x_unsigned_int x_v_pswpin; /* pages swapped in */ + x_unsigned_int x_v_pswpout; /* pages swapped out */ + x_unsigned_int x_v_pgin; /* pageins */ + x_unsigned_int x_v_pgout; /* pageouts */ + x_unsigned_int x_v_pgpgin; /* pages paged in */ + x_unsigned_int x_v_pgpgout; /* pages paged out */ + x_unsigned_int x_v_intrans; /* intransit blocking page faults */ + x_unsigned_int x_v_pgrec; /* total page reclaims */ + x_unsigned_int x_v_xsfrec; /* found in free list rather than on swapdev */ + x_unsigned_int x_v_xifrec; /* found in free list rather than in filsys */ + x_unsigned_int x_v_exfod; /* pages filled on demand from executables */ + x_unsigned_int x_v_zfod; /* pages zero filled on demand */ + x_unsigned_int x_v_vrfod; /* fills of pages mapped by vread() */ + x_unsigned_int x_v_nexfod; /* number of exfod's created */ + x_unsigned_int x_v_nzfod; /* number of zfod's created */ + x_unsigned_int x_v_nvrfod; /* number of vrfod's created */ + x_unsigned_int x_v_pgfrec; /* page reclaims from free list */ + x_unsigned_int x_v_faults; /* total faults taken */ + x_unsigned_int x_v_scan; /* scans in page out daemon */ + x_unsigned_int x_v_rev; /* revolutions of the hand */ + x_unsigned_int x_v_seqfree; /* pages taken from sequential programs */ + x_unsigned_int x_v_dfree; /* pages freed by daemon */ + x_unsigned_int x_v_fastpgrec; /* fast reclaims in locore */ +#define x_v_last x_v_fastpgrec + x_unsigned_int x_v_swpin; /* swapins */ + x_unsigned_int x_v_swpout; /* swapouts */ +}; +#ifdef x_KERNEL +struct x_vmmeter x_cnt, x_rate, x_sum; +#endif + +/* systemwide totals computed every five seconds */ +struct x_vmtotal { + x_short x_t_rq; /* length of the run queue */ + x_short x_t_dw; /* jobs in ``disk wait'' (neg priority) */ + x_short x_t_pw; /* jobs in page wait */ + x_short x_t_sl; /* jobs sleeping in core */ + x_short x_t_sw; /* swapped out runnable/short block jobs */ + x_long x_t_vm; /* total virtual memory */ + x_long x_t_avm; /* active virtual memory */ + x_long x_t_rm; /* total real memory in use */ + x_long x_t_arm; /* active real memory */ + x_long x_t_vmtxt; /* virtual memory used by text */ + x_long x_t_avmtxt; /* active virtual memory used by text */ + x_long x_t_rmtxt; /* real memory used by text */ + x_long x_t_armtxt; /* active real memory used by text */ + x_long x_t_free; /* free memory pages */ +}; +#ifdef x_KERNEL +struct x_vmtotal x_total; +#endif + +/* + * Optional instrumentation. + */ +#ifdef x_PGINPROF + +#define x_NDMON 128 +#define x_NSMON 128 + +#define x_DRES 20 +#define x_SRES 5 + +#define x_PMONMIN 20 +#define x_PRES 50 +#define x_NPMON 64 + +#define x_RMONMIN 130 +#define x_RRES 5 +#define x_NRMON 64 + +/* data and stack size distribution counters */ +x_unsigned_int x_dmon[x_NDMON+1]; +x_unsigned_int x_smon[x_NSMON+1]; + +/* page in time distribution counters */ +x_unsigned_int x_pmon[x_NPMON+2]; + +/* reclaim time distribution counters */ +x_unsigned_int x_rmon[x_NRMON+2]; + +x_int x_pmonmin; +x_int x_pres; +x_int x_rmonmin; +x_int x_rres; + +x_unsigned_int x_rectime; /* accumulator for reclaim times */ +x_unsigned_int x_pgintime; /* accumulator for page in times */ +#endif + +#endif diff --git a/x_include/sys/x_vmparam.h b/x_include/sys/x_vmparam.h new file mode 100644 index 0000000..23de453 --- /dev/null +++ b/x_include/sys/x_vmparam.h @@ -0,0 +1,31 @@ +#include "x_.h" + +#ifndef x__SYS_VMPARAM_H_ +#define x__SYS_VMPARAM_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)vmparam.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Machine dependent constants + */ +#ifdef x_KERNEL +#include "../machine/x_vmparam.h" +#else +#include +#endif + +#if defined(x_KERNEL) && !defined(x_LOCORE) +x_int x_klseql; +x_int x_klsdist; +x_int x_klin; +x_int x_kltxt; +x_int x_klout; +#endif + +#endif diff --git a/x_include/sys/x_vmsystm.h b/x_include/sys/x_vmsystm.h new file mode 100644 index 0000000..0b38809 --- /dev/null +++ b/x_include/sys/x_vmsystm.h @@ -0,0 +1,64 @@ +#include "x_.h" + +#ifndef x__SYS_VMSYSTM_H_ +#define x__SYS_VMSYSTM_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)vmsystm.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Miscellaneous virtual memory subsystem variables and structures. + */ + +#ifdef x_KERNEL +x_int x_freemem; /* remaining blocks of free memory */ +x_int x_avefree; /* moving average of remaining free blocks */ +x_int x_avefree30; /* 30 sec (avefree is 5 sec) moving average */ +x_int x_deficit; /* estimate of needs of new swapped in procs */ +x_int x_nscan; /* number of scans in last second */ +x_int x_multprog; /* current multiprogramming degree */ +x_int x_desscan; /* desired pages scanned per second */ + +/* writable copies of tunables */ +x_int x_maxpgio; /* max paging i/o per sec before start swaps */ +x_int x_maxslp; /* max sleep time before very swappable */ +x_int x_lotsfree; /* max free before clock freezes */ +x_int x_minfree; /* minimum free pages before swapping begins */ +x_int x_desfree; /* no of pages to try to keep free via daemon */ +x_int x_saferss; /* no pages not to steal; decays with slptime */ +x_int x_slowscan; /* slowest scan rate, clusters/second */ +x_int x_fastscan; /* fastest scan rate, clusters/second */ +#endif + +/* + * Fork/vfork accounting. + */ +struct x_forkstat { + x_int x_cntfork; + x_int x_cntvfork; + x_int x_sizfork; + x_int x_sizvfork; +}; +#ifdef x_KERNEL +struct x_forkstat x_forkstat; +#endif + +/* + * Swap kind accounting. + */ +struct x_swptstat { + x_int x_pteasy; /* easy pt swaps */ + x_int x_ptexpand; /* pt expansion swaps */ + x_int x_ptshrink; /* pt shrinking swaps */ + x_int x_ptpack; /* pt swaps involving spte copying */ +}; +#ifdef x_KERNEL +struct x_swptstat x_swptstat; +#endif + +#endif diff --git a/x_include/sys/x_vsio.h b/x_include/sys/x_vsio.h new file mode 100644 index 0000000..f33ad0f --- /dev/null +++ b/x_include/sys/x_vsio.h @@ -0,0 +1,128 @@ +#include "x_.h" + +#ifndef x__SYS_VSIO_H_ +#define x__SYS_VSIO_H_ + +#include +#include + +/* @(#)vsio.h 7.1 (MIT) 6/4/86 */ + /**************************************************************************** + * * + * Copyright (c) 1983, 1984 by * + * DIGITAL EQUIPMENT CORPORATION, Maynard, Massachusetts. * + * All rights reserved. * + * * + * This software is furnished on an as-is basis and may be used and copied * + * only with inclusion of the above copyright notice. This software or any * + * other copies thereof may be provided or otherwise made available to * + * others only for non-commercial purposes. No title to or ownership of * + * the software is hereby transferred. * + * * + * The information in this software is subject to change without notice * + * and should not be construed as a commitment by DIGITAL EQUIPMENT * + * CORPORATION. * + * * + * DIGITAL assumes no responsibility for the use or reliability of its * + * software on equipment which is not supplied by DIGITAL. * + * * + * * + ****************************************************************************/ +/* + * vsio.h - VS100 I/O command definitions + * + * Author: Christopher A. Kent + * Digital Equipment Corporation + * Western Research Lab + * Date: Tue Jun 21 1983 + */ + +/* + * Possible ioctl calls + */ + +#define x_VSIOINIT x__IO(x_V, 0) /* init the device */ +#define x_VSIOSTART x__IOW(x_V, 1, x_int) /* start microcode */ +#define x_VSIOABORT x__IO(x_V, 2) /* abort a command chain */ +#define x_VSIOPWRUP x__IO(x_V, 3) /* power-up reset */ +#define x_VSIOGETVER x__IOR(x_V, 4, x_int) /* get rom version */ +#define x_VSIOSYNC x__IO(x_V, 6) /* synch with device */ +#define x_VSIOBBACTL x__IOW(x_V, 8, x_int) /* control the BBA */ +#define x_VSIOFIBCTL x__IOW(x_V, 9, x_int) /* lamp on/off */ +#define x_VSIOFIBRETRY x__IOW(x_V,10, x_int) /* fiber retries */ +#define x_VSIOGETSTATS x__IOR(x_V,11, x_vsStats) /* get statistics */ +#define x_VSIOGETIOA x__IOR(x_V,13, x_vsIoAddrAddr)/* get ioreg address */ +#define x_VSIOUSERWAIT x__IO(x_V, 15) /* wait for user I/O completion */ +#define x_VSIOWAITGO x__IOW(x_V, 16, x_caddr_t) /* wait then go */ + +#define x_VSIO_OFF 0 /* option off */ +#define x_VSIO_ON 1 /* option on */ + +#define x_VS_FIB_FINITE 1 /* finite retries */ +#define x_VS_FIB_INFINITE 2 /* infinite retries */ + +/* + * Event queue entries + */ + +typedef struct x__vs_event{ + x_u_short x_vse_x; /* x position */ + x_u_short x_vse_y; /* y position */ + x_u_short x_vse_time; /* 10 millisecond units (button only) */ + char x_vse_type; /* button or motion? */ + x_u_char x_vse_key; /* the key (button only) */ + char x_vse_direction; /* which direction (button only) */ + char x_vse_device; /* which device (button only) */ +}x_vsEvent; + +#define x_VSE_BUTTON 0 /* button moved */ +#define x_VSE_MMOTION 1 /* mouse moved */ +#define x_VSE_TMOTION 2 /* tablet moved */ + +#define x_VSE_KBTUP 0 /* up */ +#define x_VSE_KBTDOWN 1 /* down */ + +#define x_VSE_MOUSE 1 /* mouse */ +#define x_VSE_DKB 2 /* main keyboard */ +#define x_VSE_TABLET 3 /* graphics tablet */ +#define x_VSE_AUX 4 /* auxiliary */ +#define x_VSE_CONSOLE 5 /* console */ + +typedef struct x__vsStats{ + x_int x_errors; /* count errors */ + x_int x_unsolIntr; /* count unsolicited interrupts */ + x_int x_overruns; /* event queue overruns */ + x_int x_flashes; /* flashes on fiber link */ + x_int x_ignites; /* times turned on */ + x_int x_douses; /* times turned off */ + x_int x_linkErrors; /* link errors */ +}x_vsStats; + +typedef struct x__vs_cursor{ + x_short x_x; + x_short x_y; +}x_vsCursor; + +typedef struct x__vs_box { + x_short x_bottom; + x_short x_right; + x_short x_left; + x_short x_top; +}x_vsBox; + +typedef struct x__vsIoAddr { + x_short *x_ioreg; + x_short x_status; + x_caddr_t x_obuff; + x_int x_obufflen; + x_int x_reloc; + x_vsEvent *x_ibuff; + x_int x_iqsize; /* may assume power of 2 */ + x_int x_ihead; /* atomic write */ + x_int x_itail; /* atomic read */ + x_vsCursor x_mouse; /* atomic read/write */ + x_vsBox x_mbox; /* atomic read/write */ +} x_vsIoAddr; +typedef x_vsIoAddr *x_vsIoAddrAddr; + +#endif diff --git a/x_include/sys/x_vtimes.h b/x_include/sys/x_vtimes.h new file mode 100644 index 0000000..e2baa54 --- /dev/null +++ b/x_include/sys/x_vtimes.h @@ -0,0 +1,50 @@ +#include "x_.h" + +#ifndef x__SYS_VTIMES_H_ +#define x__SYS_VTIMES_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)vtimes.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * Structure returned by vtimes() and in vwait(). + * In vtimes() two of these are returned, one for the process itself + * and one for all its children. In vwait() these are combined + * by adding componentwise (except for maxrss, which is max'ed). + */ +struct x_vtimes { + x_int x_vm_utime; /* user time (60'ths) */ + x_int x_vm_stime; /* system time (60'ths) */ + /* divide next two by utime+stime to get averages */ + x_unsigned_int x_vm_idsrss; /* integral of d+s rss */ + x_unsigned_int x_vm_ixrss; /* integral of text rss */ + x_int x_vm_maxrss; /* maximum rss */ + x_int x_vm_majflt; /* major page faults */ + x_int x_vm_minflt; /* minor page faults */ + x_int x_vm_nswap; /* number of swaps */ + x_int x_vm_inblk; /* block reads */ + x_int x_vm_oublk; /* block writes */ +}; + +#ifdef x_KERNEL +#endif + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* compat-4.1/vtimes.c */ +x_int x_vtimes __P((register struct x_vtimes *x_par, register struct x_vtimes *x_chi)); +#endif + +#endif diff --git a/x_include/sys/x_wait.h b/x_include/sys/x_wait.h new file mode 100644 index 0000000..a771010 --- /dev/null +++ b/x_include/sys/x_wait.h @@ -0,0 +1,90 @@ +#include "x_.h" + +#ifndef x__SYS_WAIT_H_ +#define x__SYS_WAIT_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)wait.h 7.1 (Berkeley) 6/4/86 + */ + +/* + * This file holds definitions relevent to the wait system call. + * Some of the options here are available only through the ``wait3'' + * entry point; the old entry point with one argument has more fixed + * semantics, never returning status of unstopped children, hanging until + * a process terminates if any are outstanding, and never returns + * detailed information about process resource utilization (). + */ + +/* + * Structure of the information in the first word returned by both + * wait and wait3. If w_stopval==WSTOPPED, then the second structure + * describes the information returned, else the first. See WUNTRACED below. + */ +union x_wait { + x_int x_w_status; /* used in syscall */ + /* + * Terminated process status. + */ + struct { + x_unsigned_short x_w_Termsig:7; /* termination signal */ + x_unsigned_short x_w_Coredump:1; /* core dump indicator */ + x_unsigned_short x_w_Retcode:8; /* exit code if w_termsig==0 */ + } x_w_T; + /* + * Stopped process status. Returned + * only for traced children unless requested + * with the WUNTRACED option bit. + */ + struct { + x_unsigned_short x_w_Stopval:8; /* == W_STOPPED if stopped */ + x_unsigned_short x_w_Stopsig:8; /* signal that stopped us */ + } x_w_S; +}; +#define x_w_termsig x_w_T.x_w_Termsig +#define x_w_coredump x_w_T.x_w_Coredump +#define x_w_retcode x_w_T.x_w_Retcode +#define x_w_stopval x_w_S.x_w_Stopval +#define x_w_stopsig x_w_S.x_w_Stopsig + +#define x_WSTOPPED 0177 /* value of s.stopval if process is stopped */ + +/* + * Option bits for the second argument of wait3. WNOHANG causes the + * wait to not hang if there are no stopped or terminated processes, rather + * returning an error indication in this case (pid==0). WUNTRACED + * indicates that the caller should receive status about untraced children + * which stop due to signals. If children are stopped and a wait without + * this option is done, it is as though they were still running... nothing + * about them is returned. + */ +#define x_WNOHANG 1 /* dont hang in wait */ +#define x_WUNTRACED 2 /* tell about stopped, untraced children */ + +#define x_WIFSTOPPED(x_x) ((x_x).x_w_stopval == x_WSTOPPED) +#define x_WIFSIGNALED(x_x) ((x_x).x_w_stopval != x_WSTOPPED && (x_x).x_w_termsig != 0) +#define x_WIFEXITED(x_x) ((x_x).x_w_stopval != x_WSTOPPED && (x_x).x_w_termsig == 0) + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* sys/wait3.c */ +x_int x_wait3 __P((union x_wait *x_s, x_int x_o, struct x_rusage *x_r)); + +/* sys/wait.c */ +x_int x_wait __P((union x_wait *x_s)); +#endif + +#endif diff --git a/x_include/vax/inline/x_inline.h b/x_include/vax/inline/x_inline.h new file mode 100644 index 0000000..ef84e5f --- /dev/null +++ b/x_include/vax/inline/x_inline.h @@ -0,0 +1,88 @@ +#include "x_.h" + +#ifndef x__VAX_INLINE_INLINE_H_ +#define x__VAX_INLINE_INLINE_H_ + +/* + * Copyright (c) 1984, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)inline.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * COMMENTCHAR is the character delimiting comments in the assembler. + * LABELCHAR is the character that separates labels from instructions. + * ARGSEPCHAR is the character that separates arguments in instructions. + */ +#define x_COMMENTCHAR '#' +#define x_LABELCHAR ':' +#define x_ARGSEPCHAR ',' + +/* + * Expansion parameters: + * QUEUESIZE is the number of instructions to be considered for + * integration of argument pushes and pops + * MAXLINELEN is the longest expected input line + * MAXARGS is the maximum number of arguments in an assembly instruction + */ +#define x_QUEUESIZE 16 +#define x_MAXLINELEN 1024 +#define x_MAXARGS 10 + +/* + * The following global variables are used to manipulate the queue of + * recently seen instructions. + * line - The queue of instructions. + * bufhead - Pointer to next availble queue slot. It is not + * considered part of te instruction stream until + * bufhead is advanced. + * buftail - Pointer to last instruction in queue. + * Note that bufhead == buftail implies that the queue is empty. + */ +x_int x_bufhead, x_buftail; +char x_line[x_QUEUESIZE][x_MAXLINELEN]; + +#define x_SUCC(x_qindex) ((x_qindex) + 1 == x_QUEUESIZE ? 0 : (x_qindex) + 1) +#define x_PRED(x_qindex) ((x_qindex) - 1 < 0 ? x_QUEUESIZE - 1 : (x_qindex) - 1) + +/* + * Hash table headers should be twice as big as the number of patterns. + * They must be a power of two. + */ +#define x_HSHSIZ 128 + +/* + * These tables specify the substitutions that are to be done. + */ +struct x_pats { + x_int x_args; + char *x_name; + char *x_replace; + struct x_pats *x_next; + x_int x_size; +}; +struct x_pats *x_patshdr[x_HSHSIZ]; +extern struct x_pats x_language_ptab[], x_libc_ptab[], x_machine_ptab[]; +extern struct x_pats x_vax_libc_ptab[], x_vaxsubset_libc_ptab[]; +extern struct x_pats x_vax_ptab[], x_vaxsubset_ptab[]; + +/* + * This table defines the set of instructions that demark the + * end of a basic block. + */ +struct x_inststoptbl { + char *x_name; + struct x_inststoptbl *x_next; + x_int x_size; +}; +struct x_inststoptbl *x_inststoptblhdr[x_HSHSIZ]; +extern struct x_inststoptbl x_inststoptable[]; + +/* + * Miscellaneous functions. + */ +/*char *newline(), *copyline(), *doreplaceon();*/ + +#endif diff --git a/x_include/vax/x_clock.h b/x_include/vax/x_clock.h new file mode 100644 index 0000000..a9bbd50 --- /dev/null +++ b/x_include/vax/x_clock.h @@ -0,0 +1,48 @@ +#include "x_.h" + +#ifndef x__VAX_CLOCK_H_ +#define x__VAX_CLOCK_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)clock.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * VAX clock registers + */ + +#define x_ICCS_RUN 0x00000001 +#define x_ICCS_TRANS 0x00000010 +#define x_ICCS_SS 0x00000020 +#define x_ICCS_IE 0x00000040 +#define x_ICCS_INT 0x00000080 +#define x_ICCS_ERR 0x80000000 + +#define x_SECDAY ((unsigned)(24*60*60)) /* seconds per day */ +#define x_SECYR ((unsigned)(365*x_SECDAY)) /* per common year */ +/* + * TODRZERO is the what the TODR should contain when the ``year'' begins. + * The TODR should always contain a number between 0 and SECYR+SECDAY. + */ +#define x_TODRZERO ((unsigned)(1<<28)) + +#define x_YRREF 1970 +#define x_LEAPYEAR(x_year) ((x_year)%4==0) /* good till time becomes negative */ + +/* + * Has the time-of-day clock wrapped around? + */ +#define x_clkwrap() (((unsigned)x_mfpr(x_TODR) - x_TODRZERO)/100 > x_SECYR+x_SECDAY) + +/* + * Software clock is software interrupt level 8, + * implemented as mtpr(SIRR, 0x8) in asm.sed. + */ + +#endif diff --git a/x_include/vax/x_cons.h b/x_include/vax/x_cons.h new file mode 100644 index 0000000..eefad28 --- /dev/null +++ b/x_include/vax/x_cons.h @@ -0,0 +1,46 @@ +#include "x_.h" + +#ifndef x__VAX_CONS_H_ +#define x__VAX_CONS_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)cons.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * VAX console interface registers + */ + +#define x_RXCS_IE 0x00000040 /* receiver interrupt enable */ +#define x_RXCS_DONE 0x00000080 /* receiver done */ + +#define x_RXDB_DATA 0x000000ff /* received character */ +#define x_RXDB_ID 0x00000f00 /* channel id */ +#define x_RXDB_ERR 0x80000000 /* receiver error */ + +#define x_TXCS_IE 0x00000040 /* transmitter interrupt enable */ +#define x_TXCS_RDY 0x00000080 /* transmitter ready for next char */ +#if x_VAX8600 +#define x_TXCS_ID 0x00000300 /* interrupt ID field */ +#define x_TXCS_WMASK 0x00008000 /* enable mask write */ +#define x_TXCS_TXMASK 0x00ff0000 /* transmit enable channel mask: */ +#define x_TXCS_CTERM 0x00010000 /* console terminal */ +#define x_TXCS_RTERM 0x00020000 /* remote diagnostic port */ +#define x_TXCS_EMM 0x00040000 /* Environmental Monitor Module */ +#define x_TXCS_LCONS 0x00080000 /* Logical console */ +#endif + +#define x_TXDB_DATA 0x000000ff /* transmitter byte */ +#define x_TXDB_ID 0x00000f00 /* channel id- not on 8600 */ +#define x_TXDB_CONS 0x00000f00 /* channel id for console subsystem */ + +#define x_TXDB_DONE 0x01 /* software done */ +#define x_TXDB_BOOT 0x02 /* reboot */ +#define x_TXDB_CWSI 0x03 /* clear warm start inhibit */ +#define x_TXDB_CCSI 0x04 /* clear cold-start inhibit */ + +#endif diff --git a/x_include/vax/x_cpu.h b/x_include/vax/x_cpu.h new file mode 100644 index 0000000..c95d237 --- /dev/null +++ b/x_include/vax/x_cpu.h @@ -0,0 +1,120 @@ +#include "x_.h" + +#ifndef x__VAX_CPU_H_ +#define x__VAX_CPU_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)cpu.h 7.1 (Berkeley) 6/5/86 + */ + +#ifndef x_LOCORE +/* + * Cpu identification, from SID register. + */ +union x_cpusid { + x_int x_cpusid; + struct x_cpuany { + x_u_int :24, + x_cp_type:8; + } x_cpuany; + struct x_cpu8600 { + x_u_int x_cp_sno:12, /* serial number */ + x_cp_plant:4, /* plant number */ + x_cp_eco:8, /* eco level */ + x_cp_type:8; /* VAX_8600 */ + } x_cpu8600; + struct x_cpu780 { + x_u_int x_cp_sno:12, /* serial number */ + x_cp_plant:3, /* plant number */ + x_cp_eco:9, /* eco level */ + x_cp_type:8; /* VAX_780 */ + } x_cpu780; + struct x_cpu750 { + x_u_int x_cp_hrev:8, /* hardware rev level */ + x_cp_urev:8, /* ucode rev level */ + :8, + x_cp_type:8; /* VAX_750 */ + } x_cpu750; + struct x_cpu730 { + x_u_int :8, /* reserved */ + x_cp_urev:8, /* ucode rev level */ + :8, /* reserved */ + x_cp_type:8; /* VAX_730 */ + } x_cpu730; + struct x_cpu630 { + x_u_int :24, /* reserved */ + x_cp_type:8; /* VAX_630 */ + } x_cpu630; +}; +#endif +/* + * Vax CPU types. + * Similar types are grouped with their earliest example. + */ +#define x_VAX_780 1 +#define x_VAX_750 2 +#define x_VAX_730 3 +#define x_VAX_8600 4 +#define x_VAX_630 8 + +#define x_VAX_MAX 8 + +/* + * Main IO backplane types. + * This gives us a handle on how to do autoconfiguration. + */ +#define x_IO_SBI780 1 +#define x_IO_CMI750 2 +#define x_IO_XXX730 3 +#define x_IO_ABUS 4 +#define x_IO_QBUS 5 + +#ifndef x_LOCORE +/* + * Per-cpu information for system. + */ +struct x_percpu { + x_short x_pc_cputype; /* cpu type code */ + x_short x_pc_cpuspeed; /* relative speed of cpu */ + x_short x_pc_nioa; /* number of IO adaptors/nexus blocks */ + struct x_iobus *x_pc_io; /* descriptions of IO adaptors */ +}; + +struct x_iobus { + x_int x_io_type; /* io adaptor types */ + x_caddr_t x_io_addr; /* phys address of IO adaptor */ + x_int x_io_size; /* size of an IO space */ + x_caddr_t x_io_details; /* specific to adaptor types */ +}; + +/* + * Description of a main bus that maps "nexi", ala the 780 SBI. + */ +struct x_nexusconnect { + x_short x_psb_nnexus; /* number of nexus slots */ + struct x_nexus *x_psb_nexbase; /* base of nexus space */ +/* we should be able to have just one address for the unibus memories */ +/* and calculate successive addresses by adding to the base, but the 750 */ +/* doesn't obey the sensible rule: uba1 has a lower address than uba0! */ + x_caddr_t *x_psb_umaddr; /* unibus memory addresses */ + x_short x_psb_nubabdp; /* number of bdp's per uba */ + x_short x_psb_haveubasr; /* have uba status register */ +/* the 750 has some slots which don't promise to tell you their types */ +/* if this pointer is non-zero, then you get the type from this array */ +/* rather than from the (much more sensible) low byte of the config register */ + x_short *x_psb_nextype; /* botch */ +}; + +#ifdef x_KERNEL +x_int x_cpu; +struct x_percpu x_percpu[]; +#endif +#endif + +#endif diff --git a/x_include/vax/x_crl.h b/x_include/vax/x_crl.h new file mode 100644 index 0000000..0b3f061 --- /dev/null +++ b/x_include/vax/x_crl.h @@ -0,0 +1,85 @@ +#include "x_.h" + +#ifndef x__VAX_CRL_H_ +#define x__VAX_CRL_H_ + +/* + * @(#)crl.h 7.1 (Berkeley) 6/5/86 + */ + +/**************************************************************** + * * + * Licensed from Digital Equipment Corporation * + * Copyright (c) * + * Digital Equipment Corporation * + * Maynard, Massachusetts * + * 1985, 1986 * + * All rights reserved. * + * * + * The Information in this software is subject to change * + * without notice and should not be construed as a commitment * + * by Digital Equipment Corporation. Digital makes no * + * representations about the suitability of this software for * + * any purpose. It is supplied "As Is" without expressed or * + * implied warranty. * + * * + * If the Regents of the University of California or its * + * licensees modify the software in a manner creating * + * diriviative copyright rights, appropriate copyright * + * legends may be placed on the drivative work in addition * + * to that set forth above. * + ****************************************************************/ + +#if x_VAX8600 +/* + * Console RL02 status of current transfer (read only) + */ +#define x_CRL_S_XCMPLT 1 /* transaction complete */ +#define x_CRL_S_XCONT 2 /* continue transaction */ +#define x_CRL_S_ABORT 3 /* transation abort */ +#define x_CRL_S_RETSTS 4 /* return device status */ +#define x_CRL_S_HNDSHK 0x80 /* handshake err during transaction */ +#define x_CRL_S_HWERR 0x81 /* hardware err during transaction */ + +/* + * Console RL02 function codes + */ +#define x_CRL_F_NOOP 0 /* No operation */ +#define x_CRL_F_RSTSTS 2 /* reset and return device status */ +#define x_CRL_F_ABORT 3 /* abort transfer */ +#define x_CRL_F_RETSTS 4 /* read device status */ +#define x_CRL_F_WRITE 5 /* write block data */ +#define x_CRL_F_READ 6 /* read block data */ + +/* + * Console sectoring information. + * The console understands the rl02 as having 512 byte sectors. + */ +#define x_CRLBYSEC 512 /* bytes/sector */ +#define x_MAXSEC 20480 /* sectors/rl02 */ + +/* + * STXCS bit definitions + */ +#define x_STXCS_RDY 0x00000080 /* ready bit */ +#define x_STXCS_IE 0x00000040 /* interrupt enable */ + +#define x_CRLERRS 5 /* number of retries before quitting */ + +/* + * The state byte is used to retain exclusivity, + * and contains the busy flag. + */ +#define x_CRL_IDLE 0 +#define x_CRL_OPEN 1 +#define x_CRL_BUSY 2 + +#define x_CRLDS_BITS \ +"\20\20WDE\17CHE\16WL\15SKTO\14SPE\13WGE\12VC\11DSE\ +\10Dx_T\7x_HS\6x_CO\5x_HO\4x_BH\3x_STC\2x_STB\1x_STA" + +#define x_CRLCS_BITS \ +"\20\20CE\17DE\16NXM\15DLT\14DCRC\13OPI\1DRDY" +#endif + +#endif diff --git a/x_include/vax/x_dkio.h b/x_include/vax/x_dkio.h new file mode 100644 index 0000000..84654c1 --- /dev/null +++ b/x_include/vax/x_dkio.h @@ -0,0 +1,27 @@ +#include "x_.h" + +#ifndef x__VAX_DKIO_H_ +#define x__VAX_DKIO_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)dkio.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Structures and definitions for disk io control commands + * + * THIS WHOLE AREA NEEDS MORE THOUGHT. FOR NOW JUST IMPLEMENT + * ENOUGH TO READ AND WRITE HEADERS ON MASSBUS DISKS. EVENTUALLY + * SHOULD BE ABLE TO DETERMINE DRIVE TYPE AND DO OTHER GOOD STUFF. + */ + +/* disk io control commands */ +#define x_DKIOCHDR x__IO(x_d, 1) /* next I/O will read/write header */ + +#endif diff --git a/x_include/vax/x_flp.h b/x_include/vax/x_flp.h new file mode 100644 index 0000000..8e8e8de --- /dev/null +++ b/x_include/vax/x_flp.h @@ -0,0 +1,58 @@ +#include "x_.h" + +#ifndef x__VAX_FLP_H_ +#define x__VAX_FLP_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)flp.h 7.1 (Berkeley) 6/5/86 + */ + +#if x_VAX780 +/* + * Console floppy command/status and sectoring information. + */ +#define x_FL_FFC 0x200 /* floppy function complete */ +#define x_FL_ERR 0x80 /* error bit in floppy status byte */ +#define x_FL_PERR 0x905 /* floppy protocol error */ +#define x_FL_DATA 0x100 /* floppy data select code */ +#define x_FL_RS 0x900 /* floppy read sector command */ +#define x_FL_WS 0x901 /* floppy write sector command*/ +#define x_FL_STAT 0x902 /* floppy get status command*/ +#define x_FL_CANCEL 0x904 /* cancel floppy function */ + +#define x_RXFTRK 77 /* tracks/floppy */ +#define x_RXSTRK 26 /* sectors/track */ +#define x_RXBYSEC 128 /* bytes/sector */ +#define x_MAXSEC (x_RXFTRK*x_RXSTRK) /* sectors/floppy */ + +/* + * In the floppy driver routines, the device active byte is used + * not as a boolean, but as an indicator of the state we are in. + * That is, it contains what to do on the next interrupt. + */ + +#define x_FL_IDLE 0 /* floppy idle */ +#define x_FL_MAND 1 /* about to send read/write command */ +#define x_FL_SEC 2 /* about to send sector # to LSI */ +#define x_FL_TRACK 3 /* about to send track # to LSI */ +#define x_FL_DAX 4 /* transmitting data */ +#define x_FL_DAR 5 /* receiving data */ +#define x_FL_COM 6 /* completing transmission */ +#define x_FL_CAN 7 /* give cancel order - we had an error, + and are to restart */ + +#define x_FLERRS 5 /* number of retries before quitting */ + +/* + * The state byte is used to retain exclusivity, + * and contains the busy flag. + */ +#define x_FL_OPEN 1 +#define x_FL_BUSY 2 +#endif + +#endif diff --git a/x_include/vax/x_frame.h b/x_include/vax/x_frame.h new file mode 100644 index 0000000..2c54ed3 --- /dev/null +++ b/x_include/vax/x_frame.h @@ -0,0 +1,31 @@ +#include "x_.h" + +#ifndef x__VAX_FRAME_H_ +#define x__VAX_FRAME_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)frame.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Definition of the vax calls/callg frame. + */ +struct x_frame { + x_int x_fr_handler; + x_u_int x_fr_psw:16, /* saved psw */ + x_fr_mask:12, /* register save mask */ + :1, + x_fr_s:1, /* call was a calls, not callg */ + x_fr_spa:2; /* stack pointer alignment */ + x_int x_fr_savap; /* saved arg pointer */ + x_int x_fr_savfp; /* saved frame pointer */ + x_int x_fr_savpc; /* saved program counter */ +}; + +#endif diff --git a/x_include/vax/x_ioa.h b/x_include/vax/x_ioa.h new file mode 100644 index 0000000..9d755f7 --- /dev/null +++ b/x_include/vax/x_ioa.h @@ -0,0 +1,96 @@ +#include "x_.h" + +#ifndef x__VAX_IOA_H_ +#define x__VAX_IOA_H_ + +#include + +/* + * @(#)ioa.h 7.1 (Berkeley) 6/5/86 + */ + +/**************************************************************** + * * + * Licensed from Digital Equipment Corporation * + * Copyright (c) * + * Digital Equipment Corporation * + * Maynard, Massachusetts * + * 1985, 1986 * + * All rights reserved. * + * * + * The Information in this software is subject to change * + * without notice and should not be construed as a commitment * + * by Digital Equipment Corporation. Digital makes no * + * representations about the suitability of this software for * + * any purpose. It is supplied "As Is" without expressed or * + * implied warranty. * + * * + * If the Regents of the University of California or its * + * licensees modify the software in a manner creating * + * diriviative copyright rights, appropriate copyright * + * legends may be placed on the drivative work in addition * + * to that set forth above. * + * * + ****************************************************************/ + +#define x_MAXNIOA 4 +#define x_NIOA8600 2 +#define x_IOASIZE 0x2000000 +#define x_IOAMAPSIZ 512 /* Map one page to get at SBIA regs */ +#define x_IOA8600(x_i) ((x_caddr_t)(0x20080000+x_IOASIZE*x_i)) + +#ifndef x_LOCORE +struct x_sbia_regs { + x_int x_sbi_cfg; + x_int x_sbi_csr; + x_int x_sbi_errsum; + x_int x_sbi_dctl; + x_int x_sbi_dmaica; + x_int x_sbi_dmaiid; + x_int x_sbi_dmaaca; + x_int x_sbi_dmaaid; + x_int x_sbi_dmabcs; + x_int x_sbi_dmabid; + x_int x_sbi_dmaccs; + x_int x_sbi_dmacid; + x_int x_sbi_silo; + x_int x_sbi_error; + x_int x_sbi_timo; + x_int x_sbi_fltsts; + x_int x_sbi_silcmp; + x_int x_sbi_maint; + x_int x_sbi_unjam; + x_int x_sbi_qclr; + x_int x_sbi_unused[12]; + x_int x_sbi_iv10; + x_int x_sbi_iv11; + x_int x_sbi_iv12; + x_int x_sbi_iv13; + x_int x_sbi_iv14; + x_int x_sbi_iv15; + x_int x_sbi_iv16; + x_int x_sbi_iv17; + x_int x_sbi_iv18; + x_int x_sbi_iv19; + x_int x_sbi_iv1a; + x_int x_sbi_iv1b; + x_int x_sbi_iv1c; + x_int x_sbi_iv1d; + x_int x_sbi_iv1e; +}; +struct x_ioa { + union x_ioacsr { + x_long x_ioa_csr; + x_u_char x_ioa_type; + } x_ioacsr; + x_long x_ioa_pad[x_IOAMAPSIZ / sizeof (x_long) - 1]; +}; +#ifdef x_KERNEL +struct x_ioa x_ioa[x_MAXNIOA]; +#endif +#endif + +#define x_IOA_TYPMSK 0xf0 +#define x_IOA_SBIA 0x10 + +#endif diff --git a/x_include/vax/x_ka630.h b/x_include/vax/x_ka630.h new file mode 100644 index 0000000..87a1069 --- /dev/null +++ b/x_include/vax/x_ka630.h @@ -0,0 +1,87 @@ +#include "x_.h" + +#ifndef x__VAX_KA630_H_ +#define x__VAX_KA630_H_ + +#include + +/* + * @(#)ka630.h 7.1 (Berkeley) 6/5/86 + * + * Definitions specific to the ka630 uvax2 cpu card. Includes the tod + * clock chip and the cpu registers. + */ +#ifdef x_VAX630 +/* Bdr register bits */ +#define x_KA630BDR_PWROK 0x8000 +#define x_KA630BDR_HLTENB 0x4000 +#define x_KA630BDR_CPU 0x0c00 +#define x_KA630BDR_BDG 0x0300 +#define x_KA630BDR_DSPL 0x000f + +/* Memory system err reg. */ +#define x_KA630MSER_CD 0x00000300 +#define x_KA630MSER_NXM 0x00000080 +#define x_KA630MSER_LPE 0x00000040 +#define x_KA630MSER_QPE 0x00000020 +#define x_KA630MSER_MERR 0x000000f0 +#define x_KA630MSER_CPUER 0x00000060 +#define x_KA630MSER_DQPE 0x00000010 +#define x_KA630MSER_LEB 0x00000008 +#define x_KA630MSER_WRWP 0x00000002 +#define x_KA630MSER_PAREN 0x00000001 + +/* Mem. error address regs. */ +#define x_KA630CEAR_PG 0x00007fff +#define x_KA630DEAR_PG 0x00007fff + +/* Clock registers and constants */ +#define x_MINSEC 60 +#define x_HRSEC 3600 + +#define x_KA630CLK_VRT 0200 +#define x_KA630CLK_UIP 0200 +#define x_KA630CLK_RATE 040 +#define x_KA630CLK_ENABLE 06 +#define x_KA630CLK_SET 0206 +/* cpmbx bits */ +#define x_KA630CLK_HLTACT 03 +/* halt action values */ +#define x_KA630CLK_RESTRT 01 +#define x_KA630CLK_REBOOT 02 +#define x_KA630CLK_HALT 03 +/* in progress flags */ +#define x_KA630CLK_BOOT 04 +#define x_KA630CLK_RSTRT 010 +#define x_KA630CLK_LANG 0360 + +#ifndef x_LOCORE +struct x_cldevice { + x_u_short x_sec; + x_u_short x_secalrm; + x_u_short x_min; + x_u_short x_minalrm; + x_u_short x_hr; + x_u_short x_hralrm; + x_u_short x_dayofwk; + x_u_short x_day; + x_u_short x_mon; + x_u_short x_yr; + x_u_short x_csr0; + x_u_short x_csr1; + x_u_short x_csr2; + x_u_short x_csr3; + x_u_short x_cpmbx; /* CPMBX is used by the boot rom. see ka630-ug-3.3.3 */ +}; + +struct x_ka630cpu { + x_u_short x_ka630_bdr; + x_u_short x_ka630_xxx; + x_u_long x_ka630_mser; + x_u_long x_ka630_cear; + x_u_long x_ka630_dear; +}; +#endif +#endif + +#endif diff --git a/x_include/vax/x_machparam.h b/x_include/vax/x_machparam.h new file mode 100644 index 0000000..fd50957 --- /dev/null +++ b/x_include/vax/x_machparam.h @@ -0,0 +1,65 @@ +#include "x_.h" + +#ifndef x__VAX_MACHPARAM_H_ +#define x__VAX_MACHPARAM_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)machparam.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Machine dependent constants for vax. + */ +#define x_NBPG 512 /* bytes/page */ +#define x_PGOFSET (x_NBPG-1) /* byte offset into page */ +#define x_PGSHIFT 9 /* LOG2(NBPG) */ + +#define x_CLSIZE 2 +#define x_CLSIZELOG2 1 + +#define x_SSIZE 4 /* initial stack size/NBPG */ +#define x_SINCR 4 /* increment of stack/NBPG */ + +#define x_UPAGES 10 /* pages of u-area */ + +/* + * Some macros for units conversion + */ +/* Core clicks (512 bytes) to segments and vice versa */ +#define x_ctos(x_x) (x_x) +#define x_stoc(x_x) (x_x) + +/* Core clicks (512 bytes) to disk blocks */ +#define x_ctod(x_x) (x_x) +#define x_dtoc(x_x) (x_x) +#define x_dtob(x_x) ((x_x)<<9) + +/* clicks to bytes */ +#define x_ctob(x_x) ((x_x)<<9) + +/* bytes to clicks */ +#define x_btoc(x_x) ((((unsigned)(x_x)+511)>>9)) + +/* + * Macros to decode processor status word. + */ +#define x_USERMODE(x_ps) (((x_ps) & x_PSL_CURMOD) == x_PSL_CURMOD) +#define x_BASEPRI(x_ps) (((x_ps) & x_PSL_IPL) == 0) + +#ifdef x_KERNEL +#ifndef x_LOCORE +x_int x_cpuspeed; +#endif +#define x_DELAY(x_n) { register x_int x_N = x_cpuspeed * (x_n); while (--x_N > 0); } + +#else +#define x_DELAY(x_n) { register x_int x_N = (x_n); while (--x_N > 0); } +#endif + +#endif diff --git a/x_include/vax/x_mem.h b/x_include/vax/x_mem.h new file mode 100644 index 0000000..b17ad8e --- /dev/null +++ b/x_include/vax/x_mem.h @@ -0,0 +1,179 @@ +#include "x_.h" + +#ifndef x__VAX_MEM_H_ +#define x__VAX_MEM_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)mem.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Memory controller registers + * + * The way in which the data is stored in these registers varies + * per controller and cpu, so we define macros here to mask that. + */ +struct x_mcr { + x_int x_mc_reg[6]; +}; + +/* + * Compute maximum possible number of memory controllers, + * for sizing of the mcraddr array. + */ +#if x_VAX780 +#define x_MAXNMCR 4 +#else +#define x_MAXNMCR 1 +#endif + +/* + * For each controller type we define 5 macros: + * M???_INH(mcr) inhibits further crd interrupts from mcr + * M???_ENA(mcr) enables another crd interrupt from mcr + * M???_ERR(mcr) tells whether an error is waiting + * M???_SYN(mcr) gives the syndrome bits of the error + * M???_ADDR(mcr) gives the address of the error + */ + +#if x_VAX8600 +/* + * 8600 register bit definitions + */ +#define x_M8600_ICRD 0x400 /* inhibit crd interrupts */ +#define x_M8600_TB_ERR 0xf00 /* translation buffer error mask */ +/* + * MDECC register + */ +#define x_M8600_ADDR_PE 0x080000 /* address parity error */ +#define x_M8600_DBL_ERR 0x100000 /* data double bit error */ +#define x_M8600_SNG_ERR 0x200000 /* data single bit error */ +#define x_M8600_BDT_ERR 0x400000 /* bad data error */ + +/* + * ESPA register is used to address scratch pad registers in the Ebox. + * To access a register in the scratch pad, write the ESPA with the address + * and then read the ESPD register. + * + * NOTE: In assmebly code, the the mfpr instruction that reads the ESPD + * register must immedately follow the mtpr instruction that setup + * the ESPA register -- per the VENUS processor register spec. + * + * The scratchpad registers that are supplied for a single bit ECC + * error are: + */ +#define x_SPAD_MSTAT1 0x25 /* scratch pad mstat1 register */ +#define x_SPAD_MSTAT2 0x26 /* scratch pad mstat2 register */ +#define x_SPAD_MDECC 0x27 /* scratch pad mdecc register */ +#define x_SPAD_MEAR 0x2a /* scratch pad mear register */ + +#define x_M8600_MEMERR(x_mdecc) ((x_mdecc) & 0x780000) +#define x_M8600_HRDERR(x_mdecc) ((x_mdecc) & 0x580000) +#define x_M8600_ENA (x_mtpr(x_MERG, (x_mfpr(x_MERG) & ~x_M8600_ICRD))) +#define x_M8600_INH (x_mtpr(x_EHSR, 0), x_mtpr(x_MERG, (x_mfpr(x_MERG) | x_M8600_ICRD))) +#define x_M8600_SYN(x_mdecc) (((x_mdecc) >> 9) & 0x3f) +#define x_M8600_ADDR(x_mear) ((x_mear) & 0x3ffffffc) +#define x_M8600_ARRAY(x_mear) (((x_mear) >> 22) & 0x0f) + +#define x_M8600_MDECC_BITS "\20\27BAD_DT_ERR\26SNG_BIT_ERR\25DBL_BIT_ERR\ +\24x_ADDR_PE" +#define x_M8600_MSTAT1_BITS "\20\30CPR_PE_A\27CPR_PE_B\26ABUS_DT_PE\ +\25x_ABUS_CTL_MSK_PE\24x_ABUS_ADR_PE\23x_ABUS_C/x_A_CYCLE\22x_ABUS_ADP_1\21x_ABUS_ADP_0\ +\20x_TB_MISS\17x_BLK_HIT\16x_C0_TAG_MISS\15x_CHE_MISS\14x_TB_VAL_ERR\13x_TB_PTE_B_PE\ +\12x_TB_PTE_A_PE\11x_TB_TAG_PE\10x_WR_DT_PE_B3\7x_WR_DT_PE_B2\6x_WR_DT_PE_B1\ +\5x_WR_DT_PE_B0\4x_CHE_RD_DT_PE\3x_CHE_SEL\2x_ANY_REFL\1x_CP_BW_CHE_DT_PE" +#define x_M8600_MSTAT2_BITS "\20\20CP_BYT_WR\17ABUS_BD_DT_CODE\10MULT_ERR\ +\7x_CHE_TAG_PE\6x_CHE_TAG_W_PE\5x_CHE_WRTN_BIT\4x_NXM\3x_CP-x_IO_BUF_ERR\2x_MBOX_LOCK" +#endif + +#if x_VAX780 +#define x_M780_ICRD 0x40000000 /* inhibit crd interrupts, in [2] */ +#define x_M780_HIER 0x20000000 /* high error rate, in reg[2] */ +#define x_M780_ERLOG 0x10000000 /* error log request, in reg[2] */ +/* on a 780, memory crd's occur only when bit 15 is set in the SBIER */ +/* register; bit 14 there is an error bit which we also clear */ +/* these bits are in the back of the ``red book'' (or in the VMS code) */ + +#define x_M780C_INH(x_mcr) \ + (((x_mcr)->x_mc_reg[2] = (x_M780_ICRD|x_M780_HIER|x_M780_ERLOG)), x_mtpr(x_SBIER, 0)) +#define x_M780C_ENA(x_mcr) \ + (((x_mcr)->x_mc_reg[2] = (x_M780_HIER|x_M780_ERLOG)), x_mtpr(x_SBIER, 3<<14)) +#define x_M780C_ERR(x_mcr) \ + ((x_mcr)->x_mc_reg[2] & (x_M780_ERLOG)) + +#define x_M780C_SYN(x_mcr) ((x_mcr)->x_mc_reg[2] & 0xff) +#define x_M780C_ADDR(x_mcr) (((x_mcr)->x_mc_reg[2] >> 8) & 0xfffff) + +#define x_M780EL_INH(x_mcr) \ + (((x_mcr)->x_mc_reg[2] = (x_M780_ICRD|x_M780_HIER|x_M780_ERLOG)), x_mtpr(x_SBIER, 0)) +#define x_M780EL_ENA(x_mcr) \ + (((x_mcr)->x_mc_reg[2] = (x_M780_HIER|x_M780_ERLOG)), x_mtpr(x_SBIER, 3<<14)) +#define x_M780EL_ERR(x_mcr) \ + ((x_mcr)->x_mc_reg[2] & (x_M780_ERLOG)) + +#define x_M780EL_SYN(x_mcr) ((x_mcr)->x_mc_reg[2] & 0x7f) +#define x_M780EL_ADDR(x_mcr) (((x_mcr)->x_mc_reg[2] >> 11) & 0x1ffff) + +#define x_M780EU_INH(x_mcr) \ + (((x_mcr)->x_mc_reg[3] = (x_M780_ICRD|x_M780_HIER|x_M780_ERLOG)), x_mtpr(x_SBIER, 0)) +#define x_M780EU_ENA(x_mcr) \ + (((x_mcr)->x_mc_reg[3] = (x_M780_HIER|x_M780_ERLOG)), x_mtpr(x_SBIER, 3<<14)) +#define x_M780EU_ERR(x_mcr) \ + ((x_mcr)->x_mc_reg[3] & (x_M780_ERLOG)) + +#define x_M780EU_SYN(x_mcr) ((x_mcr)->x_mc_reg[3] & 0x7f) +#define x_M780EU_ADDR(x_mcr) (((x_mcr)->x_mc_reg[3] >> 11) & 0x1ffff) +#endif + +#if x_VAX750 +#define x_M750_ICRD 0x10000000 /* inhibit crd interrupts, in [1] */ +#define x_M750_UNCORR 0xc0000000 /* uncorrectable error, in [0] */ +#define x_M750_CORERR 0x20000000 /* correctable error, in [0] */ + +#define x_M750_INH(x_mcr) ((x_mcr)->x_mc_reg[1] = 0) +#define x_M750_ENA(x_mcr) ((x_mcr)->x_mc_reg[0] = (x_M750_UNCORR|x_M750_CORERR), \ + (x_mcr)->x_mc_reg[1] = x_M750_ICRD) +#define x_M750_ERR(x_mcr) ((x_mcr)->x_mc_reg[0] & (x_M750_UNCORR|x_M750_CORERR)) + +#define x_M750_SYN(x_mcr) ((x_mcr)->x_mc_reg[0] & 0x7f) +#define x_M750_ADDR(x_mcr) (((x_mcr)->x_mc_reg[0] >> 9) & 0x7fff) +#endif + +#if x_VAX730 +#define x_M730_UNCORR 0x80000000 /* rds, uncorrectable error, in [1] */ +#define x_M730_CRD 0x40000000 /* crd, in [1] */ +#define x_M730_FTBPE 0x20000000 /* force tbuf parity error, in [1] */ +#define x_M730_ENACRD 0x10000000 /* enable crd interrupt, in [1] */ +#define x_M730_MME 0x08000000 /* mem-man enable (ala ipr), in [1] */ +#define x_M730_DM 0x04000000 /* diagnostic mode, in [1] */ +#define x_M730_DISECC 0x02000000 /* disable ecc, in [1] */ + +#define x_M730_INH(x_mcr) ((x_mcr)->x_mc_reg[1] = x_M730_MME) +#define x_M730_ENA(x_mcr) ((x_mcr)->x_mc_reg[1] = (x_M730_MME|x_M730_ENACRD)) +#define x_M730_ERR(x_mcr) ((x_mcr)->x_mc_reg[1] & (x_M730_UNCORR|x_M730_CRD)) +#define x_M730_SYN(x_mcr) ((x_mcr)->x_mc_reg[0] & 0x7f) +#define x_M730_ADDR(x_mcr) (((x_mcr)->x_mc_reg[0] >> 8) & 0x7fff) +#endif + +/* controller types */ +#define x_M780C 1 +#define x_M780EL 2 +#define x_M780EU 3 +#define x_M750 4 +#define x_M730 5 + +#define x_MEMINTVL (60*10) /* 10 minutes */ + +#ifdef x_KERNEL +x_int x_nmcr; +struct x_mcr *x_mcraddr[x_MAXNMCR]; +x_int x_mcrtype[x_MAXNMCR]; +#endif + +#endif diff --git a/x_include/vax/x_mscp.h b/x_include/vax/x_mscp.h new file mode 100644 index 0000000..a485259 --- /dev/null +++ b/x_include/vax/x_mscp.h @@ -0,0 +1,321 @@ +#include "x_.h" + +#ifndef x__VAX_MSCP_H_ +#define x__VAX_MSCP_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)mscp.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Definitions for the Mass Storage Control Protocol + */ + +/* + * Control message opcodes + */ +#define x_M_OP_ABORT 0001 /* Abort command */ +#define x_M_OP_GTCMD 0002 /* Get command status command */ +#define x_M_OP_GTUNT 0003 /* Get unit status command */ +#define x_M_OP_STCON 0004 /* Set controller characteristics command */ +#define x_M_OP_SEREX 0007 /* Serious exception end message */ +#define x_M_OP_AVAIL 0010 /* Available command */ +#define x_M_OP_ONLIN 0011 /* Online command */ +#define x_M_OP_STUNT 0012 /* Set unit characteristics command */ +#define x_M_OP_DTACP 0013 /* Determine access paths command */ +#define x_M_OP_ACCES 0020 /* Access command */ +#define x_M_OP_CMPCD 0021 /* Compare controller data command */ +#define x_M_OP_ERASE 0022 /* Erase command */ +#define x_M_OP_FLUSH 0023 /* Flush command */ +#define x_M_OP_REPLC 0024 /* Replace command */ +#define x_M_OP_COMP 0040 /* Compare host data command */ +#define x_M_OP_READ 0041 /* Read command */ +#define x_M_OP_WRITE 0042 /* Write command */ +#define x_M_OP_AVATN 0100 /* Available attention message */ +#define x_M_OP_DUPUN 0101 /* Duplicate unit number attention message */ +#define x_M_OP_ACPTH 0102 /* Access path attention message */ +#define x_M_OP_END 0200 /* End message flag */ + +/* + * Generic command modifiers + */ +#define x_M_MD_EXPRS 0100000 /* Express request */ +#define x_M_MD_COMP 0040000 /* Compare */ +#define x_M_MD_CLSEX 0020000 /* Clear serious exception */ +#define x_M_MD_ERROR 0010000 /* Force error */ +#define x_M_MD_SCCHH 0004000 /* Suppress caching (high speed) */ +#define x_M_MD_SCCHL 0002000 /* Suppress caching (low speed) */ +#define x_M_MD_SECOR 0001000 /* Suppress error correction */ +#define x_M_MD_SEREC 0000400 /* Suppress error recovery */ +#define x_M_MD_SSHDW 0000200 /* Suppress shadowing */ +#define x_M_MD_WBKNV 0000100 /* Write back (non-volatile) */ +#define x_M_MD_WBKVL 0000040 /* Write back (volatile) */ +#define x_M_MD_WRSEQ 0000020 /* Write shadow set one unit at a time */ + +/* + * AVAILABLE command modifiers + */ +#define x_M_MD_ALLCD 0000002 /* All class drivers */ +#define x_M_MD_SPNDW 0000001 /* Spin down */ + +/* + * FLUSH command modifiers + */ +#define x_M_MD_FLENU 0000001 /* Flush entire unit */ +#define x_M_MD_VOLTL 0000002 /* Volatile only */ + +/* + * GET UNIT STATUS command modifiers + */ +#define x_M_MD_NXUNT 0000001 /* Next unit */ + +/* + * ONLINE command modifiers + */ +#define x_M_MD_RIP 0000001 /* Allow self destruction */ +#define x_M_MD_IGNMF 0000002 /* Ignore media format error */ + +/* + * ONLINE and SET UNIT CHARACTERISTICS command modifiers + */ +#define x_M_MD_ALTHI 0000040 /* Alter host identifier */ +#define x_M_MD_SHDSP 0000020 /* Shadow unit specified */ +#define x_M_MD_CLWBL 0000010 /* Clear write-back data lost */ +#define x_M_MD_STWRP 0000004 /* Set write protect */ + +/* + * REPLACE command modifiers + */ +#define x_M_MD_PRIMR 0000001 /* Primary replacement block */ + +/* + * End message flags + */ +#define x_M_EF_BBLKR 0200 /* Bad block reported */ +#define x_M_EF_BBLKU 0100 /* Bad block unreported */ +#define x_M_EF_ERLOG 0040 /* Error log generated */ +#define x_M_EF_SEREX 0020 /* Serious exception */ + +/* + * Controller flags + */ +#define x_M_CF_ATTN 0200 /* Enable attention messages */ +#define x_M_CF_MISC 0100 /* Enable miscellaneous error log messages */ +#define x_M_CF_OTHER 0040 /* Enable other host's error log messages */ +#define x_M_CF_THIS 0020 /* Enable this host's error log messages */ +#define x_M_CF_MLTHS 0004 /* Multi-host */ +#define x_M_CF_SHADW 0002 /* Shadowing */ +#define x_M_CF_576 0001 /* 576 byte sectors */ + +/* + * Unit flags + */ +#define x_M_UF_REPLC 0100000 /* Controller initiated bad block replacement */ +#define x_M_UF_INACT 0040000 /* Inactive shadow set unit */ +#define x_M_UF_WRTPH 0020000 /* Write protect (hardware) */ +#define x_M_UF_WRTPS 0010000 /* Write protect (software or volume) */ +#define x_M_UF_SCCHH 0004000 /* Suppress caching (high speed) */ +#define x_M_UF_SCCHL 0002000 /* Suppress caching (low speed) */ +#define x_M_UF_RMVBL 0000200 /* Removable media */ +#define x_M_UF_WBKNV 0000100 /* Write back (non-volatile) */ +#define x_M_UF_576 0000004 /* 576 byte sectors */ +#define x_M_UF_CMPWR 0000002 /* Compare writes */ +#define x_M_UF_CMPRD 0000001 /* Compare reads */ + +/* + * Status codes + */ +#define x_M_ST_MASK 037 /* Status code mask */ +#define x_M_ST_SUCC 000 /* Success */ +#define x_M_ST_ICMD 001 /* Invalid command */ +#define x_M_ST_ABRTD 002 /* Command aborted */ +#define x_M_ST_OFFLN 003 /* Unit offline */ +#define x_M_ST_AVLBL 004 /* Unit available */ +#define x_M_ST_MFMTE 005 /* Media format error */ +#define x_M_ST_WRTPR 006 /* Write protected */ +#define x_M_ST_COMP 007 /* Compare error */ +#define x_M_ST_DATA 010 /* Data error */ +#define x_M_ST_HSTBF 011 /* Host buffer access error */ +#define x_M_ST_CNTLR 012 /* Controller error */ +#define x_M_ST_DRIVE 013 /* Drive error */ +#define x_M_ST_DIAG 037 /* Message from an internal diagnostic */ + +/* + * An MSCP packet + */ + +struct x_mscp { + struct x_mscp_header x_mscp_header;/* device specific header */ + x_long x_mscp_cmdref; /* command reference number */ + x_short x_mscp_unit; /* unit number */ + x_short x_mscp_xxx1; /* unused */ + x_u_char x_mscp_opcode; /* opcode */ + x_u_char x_mscp_flags; /* end message flags */ + x_short x_mscp_modifier; /* modifiers */ + union { + struct { + x_long x_Mscp_bytecnt; /* byte count */ + x_long x_Mscp_buffer; /* buffer descriptor */ + x_long x_Mscp_xxx2[2]; /* unused */ + x_long x_Mscp_lbn; /* logical block number */ + x_long x_Mscp_xxx4; /* unused */ + x_long *x_Mscp_dscptr; /* pointer to descriptor (software) */ + x_long x_Mscp_sftwds[4]; /* software words, padding */ + } x_mscp_generic; + struct { + x_short x_Mscp_version; /* MSCP version */ + x_short x_Mscp_cntflgs; /* controller flags */ + x_short x_Mscp_hsttmo; /* host timeout */ + x_short x_Mscp_usefrac; /* use fraction */ + x_long x_Mscp_time; /* time and date */ + } x_mscp_setcntchar; + struct { + x_short x_Mscp_multunt; /* multi-unit code */ + x_short x_Mscp_unitflgs; /* unit flags */ + x_long x_Mscp_hostid; /* host identifier */ + x_quad x_Mscp_unitid; /* unit identifier */ + x_long x_Mscp_mediaid; /* media type identifier */ + x_short x_Mscp_shdwunt; /* shadow unit */ + x_short x_Mscp_shdwsts; /* shadow status */ + x_short x_Mscp_track; /* track size */ + x_short x_Mscp_group; /* group size */ + x_short x_Mscp_cylinder; /* cylinder size */ + x_short x_Mscp_xxx3; /* reserved */ + x_short x_Mscp_rctsize; /* RCT table size */ + char x_Mscp_rbns; /* RBNs / track */ + char x_Mscp_rctcpys; /* RCT copies */ + } x_mscp_getunitsts; + } x_mscp_un; + x_short x_mscp_fil1; + x_short x_mscp_fil2; + x_short x_mscp_fil3; +}; + +#define x_mscp_msglen (sizeof (struct x_mscp) - sizeof(struct x_mscp_header)) + +/* + * generic packet + */ + +#define x_mscp_bytecnt x_mscp_un.x_mscp_generic.x_Mscp_bytecnt +#define x_mscp_buffer x_mscp_un.x_mscp_generic.x_Mscp_buffer +#define x_mscp_lbn x_mscp_un.x_mscp_generic.x_Mscp_lbn +#define x_mscp_dscptr x_mscp_un.x_mscp_generic.x_Mscp_dscptr +#define x_mscp_sftwds x_mscp_un.x_mscp_generic.x_Mscp_sftwds +#define x_mscp_status x_mscp_modifier + +/* + * Abort / Get Command Status packet + */ + +#define x_mscp_outref x_mscp_bytecnt + +/* + * Online / Set Unit Characteristics packet + */ + +#define x_mscp_errlgfl x_mscp_lbn +#define x_mscp_copyspd x_mscp_shdwsts + +/* + * Replace packet + */ + +#define x_mscp_rbn x_mscp_bytecnt + +/* + * Set Controller Characteristics packet + */ + +#define x_mscp_version x_mscp_un.x_mscp_setcntchar.x_Mscp_version +#define x_mscp_cntflgs x_mscp_un.x_mscp_setcntchar.x_Mscp_cntflgs +#define x_mscp_hsttmo x_mscp_un.x_mscp_setcntchar.x_Mscp_hsttmo +#define x_mscp_usefrac x_mscp_un.x_mscp_setcntchar.x_Mscp_usefrac +#define x_mscp_time x_mscp_un.x_mscp_setcntchar.x_Mscp_time + +/* + * Get Unit Status end packet + */ + +#define x_mscp_multunt x_mscp_un.x_mscp_getunitsts.x_Mscp_multunt +#define x_mscp_unitflgs x_mscp_un.x_mscp_getunitsts.x_Mscp_unitflgs +#define x_mscp_hostid x_mscp_un.x_mscp_getunitsts.x_Mscp_hostid +#define x_mscp_unitid x_mscp_un.x_mscp_getunitsts.x_Mscp_unitid +#define x_mscp_mediaid x_mscp_un.x_mscp_getunitsts.x_Mscp_mediaid +#define x_mscp_shdwunt x_mscp_un.x_mscp_getunitsts.x_Mscp_shdwunt +#define x_mscp_shdwsts x_mscp_un.x_mscp_getunitsts.x_Mscp_shdwsts +#define x_mscp_track x_mscp_un.x_mscp_getunitsts.x_Mscp_track +#define x_mscp_group x_mscp_un.x_mscp_getunitsts.x_Mscp_group +#define x_mscp_cylinder x_mscp_un.x_mscp_getunitsts.x_Mscp_cylinder +#define x_mscp_rctsize x_mscp_un.x_mscp_getunitsts.x_Mscp_rctsize +#define x_mscp_rbns x_mscp_un.x_mscp_getunitsts.x_Mscp_rbns +#define x_mscp_rctcpys x_mscp_un.x_mscp_getunitsts.x_Mscp_rctcpys + +/* + * Online / Set Unit Characteristics end packet + */ + +#define x_mscp_untsize x_mscp_dscptr +#define x_mscp_volser x_mscp_sftwds[0] + +/* + * Set Controller Characteristics end packet + */ + +#define x_mscp_cnttmo x_mscp_hsttmo +#define x_mscp_cntcmdl x_mscp_usefrac +#define x_mscp_cntid x_mscp_unitid + +/* + * Error Log message format codes + */ +#define x_M_FM_CNTERR 0 /* Controller error */ +#define x_M_FM_BUSADDR 1 /* Host memory access error */ +#define x_M_FM_DISKTRN 2 /* Disk transfer error */ +#define x_M_FM_SDI 3 /* SDI error */ +#define x_M_FM_SMLDSK 4 /* Small disk error */ + +/* + * Error Log message flags + */ +#define x_M_LF_SUCC 0200 /* Operation successful */ +#define x_M_LF_CONT 0100 /* Operation continuing */ +#define x_M_LF_SQNRS 0001 /* Sequence number reset */ + +/* + * MSCP Error Log packet + * + * NOTE: MSCP packet must be padded to this size. + */ + +struct x_mslg { + struct x_mscp_header x_mslg_header;/* device specific header */ + x_long x_mslg_cmdref; /* command reference number */ + x_short x_mslg_unit; /* unit number */ + x_short x_mslg_seqnum; /* sequence number */ + x_u_char x_mslg_format; /* format */ + x_u_char x_mslg_flags; /* error log message flags */ + x_short x_mslg_event; /* event code */ + x_quad x_mslg_cntid; /* controller id */ + x_u_char x_mslg_cntsvr; /* controller software version */ + x_u_char x_mslg_cnthvr; /* controller hardware version */ + x_short x_mslg_multunt; /* multi-unit code */ + x_quad x_mslg_unitid; /* unit id */ + x_u_char x_mslg_unitsvr; /* unit software version */ + x_u_char x_mslg_unithvr; /* unit hardware version */ + x_short x_mslg_group; /* group; retry + level */ + x_long x_mslg_volser; /* volume serial number */ + x_long x_mslg_hdr; /* header */ + char x_mslg_sdistat[12]; /* SDI status information */ +}; + +#define x_mslg_busaddr x_mslg_unitid.x_val[0] +#define x_mslg_sdecyl x_mslg_group + +#endif diff --git a/x_include/vax/x_mtpr.h b/x_include/vax/x_mtpr.h new file mode 100644 index 0000000..e8ee5ae --- /dev/null +++ b/x_include/vax/x_mtpr.h @@ -0,0 +1,100 @@ +#include "x_.h" + +#ifndef x__VAX_MTPR_H_ +#define x__VAX_MTPR_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)mtpr.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * VAX processor register numbers + */ + +#define x_KSP 0x0 /* kernel stack pointer */ +#define x_ESP 0x1 /* exec stack pointer */ +#define x_SSP 0x2 /* supervisor stack pointer */ +#define x_USP 0x3 /* user stack pointer */ +#define x_ISP 0x4 /* interrupt stack pointer */ +#define x_P0BR 0x8 /* p0 base register */ +#define x_P0LR 0x9 /* p0 length register */ +#define x_P1BR 0xa /* p1 base register */ +#define x_P1LR 0xb /* p1 length register */ +#define x_SBR 0xc /* system segment base register */ +#define x_SLR 0xd /* system segment length register */ +#define x_PCBB 0x10 /* process control block base */ +#define x_SCBB 0x11 /* system control block base */ +#define x_IPL 0x12 /* interrupt priority level */ +#define x_ASTLVL 0x13 /* async. system trap level */ +#define x_SIRR 0x14 /* software interrupt request */ +#define x_SISR 0x15 /* software interrupt summary */ +#define x_ICCS 0x18 /* interval clock control */ +#define x_NICR 0x19 /* next interval count */ +#define x_ICR 0x1a /* interval count */ +#define x_TODR 0x1b /* time of year (day) */ +#define x_RXCS 0x20 /* console receiver control and status */ +#define x_RXDB 0x21 /* console receiver data buffer */ +#define x_TXCS 0x22 /* console transmitter control and status */ +#define x_TXDB 0x23 /* console transmitter data buffer */ +#define x_MAPEN 0x38 /* memory management enable */ +#define x_TBIA 0x39 /* translation buffer invalidate all */ +#define x_TBIS 0x3a /* translation buffer invalidate single */ +#define x_PMR 0x3d /* performance monitor enable */ +#define x_SID 0x3e /* system identification */ + +#if defined(x_VAX780) || defined(x_VAX8600) +#define x_ACCS 0x28 /* accelerator control and status */ +#endif + +#if defined(x_VAX8600) +#define x_TBCHK 0x3f /* Translation Buffer Check */ +#define x_PAMACC 0x40 /* PAMM access */ +#define x_PAMLOC 0x41 /* PAMM location */ +#define x_CSWP 0x42 /* Cache sweep */ +#define x_MDECC 0x43 /* MBOX data ecc register */ +#define x_MENA 0x44 /* MBOX error enable register */ +#define x_MDCTL 0x45 /* MBOX data control register */ +#define x_MCCTL 0x46 /* MBOX mcc control register */ +#define x_MERG 0x47 /* MBOX error generator register */ +#define x_CRBT 0x48 /* Console reboot */ +#define x_DFI 0x49 /* Diag fault insertion register */ +#define x_EHSR 0x4a /* Error handling status register */ +#define x_STXCS 0x4c /* Console block storage C/S */ +#define x_STXDB 0x4d /* Console block storage D/B */ +#define x_ESPA 0x4e /* EBOX scratchpad address */ +#define x_ESPD 0x4f /* EBOX sratchpad data */ +#endif + +#if defined(x_VAX780) +#define x_ACCR 0x29 /* accelerator maintenance */ +#define x_WCSA 0x2c /* WCS address */ +#define x_WCSD 0x2d /* WCS data */ +#define x_SBIFS 0x30 /* SBI fault and status */ +#define x_SBIS 0x31 /* SBI silo */ +#define x_SBISC 0x32 /* SBI silo comparator */ +#define x_SBIMT 0x33 /* SBI maintenance */ +#define x_SBIER 0x34 /* SBI error register */ +#define x_SBITA 0x35 /* SBI timeout address */ +#define x_SBIQC 0x36 /* SBI quadword clear */ +#define x_MBRK 0x3c /* micro-program breakpoint */ +#endif + +#if defined(x_VAX750) || defined(x_VAX730) +#define x_MCSR 0x17 /* machine check status register */ +#define x_CSRS 0x1c /* console storage receive status register */ +#define x_CSRD 0x1d /* console storage receive data register */ +#define x_CSTS 0x1e /* console storage transmit status register */ +#define x_CSTD 0x1f /* console storage transmit data register */ +#define x_TBDR 0x24 /* translation buffer disable register */ +#define x_CADR 0x25 /* cache disable register */ +#define x_MCESR 0x26 /* machine check error summary register */ +#define x_CAER 0x27 /* cache error */ +#define x_IUR 0x37 /* init unibus register */ +#define x_TB 0x3b /* translation buffer */ +#endif + +#endif diff --git a/x_include/vax/x_nexus.h b/x_include/vax/x_nexus.h new file mode 100644 index 0000000..45ad2ec --- /dev/null +++ b/x_include/vax/x_nexus.h @@ -0,0 +1,126 @@ +#include "x_.h" + +#ifndef x__VAX_NEXUS_H_ +#define x__VAX_NEXUS_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)nexus.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Information about nexus's. + * + * Each machine has an address of backplane slots (nexi). + * Each nexus is some type of adapter, whose code is the low + * byte of the first word of the adapter address space. + * At boot time the system looks through the array of available + * slots and finds the interconnects for the machine. + */ +#define x_NNEXSBI 16 +#if x_VAX8600 +#define x_NNEX8600 x_NNEXSBI +#define x_NEXA8600 ((struct x_nexus *)(0x20000000)) +#define x_NEXB8600 ((struct x_nexus *)(0x22000000)) +#endif +#if x_VAX780 +#define x_NNEX780 x_NNEXSBI +#define x_NEX780 ((struct x_nexus *)0x20000000) +#endif +#if x_VAX750 +#define x_NNEX750 x_NNEXSBI +#define x_NEX750 ((struct x_nexus *)0xf20000) +#endif +#if x_VAX730 +#define x_NNEX730 x_NNEXSBI +#define x_NEX730 ((struct x_nexus *)0xf20000) +#endif +#if x_VAX630 +#define x_NNEX630 1 +#define x_NEX630 ((struct x_nexus *)0x20088000) +#endif +#define x_NEXSIZE 0x2000 + +#if x_VAX8600 +#define x_MAXNNEXUS (2 * x_NNEXSBI) +#else +#define x_MAXNNEXUS x_NNEXSBI +#endif + +#ifndef x_LOCORE +struct x_nexus { + union x_nexcsr { + x_long x_nex_csr; + x_u_char x_nex_type; + } x_nexcsr; + x_long x_nex_pad[x_NEXSIZE / sizeof (x_long) - 1]; +}; +#ifdef x_KERNEL +struct x_nexus x_nexus[x_MAXNNEXUS]; +#endif +#endif + +/* + * Bits in high word of nexus's. + */ +#define x_SBI_PARFLT (1<<31) /* sbi parity fault */ +#define x_SBI_WSQFLT (1<<30) /* write sequence fault */ +#define x_SBI_URDFLT (1<<29) /* unexpected read data fault */ +#define x_SBI_ISQFLT (1<<28) /* interlock sequence fault */ +#define x_SBI_MXTFLT (1<<27) /* multiple transmitter fault */ +#define x_SBI_XMTFLT (1<<26) /* transmit fault */ + +#define x_NEX_CFGFLT (0xfc000000) + +#ifndef x_LOCORE +#if defined(x_VAX780) || defined(x_VAX8600) +#define x_NEXFLT_BITS \ +"\20\40PARFLT\37WSQFLT\36URDFLT\35ISQFLT\34MXTFLT\33XMTFLT" +#endif +#endif + +#define x_NEX_APD (1<<23) /* adaptor power down */ +#define x_NEX_APU (1<<22) /* adaptor power up */ + +#define x_MBA_OT (1<<21) /* overtemperature */ + +#define x_UBA_UBINIT (1<<18) /* unibus init */ +#define x_UBA_UBPDN (1<<17) /* unibus power down */ +#define x_UBA_UBIC (1<<16) /* unibus initialization complete */ + +/* + * Types for nex_type. + */ +#define x_NEX_ANY 0 /* pseudo for handling 11/750 */ +#define x_NEX_MEM4 0x08 /* 4K chips, non-interleaved mem */ +#define x_NEX_MEM4I 0x09 /* 4K chips, interleaved mem */ +#define x_NEX_MEM16 0x10 /* 16K chips, non-interleaved mem */ +#define x_NEX_MEM16I 0x11 /* 16K chips, interleaved mem */ +#define x_NEX_MBA 0x20 /* Massbus adaptor */ +#define x_NEX_UBA0 0x28 /* Unibus adaptor */ +#define x_NEX_UBA1 0x29 /* 4 flavours for 4 addr spaces */ +#define x_NEX_UBA2 0x2a +#define x_NEX_UBA3 0x2b +#define x_NEX_DR32 0x30 /* DR32 user i'face to SBI */ +#define x_NEX_CI 0x38 /* CI adaptor */ +#define x_NEX_MPM0 0x40 /* Multi-port mem */ +#define x_NEX_MPM1 0x41 /* Who knows why 4 different ones ? */ +#define x_NEX_MPM2 0x42 +#define x_NEX_MPM3 0x43 +#define x_NEX_MEM64L 0x68 /* 64K chips, non-interleaved, lower */ +#define x_NEX_MEM64LI 0x69 /* 64K chips, ext-interleaved, lower */ +#define x_NEX_MEM64U 0x6a /* 64K chips, non-interleaved, upper */ +#define x_NEX_MEM64UI 0x6b /* 64K chips, ext-interleaved, upper */ +#define x_NEX_MEM64I 0x6c /* 64K chips, interleaved */ +#define x_NEX_MEM256L 0x70 /* 256K chips, non-interleaved, lower */ +#define x_NEX_MEM256LI 0x71 /* 256K chips, ext-interleaved, lower */ +#define x_NEX_MEM256U 0x72 /* 256K chips, non-interleaved, upper */ +#define x_NEX_MEM256UI 0x73 /* 256K chips, ext-interleaved, upper */ +#define x_NEX_MEM256I 0x74 /* 256K chips, interleaved */ + +#endif diff --git a/x_include/vax/x_pcb.h b/x_include/vax/x_pcb.h new file mode 100644 index 0000000..027bcb3 --- /dev/null +++ b/x_include/vax/x_pcb.h @@ -0,0 +1,75 @@ +#include "x_.h" + +#ifndef x__VAX_PCB_H_ +#define x__VAX_PCB_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)pcb.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * VAX process control block + */ + +struct x_pcb { + x_int x_pcb_ksp; /* kernel stack pointer */ + x_int x_pcb_esp; /* exec stack pointer */ + x_int x_pcb_ssp; /* supervisor stack pointer */ + x_int x_pcb_usp; /* user stack pointer */ + x_int x_pcb_r0; + x_int x_pcb_r1; + x_int x_pcb_r2; + x_int x_pcb_r3; + x_int x_pcb_r4; + x_int x_pcb_r5; + x_int x_pcb_r6; + x_int x_pcb_r7; + x_int x_pcb_r8; + x_int x_pcb_r9; + x_int x_pcb_r10; + x_int x_pcb_r11; + x_int x_pcb_r12; +#define x_pcb_ap x_pcb_r12 + x_int x_pcb_r13; +#define x_pcb_fp x_pcb_r13 + x_int x_pcb_pc; /* program counter */ + x_int x_pcb_psl; /* program status longword */ + struct x_pte *x_pcb_p0br; /* seg 0 base register */ + x_int x_pcb_p0lr; /* seg 0 length register and astlevel */ + struct x_pte *x_pcb_p1br; /* seg 1 base register */ + x_int x_pcb_p1lr; /* seg 1 length register and pme */ +/* + * Software pcb (extension) + */ + x_int x_pcb_szpt; /* number of pages of user page table */ + x_int x_pcb_cmap2; + x_int *x_pcb_sswap; + x_int x_pcb_sigc[5]; +}; + +#define x_AST_NONE 0x04000000 /* ast level */ +#define x_AST_USER 0x03000000 /* ast for user mode */ + +#define x_ASTLVL_NONE 4 +#define x_ASTLVL_USER 3 + +#define x_AST_CLR 0x07000000 +#define x_PME_CLR 0x80000000 + +#define x_aston() \ + { \ + x_mtpr(x_ASTLVL, x_ASTLVL_USER); \ + } + +#define x_astoff() \ + { \ + x_mtpr(x_ASTLVL, x_ASTLVL_NONE); \ + } + +#endif diff --git a/x_include/vax/x_psl.h b/x_include/vax/x_psl.h new file mode 100644 index 0000000..626ef96 --- /dev/null +++ b/x_include/vax/x_psl.h @@ -0,0 +1,40 @@ +#include "x_.h" + +#ifndef x__VAX_PSL_H_ +#define x__VAX_PSL_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)psl.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * VAX program status longword + */ + +#define x_PSL_C 0x00000001 /* carry bit */ +#define x_PSL_V 0x00000002 /* overflow bit */ +#define x_PSL_Z 0x00000004 /* zero bit */ +#define x_PSL_N 0x00000008 /* negative bit */ +#define x_PSL_ALLCC 0x0000000f /* all cc bits - unlikely */ +#define x_PSL_T 0x00000010 /* trace enable bit */ +#define x_PSL_IV 0x00000020 /* integer overflow enable bit */ +#define x_PSL_FU 0x00000040 /* floating point underflow enable */ +#define x_PSL_DV 0x00000080 /* decimal overflow enable bit */ +#define x_PSL_IPL 0x001f0000 /* interrupt priority level */ +#define x_PSL_PRVMOD 0x00c00000 /* previous mode (all on is user) */ +#define x_PSL_CURMOD 0x03000000 /* current mode (all on is user) */ +#define x_PSL_IS 0x04000000 /* interrupt stack */ +#define x_PSL_FPD 0x08000000 /* first part done */ +#define x_PSL_TP 0x40000000 /* trace pending */ +#define x_PSL_CM 0x80000000 /* compatibility mode */ + +#define x_PSL_MBZ 0x3020ff00 /* must be zero bits */ + +#define x_PSL_USERSET (x_PSL_PRVMOD|x_PSL_CURMOD) +#define x_PSL_USERCLR (x_PSL_IS|x_PSL_IPL|x_PSL_MBZ) + +#endif diff --git a/x_include/vax/x_pte.h b/x_include/vax/x_pte.h new file mode 100644 index 0000000..935935b --- /dev/null +++ b/x_include/vax/x_pte.h @@ -0,0 +1,99 @@ +#include "x_.h" + +#ifndef x__VAX_PTE_H_ +#define x__VAX_PTE_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)pte.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * VAX page table entry + * + * There are two major kinds of pte's: those which have ever existed (and are + * thus either now in core or on the swap device), and those which have + * never existed, but which will be filled on demand at first reference. + * There is a structure describing each. There is also an ancillary + * structure used in page clustering. + */ + +#ifndef x_LOCORE +struct x_pte { +x_unsigned_int x_pg_pfnum:21, /* core page frame number or 0 */ + :2, + x_pg_vreadm:1, /* modified since vread (or with _m) */ + x_pg_swapm:1, /* have to write back to swap */ + x_pg_fod:1, /* is fill on demand (=0) */ + x_pg_m:1, /* hardware maintained modified bit */ + x_pg_prot:4, /* access control */ + x_pg_v:1; /* valid bit */ +}; +struct x_hpte { +x_unsigned_int x_pg_pfnum:21, + :2, + x_pg_high:9; /* special for clustering */ +}; +struct x_fpte { +x_unsigned_int x_pg_blkno:24, /* file system block number */ + x_pg_fileno:1, /* file mapped from or TEXT or ZERO */ + x_pg_fod:1, /* is fill on demand (=1) */ + :1, + x_pg_prot:4, + x_pg_v:1; +}; +#endif + +#define x_PG_V 0x80000000 +#define x_PG_PROT 0x78000000 +#define x_PG_M 0x04000000 +#define x_PG_FOD 0x02000000 +#define x_PG_VREADM 0x00800000 +#define x_PG_PFNUM 0x001fffff + +#define x_PG_FZERO 0 +#define x_PG_FTEXT 1 +#define x_PG_FMAX (x_PG_FTEXT) + +#define x_PG_NOACC 0 +#define x_PG_KW 0x10000000 +#define x_PG_KR 0x18000000 +#define x_PG_UW 0x20000000 +#define x_PG_URKW 0x70000000 +#define x_PG_URKR 0x78000000 + +/* + * Pte related macros + */ +#define x_dirty(x_pte) ((x_pte)->x_pg_fod == 0 && (x_pte)->x_pg_pfnum && \ + ((x_pte)->x_pg_m || (x_pte)->x_pg_swapm)) + +#ifndef x_LOCORE +#ifdef x_KERNEL + +/* utilities defined in locore.s */ +extern struct x_pte x_Sysmap[]; +extern struct x_pte x_Usrptmap[]; +extern struct x_pte x_usrpt[]; +extern struct x_pte x_Swapmap[]; +extern struct x_pte x_Forkmap[]; +extern struct x_pte x_Xswapmap[]; +extern struct x_pte x_Xswap2map[]; +extern struct x_pte x_Pushmap[]; +extern struct x_pte x_Vfmap[]; +extern struct x_pte x_mmap[]; +extern struct x_pte x_msgbufmap[]; +extern struct x_pte x_camap[]; +extern struct x_pte x_Nexmap[][16]; +extern struct x_pte x_Ioamap[][1]; +#ifdef x_VAX630 +extern struct x_pte x_Clockmap[]; +extern struct x_pte x_Ka630map[]; +#endif +#endif +#endif + +#endif diff --git a/x_include/vax/x_reg.h b/x_include/vax/x_reg.h new file mode 100644 index 0000000..67726f0 --- /dev/null +++ b/x_include/vax/x_reg.h @@ -0,0 +1,40 @@ +#include "x_.h" + +#ifndef x__VAX_REG_H_ +#define x__VAX_REG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)reg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Location of the users' stored + * registers relative to R0. + * Usage is u.u_ar0[XX]. + */ +#define x_R0 (-18) +#define x_R1 (-17) +#define x_R2 (-16) +#define x_R3 (-15) +#define x_R4 (-14) +#define x_R5 (-13) +#define x_R6 (-12) +#define x_R7 (-11) +#define x_R8 (-10) +#define x_R9 (-9) +#define x_R10 (-8) +#define x_R11 (-7) +#define x_R12 (-21) +#define x_R13 (-20) + +#define x_AP (-21) +#define x_FP (-20) +#define x_SP (-5) +#define x_PS (-1) +#define x_PC (-2) + +#endif diff --git a/x_include/vax/x_rpb.h b/x_include/vax/x_rpb.h new file mode 100644 index 0000000..b0c588c --- /dev/null +++ b/x_include/vax/x_rpb.h @@ -0,0 +1,30 @@ +#include "x_.h" + +#ifndef x__VAX_RPB_H_ +#define x__VAX_RPB_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)rpb.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * The restart parameter block, which is a page in (very) low + * core which runs after a crash. Currently, the restart + * procedure takes a dump. + */ +struct x_rpb { + struct x_rpb *x_rp_selfref; /* self-reference */ + x_int (*x_rp_dumprout)(); /* routine to be called */ + x_long x_rp_checksum; /* checksum of 31 words of dumprout */ + x_long x_rp_flag; /* set to 1 when dumprout runs */ +/* the dump stack grows from the end of the rpb page not to reach here */ +}; +#ifdef x_KERNEL +extern struct x_rpb x_rpb; +#endif + +#endif diff --git a/x_include/vax/x_rsp.h b/x_include/vax/x_rsp.h new file mode 100644 index 0000000..4570fea --- /dev/null +++ b/x_include/vax/x_rsp.h @@ -0,0 +1,94 @@ +#include "x_.h" + +#ifndef x__VAX_RSP_H_ +#define x__VAX_RSP_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)rsp.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * TU58 transfer protocol constants and data structures + */ + +/* + * Structure of a command packet + */ +struct x_packet { + x_u_char x_pk_flag; /* indicates packet type (cmd, data, etc.) */ + x_u_char x_pk_mcount; /* length of packet (bytes) */ + x_u_char x_pk_op; /* operation to perform (read, write, etc.) */ + x_u_char x_pk_mod; /* modifier for op or returned status */ + x_u_char x_pk_unit; /* unit number */ + x_u_char x_pk_sw; /* switches */ + x_u_short x_pk_seq; /* sequence number, always zero */ + x_u_short x_pk_count; /* requested byte count for read or write */ + x_u_short x_pk_block; /* block number for read, write, or seek */ + x_u_short x_pk_chksum; /* checksum, by words with end around carry */ +}; + +/* + * States + */ +#define x_TUS_INIT1 0 /* sending nulls */ +#define x_TUS_INIT2 1 /* sending inits */ +#define x_TUS_IDLE 2 /* initialized, no transfer in progress */ +#define x_TUS_SENDH 3 /* sending header */ +#define x_TUS_SENDD 4 /* sending data */ +#define x_TUS_SENDC 5 /* sending checksum */ +#define x_TUS_SENDR 6 /* sending read command packet */ +#define x_TUS_SENDW 7 /* sending write command packet */ +#define x_TUS_GETH 8 /* reading header */ +#define x_TUS_GETD 9 /* reading data */ +#define x_TUS_GETC 10 /* reading checksum */ +#define x_TUS_GET 11 /* reading an entire packet */ +#define x_TUS_WAIT 12 /* waiting for continue */ +#define x_TUS_RCVERR 13 /* receiver error in pseudo DMA routine */ +#define x_TUS_CHKERR 14 /* checksum error in pseudo DMA routine */ + +#define x_TUS_NSTATES 15 + +#define x_printstate(x_state) \ + if ((x_state) < x_TUS_NSTATES) \ + x_printf("%s", x_tustates[(x_state)]); \ + else \ + x_printf("%d", (x_state)); + +/* + * Packet Flags + */ +#define x_TUF_DATA 1 /* data packet */ +#define x_TUF_CMD 2 /* command packet */ +#define x_TUF_INITF 4 /* initialize */ +#define x_TUF_CONT 020 /* continue */ +#define x_TUF_XOFF 023 /* flow control */ + +/* + * Op Codes + */ +#define x_TUOP_NOOP 0 /* no operation */ +#define x_TUOP_INIT 1 /* initialize */ +#define x_TUOP_READ 2 /* read block */ +#define x_TUOP_WRITE 3 /* write block */ +#define x_TUOP_SEEK 5 /* seek to block */ +#define x_TUOP_DIAGNOSE 7 /* run micro-diagnostics */ +#define x_TUOP_END 0100 /* end packet */ + +/* + * Mod Flags + */ +#define x_TUMD_WRV 1 /* write with read verify */ + +/* + * Switches + */ +#define x_TUSW_MRSP 010 /* use Modified RSP */ + +#endif diff --git a/x_include/vax/x_scb.h b/x_include/vax/x_scb.h new file mode 100644 index 0000000..76b69c3 --- /dev/null +++ b/x_include/vax/x_scb.h @@ -0,0 +1,73 @@ +#include "x_.h" + +#ifndef x__VAX_SCB_H_ +#define x__VAX_SCB_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)scb.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * VAX System control block layout + */ + +struct x_scb { + x_int (*x_scb_stray)(); /* reserved */ + x_int (*x_scb_machchk)(); /* machine chack */ + x_int (*x_scb_kspinval)(); /* KSP invalid */ + x_int (*x_scb_powfail)(); /* power fail */ + x_int (*x_scb_resinstr)(); /* reserved instruction */ + x_int (*x_scb_custinst)(); /* XFC instr */ + x_int (*x_scb_resopnd)(); /* reserved operand */ + x_int (*x_scb_resaddr)(); /* reserved addr mode */ + x_int (*x_scb_acv)(); /* access control violation */ + x_int (*x_scb_tnv)(); /* translation not valid */ + x_int (*x_scb_tracep)(); /* trace pending */ + x_int (*x_scb_bpt)(); /* breakpoint instr */ + x_int (*x_scb_compat)(); /* compatibility mode fault */ + x_int (*x_scb_arith)(); /* arithmetic fault */ + x_int (*x_scb_stray2)(); + x_int (*x_scb_stray3)(); + x_int (*x_scb_chmk)(); /* CHMK instr */ + x_int (*x_scb_chme)(); /* CHME instr */ + x_int (*x_scb_chms)(); /* CHMS instr */ + x_int (*x_scb_chmu)(); /* CHMU instr */ + x_int (*x_scb_sbisilo)(); /* SBI silo compare */ + x_int (*x_scb_cmrd)(); /* corrected mem read data */ + x_int (*x_scb_sbialert)(); /* SBI alert */ + x_int (*x_scb_sbiflt)(); /* SBI fault */ + x_int (*x_scb_wtime)(); /* memory write timeout */ + x_int (*x_scb_stray4[8])(); + x_int (*x_scb_soft[15])(); /* software interrupt */ + x_int (*x_scb_timer)(); /* interval timer interrupt */ + x_int (*x_scb_stray5[7])(); + x_int (*x_scb_stray6[4])(); + x_int (*x_scb_csdr)(); /* console storage receive */ + x_int (*x_scb_csdx)(); /* console storage transmit */ + x_int (*x_scb_ctr)(); /* console terminal receive */ + x_int (*x_scb_ctx)(); /* console terminal transmit */ + x_int (*x_scb_ipl14[16])(); /* device interrupts IPL 14 */ + x_int (*x_scb_ipl15[16])(); /* " " IPL 15 */ + x_int (*x_scb_ipl16[16])(); /* " " IPL 16 */ + x_int (*x_scb_ipl17[16])(); /* " " IPL 17 */ + x_int (*x_scb_ubaint[128])(); /* Unibus device intr */ + x_int (*x_scb_uba1int[128])(); /* Unibus 1 device intr */ +}; + +#ifdef x_KERNEL +extern struct x_scb x_scb; +/* scb.scb_ubaint is the same as UNIvec */ +#endif + +#define x_scbentry(x_f, x_how) ((x_int (*)())(((x_int)x_f)+x_how)) + +#define x_SCB_KSTACK 0 +#define x_SCB_ISTACK 1 +#define x_SCB_WCS 2 +#define x_SCB_HALT 3 + +#endif diff --git a/x_include/vax/x_tmscp.h b/x_include/vax/x_tmscp.h new file mode 100644 index 0000000..8cd6ca1 --- /dev/null +++ b/x_include/vax/x_tmscp.h @@ -0,0 +1,330 @@ +#include "x_.h" + +#ifndef x__VAX_TMSCP_H_ +#define x__VAX_TMSCP_H_ + +#include + +/* @(#)tmscp.h 7.1 (Berkeley) 6/5/86 */ + +/* + * @(#)tmscp.h 1.3 10/21/85 + * Definitions for the Tape Mass Storage Control Protocol + */ + +/**************************************************************** + * * + * Licensed from Digital Equipment Corporation * + * Copyright (c) * + * Digital Equipment Corporation * + * Maynard, Massachusetts * + * 1985, 1986 * + * All rights reserved. * + * * + * The Information in this software is subject to change * + * without notice and should not be construed as a commitment * + * by Digital Equipment Corporation. Digital makes no * + * representations about the suitability of this software for * + * any purpose. It is supplied "As Is" without expressed or * + * implied warranty. * + * * + * If the Regents of the University of California or its * + * licensees modify the software in a manner creating * + * diriviative copyright rights, appropriate copyright * + * legends may be placed on the drivative work in addition * + * to that set forth above. * + * * + **************************************************************** + * + * Modification history: /sys/vax/tmscp.h + * + * 18-Oct-85 - afd + * Added: defines for tape format (density) flag values. + * + * 18-Jul-85 - afd + * Added: #define M_UF_WBKNV 0000100 + * for write back (which enables cache). + ************************************************************************/ + + +/* + * Control message opcodes + */ +#define x_M_OP_ABORT 0001 /* Abort command */ +#define x_M_OP_GTCMD 0002 /* Get command status command */ +#define x_M_OP_GTUNT 0003 /* Get unit status command */ +#define x_M_OP_STCON 0004 /* Set controller characteristics command */ +#define x_M_OP_AVAIL 0010 /* Available command */ +#define x_M_OP_ONLIN 0011 /* Online command */ +#define x_M_OP_STUNT 0012 /* Set unit characteristics command */ +#define x_M_OP_DTACP 0013 /* Determine access paths command */ +#define x_M_OP_ACCES 0020 /* Access command */ +#define x_M_OP_CMPCD 0021 /* Compare controller data command */ +#define x_M_OP_ERASE 0022 /* Erase command */ +#define x_M_OP_FLUSH 0023 /* Flush command */ +#define x_M_OP_ERGAP 0026 /* Erase gap command */ +#define x_M_OP_COMP 0040 /* Compare host data command */ +#define x_M_OP_READ 0041 /* Read command */ +#define x_M_OP_WRITE 0042 /* Write command */ +#define x_M_OP_WRITM 0044 /* Write tape mark command */ +#define x_M_OP_REPOS 0045 /* Reposition command */ +#define x_M_OP_AVATN 0100 /* Available attention message */ +#define x_M_OP_DUPUN 0101 /* Duplicate unit number attention message */ +#define x_M_OP_ACPTH 0102 /* Access path attention message */ +#define x_M_OP_END 0200 /* End message flag */ + + +/* + * Generic command modifiers + */ +#define x_M_MD_COMP 0040000 /* Compare */ +#define x_M_MD_CLSEX 0020000 /* Clear serious exception */ +#define x_M_MD_SECOR 0001000 /* Suppress error correction */ +#define x_M_MD_SEREC 0000400 /* Suppress error recovery */ +#define x_M_MD_STWRP 0000004 /* Set write protect */ +#define x_M_MD_ALLCD 0000002 /* All class drivers */ +#define x_M_MD_NXUNT 0000001 /* Next unit */ + +/* + * TMSCP command modifiers + */ +#define x_M_MD_DLEOT 0000200 /* Delete LEOT */ +#define x_M_MD_IMMED 0000100 /* Immediate completion */ +#define x_M_MD_EXCAC 0000040 /* Exclusive access */ +#define x_M_MD_UNLOD 0000020 /* Unload */ +#define x_M_MD_REVRS 0000010 /* reverse */ +#define x_M_MD_OBJCT 0000004 /* object count */ +#define x_M_MD_REWND 0000002 /* rewind */ + +/* + * End message flags + */ +#define x_M_EF_ERLOG 0040 /* Error log generated */ +#define x_M_EF_SEREX 0020 /* Serious exception */ +#define x_M_EF_EOT 0010 /* End of tape encountered */ +#define x_M_EF_PLS 0004 /* Position lost */ + + +/* + * Controller flags + */ +#define x_M_CF_ATTN 0200 /* Enable attention messages */ +#define x_M_CF_MISC 0100 /* Enable miscellaneous error log messages */ +#define x_M_CF_OTHER 0040 /* Enable other host's error log messages */ +#define x_M_CF_THIS 0020 /* Enable this host's error log messages */ + + +/* + * Unit flags + */ +#define x_M_UF_WRTPH 0020000 /* Write protect (hardware) */ +#define x_M_UF_WRTPS 0010000 /* Write protect (software or volume) */ +#define x_M_UF_WBKNV 0000100 /* Write back (enables cache) */ +#define x_M_UF_VSMSU 0000040 /* Variable speed mode suppression */ +#define x_M_UF_VARSP 0000020 /* Variable speed unit */ +#define x_M_UF_CMPWR 0000002 /* Compare writes */ +#define x_M_UF_CMPRD 0000001 /* Compare reads */ + + +/* + * Status codes + */ +#define x_M_ST_MASK 037 /* Status code mask */ +#define x_M_ST_SUCC 000 /* Success */ +#define x_M_ST_ICMD 001 /* Invalid command */ +#define x_M_ST_ABRTD 002 /* Command aborted */ +#define x_M_ST_OFFLN 003 /* Unit offline */ +#define x_M_ST_AVLBL 004 /* Unit available */ +#define x_M_ST_WRTPR 006 /* Write protected */ +#define x_M_ST_COMP 007 /* Compare error */ +#define x_M_ST_DATA 010 /* Data error */ +#define x_M_ST_HSTBF 011 /* Host buffer access error */ +#define x_M_ST_CNTLR 012 /* Controller error */ +#define x_M_ST_DRIVE 013 /* Drive error */ +#define x_M_ST_FMTER 014 /* Formatter error */ +#define x_M_ST_BOT 015 /* BOT encountered */ +#define x_M_ST_TAPEM 016 /* Tape mark encountered */ +#define x_M_ST_RDTRN 020 /* Record data truncated */ +#define x_M_ST_PLOST 021 /* Position lost */ +#define x_M_ST_SEX 022 /* Serious exception */ +#define x_M_ST_LED 023 /* LEOT detected */ +#define x_M_ST_DIAG 037 /* Message from an internal diagnostic */ + +/* + * An MSCP packet + */ + +struct x_mscp { + struct x_mscp_header x_mscp_header;/* device specific header */ + x_long x_mscp_cmdref; /* command reference number */ + x_short x_mscp_unit; /* unit number */ + x_short x_mscp_xxx1; /* unused */ + x_u_char x_mscp_opcode; /* opcode */ + x_u_char x_mscp_flags; /* end message flags */ + x_short x_mscp_modifier; /* modifiers */ + union { + struct { + x_long x_Mscp_bytecnt; /* byte count */ + x_long x_Mscp_buffer; /* buffer descriptor */ + x_long x_Mscp_mapbase; /* physical addr of map registers */ + x_long x_Mscp_xxx2; /* unused */ + x_long x_Mscp_lbn; /* logical block number */ + x_long x_Mscp_xxx4; /* unused */ + x_long *x_Mscp_dscptr; /* pointer to descriptor (software) */ + x_long x_Mscp_sftwds[17];/* software words, padding */ + } x_mscp_generic; + struct { + x_short x_Mscp_version; /* MSCP version */ + x_short x_Mscp_cntflgs; /* controller flags */ + x_short x_Mscp_hsttmo; /* host timeout */ + x_short x_Mscp_usefrac; /* use fraction */ + x_quad x_Mscp_time; /* time and date */ + x_long x_Mscp_cntdep; /* controller dependent parameters */ + } x_mscp_setcntchar; + struct { + x_short x_Mscp_multunt; /* multi-unit code */ + x_short x_Mscp_unitflgs; /* unit flags */ + x_long x_Mscp_hostid; /* host identifier */ + x_quad x_Mscp_unitid; /* unit identifier */ + x_long x_Mscp_mediaid; /* media type identifier */ + x_short x_Mscp_format; /* format (tape density) */ + x_short x_Mscp_speed; /* tape speed = (ips * bpi) /1000 */ + x_short x_Mscp_fmtmenu; /* format menu */ + x_short x_Mscp_group; /* group size */ + x_short x_Mscp_cylinder; /* cylinder size */ + x_short x_Mscp_xxx3; /* reserved */ + x_short x_Mscp_rctsize; /* RCT table size */ + char x_Mscp_rbns; /* RBNs / track */ + char x_Mscp_rctcpys; /* RCT copies */ + } x_mscp_getunitsts; + } x_mscp_un; + x_short x_mscp_fil1; + x_short x_mscp_fil2; + x_short x_mscp_fil3; +}; + +#define x_mscp_msglen (sizeof (struct x_mscp) - sizeof(struct x_mscp_header)) + +/* + * generic packet + */ + +#define x_mscp_bytecnt x_mscp_un.x_mscp_generic.x_Mscp_bytecnt +#define x_mscp_buffer x_mscp_un.x_mscp_generic.x_Mscp_buffer +#define x_mscp_mapbase x_mscp_un.x_mscp_generic.x_Mscp_mapbase +#define x_mscp_lbn x_mscp_un.x_mscp_generic.x_Mscp_lbn +#define x_mscp_dscptr x_mscp_un.x_mscp_generic.x_Mscp_dscptr +#define x_mscp_sftwds x_mscp_un.x_mscp_generic.x_Mscp_sftwds +#define x_mscp_status x_mscp_modifier + +/* + * Abort / Get Command Status packet + */ + +#define x_mscp_outref x_mscp_bytecnt + +/* + * Set Controller Characteristics packet + */ + +#define x_mscp_version x_mscp_un.x_mscp_setcntchar.x_Mscp_version +#define x_mscp_cntflgs x_mscp_un.x_mscp_setcntchar.x_Mscp_cntflgs +#define x_mscp_hsttmo x_mscp_un.x_mscp_setcntchar.x_Mscp_hsttmo +#define x_mscp_usefrac x_mscp_un.x_mscp_setcntchar.x_Mscp_usefrac +#define x_mscp_time x_mscp_un.x_mscp_setcntchar.x_Mscp_time +#define x_mscp_cntdep x_mscp_un.x_mscp_setcntchar.x_Mscp_cntdep + +/* + * Reposition command packet fields + */ + +#define x_mscp_reccnt x_mscp_bytecnt /* record/object count */ +#define x_mscp_tmkcnt x_mscp_buffer /* tape mark count */ + +/* + * Get Unit Status end packet + */ + +#define x_mscp_multunt x_mscp_un.x_mscp_getunitsts.x_Mscp_multunt +#define x_mscp_unitflgs x_mscp_un.x_mscp_getunitsts.x_Mscp_unitflgs +#define x_mscp_hostid x_mscp_un.x_mscp_getunitsts.x_Mscp_hostid +#define x_mscp_unitid x_mscp_un.x_mscp_getunitsts.x_Mscp_unitid +#define x_mscp_mediaid x_mscp_un.x_mscp_getunitsts.x_Mscp_mediaid +#define x_mscp_format x_mscp_un.x_mscp_getunitsts.x_Mscp_format /* density:0=high */ +#define x_mscp_speed x_mscp_un.x_mscp_getunitsts.x_Mscp_speed /* (ips*bpi)/1000 */ +#define x_mscp_fmtmenu x_mscp_un.x_mscp_getunitsts.x_Mscp_fmtmenu + +/* + * Online / Set Unit Characteristics end packet + */ + +#define x_mscp_maxwrt x_mscp_dscptr /* max write byte count */ +#define x_mscp_noiserec x_mscp_cylinder /* noise record */ + +/* + * Set Controller Characteristics end packet + */ + +#define x_mscp_cnttmo x_mscp_hsttmo /* controller timeout */ +#define x_mscp_cntcmdl x_mscp_usefrac /* controller soft & hardware version */ +#define x_mscp_cntid x_mscp_unitid /* controller id */ + + +/* + * Error Log message format codes + */ +#define x_M_FM_CNTERR 0 /* Controller error */ +#define x_M_FM_BUSADDR 1 /* Host memory access error */ +#define x_M_FM_TAPETRN 5 /* Tape transfer error */ +#define x_M_FM_STIERR 6 /* STI communication or command failure */ +#define x_M_FM_STIDEL 7 /* STI drive error log */ +#define x_M_FM_STIFEL 010 /* STI formatter error log */ + +/* + * Error Log message flags + */ +#define x_M_LF_SUCC 0200 /* Operation successful */ +#define x_M_LF_CONT 0100 /* Operation continuing */ +#define x_M_LF_SQNRS 0001 /* Sequence number reset */ + +/* + * Tape Format Flag Values + */ +#define x_M_TF_800 001 /* NRZI 800 bpi */ +#define x_M_TF_PE 002 /* Phase Encoded 1600 bpi */ +#define x_M_TF_GCR 004 /* Group Code Recording 6250 bpi */ +#define x_M_TF_BLK 010 /* Cartridge Block Mode */ + +/* + * MSCP Error Log packet + * + * NOTE: MSCP packet must be padded to this size. + */ + +struct x_mslg { + struct x_mscp_header x_mslg_header;/* device specific header */ + x_long x_mslg_cmdref; /* command reference number */ + x_short x_mslg_unit; /* unit number */ + x_short x_mslg_seqnum; /* sequence number */ + x_u_char x_mslg_format; /* format */ + x_u_char x_mslg_flags; /* error log message flags */ + x_short x_mslg_event; /* event code */ + x_quad x_mslg_cntid; /* controller id */ + x_u_char x_mslg_cntsvr; /* controller software version */ + x_u_char x_mslg_cnthvr; /* controller hardware version */ + x_short x_mslg_multunt; /* multi-unit code */ + x_quad x_mslg_unitid; /* unit id */ + x_u_char x_mslg_unitsvr; /* unit software version */ + x_u_char x_mslg_unithvr; /* unit hardware version */ + x_short x_mslg_group; /* group; retry + level */ + x_long x_mslg_position; /* position (object count) */ + x_u_char x_mslg_fmtsvr; /* formatter software version */ + x_u_char x_mslg_fmthvr; /* formatter hardware version */ + x_short x_mslg_xxx2; /* unused */ + char x_mslg_stiunsucc[62]; /* STI status information */ +}; + +#define x_mslg_busaddr x_mslg_unitid.x_val[0] +#define x_mslg_sdecyl x_mslg_group + +#endif diff --git a/x_include/vax/x_trap.h b/x_include/vax/x_trap.h new file mode 100644 index 0000000..1f91061 --- /dev/null +++ b/x_include/vax/x_trap.h @@ -0,0 +1,35 @@ +#include "x_.h" + +#ifndef x__VAX_TRAP_H_ +#define x__VAX_TRAP_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)trap.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Trap type values + */ + +/* The first three constant values are known to the real world */ +#define x_T_RESADFLT 0 /* reserved addressing fault */ +#define x_T_PRIVINFLT 1 /* privileged instruction fault */ +#define x_T_RESOPFLT 2 /* reserved operand fault */ +/* End of known constants */ +#define x_T_BPTFLT 3 /* bpt instruction fault */ +#define x_T_XFCFLT 4 /* xfc instruction fault */ +#define x_T_SYSCALL 5 /* chmk instruction (syscall trap) */ +#define x_T_ARITHTRAP 6 /* arithmetic trap */ +#define x_T_ASTFLT 7 /* software level 2 trap (ast deliv) */ +#define x_T_SEGFLT 8 /* segmentation fault */ +#define x_T_PROTFLT 9 /* protection fault */ +#define x_T_TRCTRAP 10 /* trace trap */ +#define x_T_COMPATFLT 11 /* compatibility mode fault */ +#define x_T_PAGEFLT 12 /* page fault */ +#define x_T_TABLEFLT 13 /* page table fault */ + +#endif diff --git a/x_include/vax/x_vmparam.h b/x_include/vax/x_vmparam.h new file mode 100644 index 0000000..6387fc2 --- /dev/null +++ b/x_include/vax/x_vmparam.h @@ -0,0 +1,171 @@ +#include "x_.h" + +#ifndef x__VAX_VMPARAM_H_ +#define x__VAX_VMPARAM_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)vmparam.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Machine dependent constants for VAX + */ +/* + * USRTEXT is the start of the user text/data space, while USRSTACK + * is the top (end) of the user stack. LOWPAGES and HIGHPAGES are + * the number of pages from the beginning of the P0 region to the + * beginning of the text and from the beginning of the P1 region to the + * beginning of the stack respectively. + */ +#define x_USRTEXT 0 +#define x_USRSTACK (0x80000000-x_UPAGES*x_NBPG) /* Start of user stack */ +#define x_BTOPUSRSTACK (0x400000 - x_UPAGES) /* btop(USRSTACK) */ +/* number of ptes per page */ +#define x_P1PAGES 0x200000 /* number of pages in P1 region */ +#define x_LOWPAGES 0 +#define x_HIGHPAGES x_UPAGES + +/* + * Virtual memory related constants, all in bytes + */ +#ifndef x_MAXTSIZ +#define x_MAXTSIZ (6*1024*1024) /* max text size */ +#endif +#ifndef x_DFLDSIZ +#define x_DFLDSIZ (6*1024*1024) /* initial data size limit */ +#endif +#ifndef x_MAXDSIZ +#define x_MAXDSIZ (16*1024*1024) /* max data size */ +#endif +#ifndef x_DFLSSIZ +#define x_DFLSSIZ (512*1024) /* initial stack size limit */ +#endif +#ifndef x_MAXSSIZ +#define x_MAXSSIZ x_MAXDSIZ /* max stack size */ +#endif + +/* + * Default sizes of swap allocation chunks (see dmap.h). + * The actual values may be changed in vminit() based on MAXDSIZ. + * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. + */ +#define x_DMMIN 32 /* smallest swap allocation */ +#define x_DMMAX 4096 /* largest potential swap allocation */ +#define x_DMTEXT 1024 /* swap allocation for text */ + +/* + * Sizes of the system and user portions of the system page table. + */ +/* SYSPTSIZE IS SILLY; IT SHOULD BE COMPUTED AT BOOT TIME */ +#define x_SYSPTSIZE ((20+x_MAXUSERS)*x_NPTEPG) +#define x_USRPTSIZE (32*x_NPTEPG) + +/* + * The size of the clock loop. + */ +#define x_LOOPPAGES (x_maxfree - x_firstfree) + +/* + * The time for a process to be blocked before being very swappable. + * This is a number of seconds which the system takes as being a non-trivial + * amount of real time. You probably shouldn't change this; + * it is used in subtle ways (fractions and multiples of it are, that is, like + * half of a ``long time'', almost a long time, etc.) + * It is related to human patience and other factors which don't really + * change over time. + */ +#define x_MAXSLP 20 + +/* + * A swapped in process is given a small amount of core without being bothered + * by the page replacement algorithm. Basically this says that if you are + * swapped in you deserve some resources. We protect the last SAFERSS + * pages against paging and will just swap you out rather than paging you. + * Note that each process has at least UPAGES+CLSIZE pages which are not + * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this + * number just means a swapped in process is given around 25k bytes. + * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), + * so we loan each swapped in process memory worth 100$, or just admit + * that we don't consider it worthwhile and swap it out to disk which costs + * $30/mb or about $0.75. + */ +#define x_SAFERSS 32 /* nominal ``small'' resident set size + protected against replacement */ + +/* + * DISKRPM is used to estimate the number of paging i/o operations + * which one can expect from a single disk controller. + */ +#define x_DISKRPM 60 + +/* + * Klustering constants. Klustering is the gathering + * of pages together for pagein/pageout, while clustering + * is the treatment of hardware page size as though it were + * larger than it really is. + * + * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) + * units. Note that KLMAX*CLSIZE must be <= DMMIN in dmap.h. + */ + +#define x_KLMAX (32/x_CLSIZE) +#define x_KLSEQL (16/x_CLSIZE) /* in klust if vadvise(VA_SEQL) */ +#define x_KLIN (8/x_CLSIZE) /* default data/stack in klust */ +#define x_KLTXT (4/x_CLSIZE) /* default text in klust */ +#define x_KLOUT (32/x_CLSIZE) + +/* + * KLSDIST is the advance or retard of the fifo reclaim for sequential + * processes data space. + */ +#define x_KLSDIST 3 /* klusters advance/retard for seq. fifo */ + +/* + * Paging thresholds (see vm_sched.c). + * Strategy of 1/19/85: + * lotsfree is 512k bytes, but at most 1/4 of memory + * desfree is 200k bytes, but at most 1/8 of memory + * minfree is 64k bytes, but at most 1/2 of desfree + */ +#define x_LOTSFREE (512 * 1024) +#define x_LOTSFREEFRACT 4 +#define x_DESFREE (200 * 1024) +#define x_DESFREEFRACT 8 +#define x_MINFREE (64 * 1024) +#define x_MINFREEFRACT 2 + +/* + * There are two clock hands, initially separated by HANDSPREAD bytes + * (but at most all of user memory). The amount of time to reclaim + * a page once the pageout process examines it increases with this + * distance and decreases as the scan rate rises. + */ +#define x_HANDSPREAD (2 * 1024 * 1024) + +/* + * The number of times per second to recompute the desired paging rate + * and poke the pagedaemon. + */ +#define x_RATETOSCHEDPAGING 4 + +/* + * Believed threshold (in megabytes) for which interleaved + * swapping area is desirable. + */ +#define x_LOTSOFMEM 2 + +/* + * BEWARE THIS DEFINITION WORKS ONLY WITH COUNT OF 1 + */ +/* moved this to sys/vmmac.h to avoid a circular dependency */ +/*#define mapin(pte, v, pfnum, count, prot) \ + (*(int *)(pte) = (pfnum) | (prot), mtpr(TBIS, ptob(v)))*/ + +#endif diff --git a/x_include/vaxif/x_if_accreg.h b/x_include/vaxif/x_if_accreg.h new file mode 100644 index 0000000..54bb37c --- /dev/null +++ b/x_include/vaxif/x_if_accreg.h @@ -0,0 +1,74 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_ACCREG_H_ +#define x__VAXIF_IF_ACCREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_accreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * ACC LH/DH-11 interface + */ + +struct x_accdma { + x_short x_csr; /* control and status */ + x_short x_db; /* data buffer */ + x_u_short x_ba; /* buss address */ + x_short x_wc; /* word count */ +}; + +struct x_accdevice { + struct x_accdma x_input; + struct x_accdma x_output; +}; + +#define x_icsr x_input.x_csr +#define x_iba x_input.x_ba +#define x_iwc x_input.x_wc +#define x_ocsr x_output.x_csr +#define x_oba x_output.x_ba +#define x_owc x_output.x_wc + +/* + * Bits Common to both input and out CSR's + */ +#define x_ACC_ERR 0x8000 /* error present */ +#define x_ACC_NXM 0x4000 /* non-existant memory */ +#define x_ACC_RDY 0x0080 /* ready */ +#define x_ACC_IE 0x0040 /* interrupt enable */ +#define x_ACC_RESET 0x0002 /* reset interface */ +#define x_ACC_GO 0x0001 /* start operation */ + +/* + * Input Control Status Register + */ +#define x_IN_EOM 0x2000 /* end-of-message recieved */ +#define x_IN_HRDY 0x0800 /* host ready */ +#define x_IN_IMPBSY 0x0400 /* IMP not ready */ +#define x_IN_RMR 0x0200 /* receive master ready error */ +#define x_IN_IBF 0x0100 /* input data buffer full */ +#define x_IN_WEN 0x0008 /* write enable */ +#define x_IN_MRDY 0x0004 /* master ready */ + +#define x_ACC_INBITS \ +"\20\20ERR\17NXM\16EOM\14HRDY\13IMPBSY\12RMR\11IBF\10RDY\7IE\ +\4x_WEN\3x_MRDY\2x_RESET\1x_GO" + +/* + * Output Control Status Register + */ +#define x_OUT_TMR 0x0200 /* transmit master ready error */ +#define x_OUT_BBACK 0x0008 /* bus back */ +#define x_OUT_ENLB 0x0004 /* enable last bit */ + +#define x_ACC_OUTBITS \ +"\20\20ERR\17NXM\12TMR\10RDY\7IE\4BBACK\3ENLB\2RESET\1GO" + +#endif diff --git a/x_include/vaxif/x_if_cssreg.h b/x_include/vaxif/x_if_cssreg.h new file mode 100644 index 0000000..958e4c8 --- /dev/null +++ b/x_include/vaxif/x_if_cssreg.h @@ -0,0 +1,75 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_CSSREG_H_ +#define x__VAXIF_IF_CSSREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_cssreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * DEC/CSS IMP11-A ARPAnet interface + */ + +struct x_cssdma { + x_short x_wc; /* word count */ + x_u_short x_ba; /* bus address (low 16 bits) */ + x_short x_csr; /* status register */ + x_short x_db; /* data buffer*/ +}; + +struct x_cssdevice { + struct x_cssdma x_css_output; /* transmit DR11-B */ + struct x_cssdma x_css_hole; /* unclever gap */ + struct x_cssdma x_css_input; /* receive DR11-B */ +}; + +#define x_css_icsr x_css_input.x_csr +#define x_css_iba x_css_input.x_ba +#define x_css_iwc x_css_input.x_wc +#define x_css_ocsr x_css_output.x_csr +#define x_css_oba x_css_output.x_ba +#define x_css_owc x_css_output.x_wc + +/* + * Bits Common to both input and out CSR's + */ +#define x_CSS_ERR 0x8000 /* error present */ +#define x_CSS_NXM 0x4000 /* non-existant memory */ +#define x_CSS_ATTN 0x2000 /* attention */ +#define x_CSS_MAINT 0x1000 /* maintenance mode */ +#define x_CSS_CYCLE 0x0100 /* force bus cycle */ +#define x_CSS_RDY 0x0080 /* ready */ +#define x_CSS_IE 0x0040 /* interrupt enable */ +#define x_CSS_XA 0x0030 /* extended address bits */ +#define x_CSS_CLR 0x0020 /* clear status (reset) */ +#define x_CSS_GO 0x0001 /* start operation */ + +/* + * Input Control Status Register + */ +#define x_IN_EOM 0x0800 /* end-of-message recieved */ +#define x_IN_IMPNR 0x0400 /* IMP not ready */ +#define x_IN_RLE 0x0200 /* ready line error */ +#define x_IN_WEN 0x0008 /* write enable */ +#define x_IN_HRDY 0x0004 /* host ready */ + +#define x_CSS_INBITS \ +"\20\20ERR\17NXM\16ATTN\15MAINT\14EOM\13IMPNR\12RLE\11CYCLE\10RDY\7IE\6XBA17\5XBA16\4WE\3HRDY\2CLR\1GO" + +/* + * Output Control Status Register + */ +#define x_OUT_TXEC 0x0008 /* tx error clear */ +#define x_OUT_ENLB 0x0004 /* enable last bit */ + +#define x_CSS_OUTBITS \ +"\20\20ERR\17NXM\16ATTN\15MAINT\11CYCLE\10RDY\7IE\6XBA17\5XBA16\4TXEC\3ENLB\2CLR\1GO" + +#endif diff --git a/x_include/vaxif/x_if_ddnreg.h b/x_include/vaxif/x_if_ddnreg.h new file mode 100644 index 0000000..4274778 --- /dev/null +++ b/x_include/vaxif/x_if_ddnreg.h @@ -0,0 +1,135 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_DDNREG_H_ +#define x__VAXIF_IF_DDNREG_H_ + +#include + +/* @(#)if_ddnreg.h 7.1 (Berkeley) 6/5/86 */ + +/************************************************************************\ + + ________________________________________________________ + / \ + | AAA CCCCCCCCCCCCCC CCCCCCCCCCCCCC | + | AAAAA CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC | + | AAAAAAA CCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCC | + | AAAA AAAA CCCC CCCC | + | AAAA AAAA CCCC CCCC | + | AAAA AAAA CCCC CCCC | + | AAAA AAAA CCCC CCCC | + | AAAA AAAAAAAAAAA CCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCC | + | AAAA AAAAAAAAAAA CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC | + | AAAA AAAAAAAAA CCCCCCCCCCCCCC CCCCCCCCCCCCCC | + \________________________________________________________/ + + Copyright (c) 1985 by Advanced Computer Communications + 720 Santa Barbara Street, Santa Barbara, California 93101 + (805) 963-9431 + + This software may be duplicated and used on systems + which are licensed to run U.C. Berkeley versions of + the UNIX operating system. Any duplication of any + part of this software must include a copy of ACC's + copyright notice. + +File: + if_ddnreg.h + +Author: + Art Berggreen + +Project: + 4.2 DDN X.25 network driver + +Function: + This file contains definitions of the hardware + interface of the ACP625 (IF-11/X25). + +Components: + +Revision History: + 16-May-1985: V1.0 - First release. + Art Berggreen. + +\************************************************************************/ + + +/* if_ddnvar.h V1.0 5/16/85 */ + +/* + * ACC IF-11/DDN-X25 interface + */ + +struct x_ddnregs { /* device registers */ + x_u_short x_csr; /* control and status register */ + x_u_char x_iochn; /* logical channel */ + x_u_char x_ioadx; /* address extension (A16,A17) */ + x_u_short x_ioadl; /* buffer address (A0-A15) */ + x_u_short x_iocnt; /* byte count */ + x_u_char x_iofcn; /* UMC funciton code */ + x_u_char x_iosbf; /* UMC subfunction code */ + x_u_char x_ioini; /* comm regs valid flag */ + x_u_char x_staack; /* interrupt acknowledge flag */ + x_u_char x_ionmi; /* NMI routine active flag */ + x_u_char x_xfrgnt; /* UMR transfer grant flag */ + x_u_char x_stachn; /* interrupt channel number */ + x_u_char x_statyp; /* interrupt type code */ + x_u_char x_stacc; /* completion function code */ + x_u_char x_stacs; /* completion subfunction code */ + x_u_short x_stacnt; /* completion byte count */ +}; + +#define x_iovect x_iochn + +/* defines for CSR */ + +#define x_DDN_UER 0100000 /* UMC error condition */ +#define x_DDN_NXM 0040000 /* non-existent memory error */ +#define x_DDN_PER 0020000 /* UNIBUS parity error */ +#define x_DDN_ZRUN 0010000 /* Z80 running */ +#define x_DDN_ZGO 0004000 /* Z80 not in wait state */ +#define x_DDN_MBLK 0000200 /* memory swap state (0=main, 1=srv) */ +#define x_DDN_SRV 0000100 /* select UMC service memory */ +#define x_DDN_MAIN 0000040 /* select UMC main memory */ +#define x_DDN_DMA 0000020 /* DMA enable */ +#define x_DDN_WRT 0000010 /* DMA write enable */ +#define x_DDN_IEN 0000004 /* interrupt enable */ +#define x_DDN_RST 0000002 /* reset */ +#define x_DDN_NMI 0000001 /* cause NMI */ + +#define x_DDN_BITS \ +"\10\20UER\17NXM\16PER\15ZRUN\14ZGO\10MBLK\7SRV\6MAIN\5DMA\4WRT\3IEN\2RST\1NMI" + +/* start i/o function code definitions */ + +#define x_DDNWRT 0 /* write to if-11 */ +#define x_DDNRDB 1 /* read from if-11 */ +#define x_DDNSTR 2 /* stream flag */ +#define x_DDNEOS (4|x_DDNSTR) /* end of stream flag */ +#define x_DDNABT 8 /* abort flag */ +#define x_DDNUMR 16 /* UMR protocol flag */ + +/* interrupt type definitions */ + +#define x_DDNSACK 0 /* start i/o ack */ +#define x_DDNDONE 1 /* i/o completion */ +#define x_DDNXREQ 2 /* UMR protocol transfer request */ + +/* i/o completion codes */ + +#define x_DDNIOCOK 0001 /* successful completion */ +#define x_DDNIOCOKP 0002 /* successful completion, more data pending */ +#define x_DDNIOCABT 0361 /* i/o aborted */ +#define x_DDNIOCERR 0321 /* program error */ +#define x_DDNIOCOVR 0363 /* overrun error */ +#define x_DDNIOCUBE 0374 /* non-existant memory or unibus error */ + +/* UMR protocol transfer grant code definitions */ + +#define x_DDNXEVN 1 /* start with even address */ +#define x_DDNXODD 2 /* start with odd address */ +#define x_DDNNUMR 4 /* non-UMR transfer */ +#define x_DDNXABT 8 /* abort transfer */ + +#endif diff --git a/x_include/vaxif/x_if_ddnvar.h b/x_include/vaxif/x_if_ddnvar.h new file mode 100644 index 0000000..505892b --- /dev/null +++ b/x_include/vaxif/x_if_ddnvar.h @@ -0,0 +1,124 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_DDNVAR_H_ +#define x__VAXIF_IF_DDNVAR_H_ + +/* @(#)if_ddnvar.h 7.1 (Berkeley) 6/5/86 */ + +/************************************************************************\ + + ________________________________________________________ + / \ + | AAA CCCCCCCCCCCCCC CCCCCCCCCCCCCC | + | AAAAA CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC | + | AAAAAAA CCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCC | + | AAAA AAAA CCCC CCCC | + | AAAA AAAA CCCC CCCC | + | AAAA AAAA CCCC CCCC | + | AAAA AAAA CCCC CCCC | + | AAAA AAAAAAAAAAA CCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCC | + | AAAA AAAAAAAAAAA CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC | + | AAAA AAAAAAAAA CCCCCCCCCCCCCC CCCCCCCCCCCCCC | + \________________________________________________________/ + + Copyright (c) 1985 by Advanced Computer Communications + 720 Santa Barbara Street, Santa Barbara, California 93101 + (805) 963-9431 + + This software may be duplicated and used on systems + which are licensed to run U.C. Berkeley versions of + the UNIX operating system. Any duplication of any + part of this software must include a copy of ACC's + copyright notice. + +File: + if_ddnvar.h + +Author: + Art Berggreen + +Project: + 4.2 DDN X.25 network driver + +Function: + This file contains definitions used to control and + track the status of the ACP625 (IF-11/X25). + +Components: + +Revision History: + 16-May-1985: V1.0 - First release. + Art Berggreen. + +\************************************************************************/ + + +/* if_ddnvar.h V1.0 5/16/85 */ + +/* program parameters */ + +#define x_DDNMTU 1006 /* maximum IP msg length */ +#define x_DDN_OQMAX 8 /* max IP msgs on LCN output q */ +#define x_NDDNCH 32 /* number of X.25 channels */ +#define x_DELAY_CNT 50000 +#define x_DDN_TIMEOUT 10 + +#define x_DC_OBUSY 0x01 + +typedef unsigned char x_byte; +typedef x_int x_boolean; + +/* X25 LCN state definitions */ +#define x_LC_DOWN 0 /* X25 circuit down */ +#define x_LC_RESTART 1 /* X25 circuit restarting */ +#define x_LC_IDLE 2 /* X25 circuit not in use */ +#define x_LC_CALL_PENDING 3 /* X25 circuit call pending */ +#define x_LC_DATA_IDLE 4 /* X25 circuit open */ +#define x_LC_CLR_PENDING 5 /* X25 circuit clear pending */ + +/* Timeout definitions */ +#define x_TMO_OFF 0 /* timer off */ +#define x_TMO_RESTART ( 90/x_DDN_TIMEOUT) /* restart timeout */ +#define x_TMO_CALL_PENDING (180/x_DDN_TIMEOUT) /* call timeout */ +#define x_TMO_DATA_IDLE ( 30/x_DDN_TIMEOUT) /* idle circuit timeout */ +#define x_TMO_CLR_PENDING ( 30/x_DDN_TIMEOUT) /* clear timeout */ + +/* Link status codes */ +#define x_LINK_DOWN 0x00 /* Link layer is down */ +#define x_LINK_UP 0x01 /* Link layer is up */ + +/* Line control codes */ +#define x_LINK_DISABLE 0x00 /* Disable link layer */ +#define x_LINK_ENABLE 0x01 /* Enable link layer */ +#define x_LINK_LOOPBACK 0x42 /* Link layer loopback mode */ +#define x_LOOP_OFF 0x00 /* Loopback off */ +#define x_LOOP_EXTERNAL 0x01 /* Loopback external */ +#define x_LOOP_INTERNAL 0x03 /* Loopback internal */ +#define x_PKT_SIZE 0x90 /* Packet size */ +#define x_PKT_WINDOW 0x4f /* Packet window */ + +/* X25 supervisor message codes */ +#define x_CALL 0x00 /* outgoing call */ +#define x_RING 0x01 /* incoming call */ +#define x_CLEARVC 0x02 /* clear by VCN */ +#define x_ANSWER 0x03 /* answer call */ +#define x_CLEARLC 0x04 /* clear by LCN */ +#define x_RESET 0x20 /* reset LCN */ +#define x_RESET_ACK 0x21 /* reset ack */ +#define x_INTERRUPT 0x22 /* X25 interrupt */ +#define x_READY 0x23 /* flow control ready */ +#define x_INTR_ACK 0x24 /* interrupt ack */ +#define x_RESTART 0x40 /* X25 restart */ +#define x_RSTRT_ACK 0x41 /* restart ack */ +#define x_SYS_STATUS 0x42 /* system status msg */ +#define x_LINE_CNTL 0x60 /* link control cmnd */ +#define x_LINE_STATUS 0x61 /* link status resp */ + +/* X25 facilities */ +#define x_X25_FACIL_DDN 0x04 /* DDN mode facility */ +#define x_FAC_DDNSTD 0x01 /* DDN standard mode */ + +/* X25 protocols */ +#define x_X25_PROTO_IP 0xcc /* X25 IP protocol type code */ + +#endif diff --git a/x_include/vaxif/x_if_dereg.h b/x_include/vaxif/x_if_dereg.h new file mode 100644 index 0000000..9e63fc9 --- /dev/null +++ b/x_include/vaxif/x_if_dereg.h @@ -0,0 +1,201 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_DEREG_H_ +#define x__VAXIF_IF_DEREG_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_dereg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * DEC DEUNA interface + */ +struct x_dedevice { + union { + x_short x_p0_w; + char x_p0_b[2]; + } x_u_p0; +#define x_pcsr0 x_u_p0.x_p0_w +#define x_pclow x_u_p0.x_p0_b[0] +#define x_pchigh x_u_p0.x_p0_b[1] + x_short x_pcsr1; + x_short x_pcsr2; + x_short x_pcsr3; +}; + +/* + * PCSR 0 bit descriptions + */ +#define x_PCSR0_SERI 0x8000 /* Status error interrupt */ +#define x_PCSR0_PCEI 0x4000 /* Port command error interrupt */ +#define x_PCSR0_RXI 0x2000 /* Receive done interrupt */ +#define x_PCSR0_TXI 0x1000 /* Transmit done interrupt */ +#define x_PCSR0_DNI 0x0800 /* Done interrupt */ +#define x_PCSR0_RCBI 0x0400 /* Receive buffer unavail intrpt */ +#define x_PCSR0_FATI 0x0100 /* Fatal error interrupt */ +#define x_PCSR0_INTR 0x0080 /* Interrupt summary */ +#define x_PCSR0_INTE 0x0040 /* Interrupt enable */ +#define x_PCSR0_RSET 0x0020 /* DEUNA reset */ +#define x_PCSR0_CMASK 0x000f /* command mask */ + +#define x_PCSR0_BITS "\20\20SERI\17PCEI\16RXI\15TXI\14DNI\13RCBI\11FATI\10INTR\7INTE\6RSET" + +/* bits 0-3 are for the PORT_COMMAND */ +#define x_CMD_NOOP 0x0 +#define x_CMD_GETPCBB 0x1 /* Get PCB Block */ +#define x_CMD_GETCMD 0x2 /* Execute command in PCB */ +#define x_CMD_STEST 0x3 /* Self test mode */ +#define x_CMD_START 0x4 /* Reset xmit and receive ring ptrs */ +#define x_CMD_BOOT 0x5 /* Boot DEUNA */ +#define x_CMD_PDMD 0x8 /* Polling demand */ +#define x_CMD_TMRO 0x9 /* Sanity timer on */ +#define x_CMD_TMRF 0xa /* Sanity timer off */ +#define x_CMD_RSTT 0xb /* Reset sanity timer */ +#define x_CMD_STOP 0xf /* Suspend operation */ + +/* + * PCSR 1 bit descriptions + */ +#define x_PCSR1_XPWR 0x8000 /* Transceiver power BAD */ +#define x_PCSR1_ICAB 0x4000 /* Interconnect cabling BAD */ +#define x_PCSR1_STCODE 0x3f00 /* Self test error code */ +#define x_PCSR1_PCTO 0x0080 /* Port command timed out */ +#define x_PCSR1_ILLINT 0x0040 /* Illegal interrupt */ +#define x_PCSR1_TIMEOUT 0x0020 /* Timeout */ +#define x_PCSR1_POWER 0x0010 /* Power fail */ +#define x_PCSR1_RMTC 0x0008 /* Remote console reserved */ +#define x_PCSR1_STMASK 0x0007 /* State */ + +/* bit 0-3 are for STATE */ +#define x_STAT_RESET 0x0 +#define x_STAT_PRIMLD 0x1 /* Primary load */ +#define x_STAT_READY 0x2 +#define x_STAT_RUN 0x3 +#define x_STAT_UHALT 0x5 /* UNIBUS halted */ +#define x_STAT_NIHALT 0x6 /* NI halted */ +#define x_STAT_NIUHALT 0x7 /* NI and UNIBUS Halted */ + +#define x_PCSR1_BITS "\20\20XPWR\17ICAB\10PCTO\7ILLINT\6TIMEOUT\5POWER\4RMTC" + +/* + * Port Control Block Base + */ +struct x_de_pcbb { + x_short x_pcbb0; /* function */ + x_short x_pcbb2; /* command specific */ + x_short x_pcbb4; + x_short x_pcbb6; +}; + +/* PCBB function codes */ +#define x_FC_NOOP 0x00 /* NO-OP */ +#define x_FC_LSUADDR 0x01 /* Load and start microaddress */ +#define x_FC_RDDEFAULT 0x02 /* Read default physical address */ +#define x_FC_RDPHYAD 0x04 /* Read physical address */ +#define x_FC_WTPHYAD 0x05 /* Write physical address */ +#define x_FC_RDMULTI 0x06 /* Read multicast address list */ +#define x_FC_WTMULTI 0x07 /* Read multicast address list */ +#define x_FC_RDRING 0x08 /* Read ring format */ +#define x_FC_WTRING 0x09 /* Write ring format */ +#define x_FC_RDCNTS 0x0a /* Read counters */ +#define x_FC_RCCNTS 0x0b /* Read and clear counters */ +#define x_FC_RDMODE 0x0c /* Read mode */ +#define x_FC_WTMODE 0x0d /* Write mode */ +#define x_FC_RDSTATUS 0x0e /* Read port status */ +#define x_FC_RCSTATUS 0x0f /* Read and clear port status */ +#define x_FC_DUMPMEM 0x10 /* Dump internal memory */ +#define x_FC_LOADMEM 0x11 /* Load internal memory */ +#define x_FC_RDSYSID 0x12 /* Read system ID parameters */ +#define x_FC_WTSYSID 0x13 /* Write system ID parameters */ +#define x_FC_RDSERAD 0x14 /* Read load server address */ +#define x_FC_WTSERAD 0x15 /* Write load server address */ + +/* + * Unibus Data Block Base (UDBB) for ring buffers + */ +struct x_de_udbbuf { + x_short x_b_tdrbl; /* Transmit desc ring base low 16 bits */ + char x_b_tdrbh; /* Transmit desc ring base high 2 bits */ + char x_b_telen; /* Length of each transmit entry */ + x_short x_b_trlen; /* Number of entries in the XMIT desc ring */ + x_short x_b_rdrbl; /* Receive desc ring base low 16 bits */ + char x_b_rdrbh; /* Receive desc ring base high 2 bits */ + char x_b_relen; /* Length of each receive entry */ + x_short x_b_rrlen; /* Number of entries in the RECV desc ring */ +}; + +/* + * Transmit/Receive Ring Entry + */ +struct x_de_ring { + x_short x_r_slen; /* Segment length */ + x_short x_r_segbl; /* Segment address (low 16 bits) */ + char x_r_segbh; /* Segment address (hi 2 bits) */ + x_u_char x_r_flags; /* Status flags */ + x_u_short x_r_tdrerr; /* Errors */ +#define x_r_lenerr x_r_tdrerr + x_short x_r_rid; /* Request ID */ +}; + +#define x_XFLG_OWN 0x80 /* If 0 then owned by driver */ +#define x_XFLG_ERRS 0x40 /* Error summary */ +#define x_XFLG_MTCH 0x20 /* Address match on xmit request */ +#define x_XFLG_MORE 0x10 /* More than one entry required */ +#define x_XFLG_ONE 0x08 /* One collision encountered */ +#define x_XFLG_DEF 0x04 /* Transmit deferred */ +#define x_XFLG_STP 0x02 /* Start of packet */ +#define x_XFLG_ENP 0x01 /* End of packet */ + +#define x_XFLG_BITS "\10\10OWN\7ERRS\6MTCH\5MORE\4ONE\3DEF\2STP\1ENP" + +#define x_XERR_BUFL 0x8000 /* Buffer length error */ +#define x_XERR_UBTO 0x4000 /* UNIBUS tiemout +#define XERR_LCOL 0x1000 /* Late collision */ +#define x_XERR_LCAR 0x0800 /* Loss of carrier */ +#define x_XERR_RTRY 0x0400 /* Failed after 16 retries */ +#define x_XERR_TDR 0x03ff /* TDR value */ + +#define x_XERR_BITS "\20\20BUFL\17UBTO\15LCOL\14LCAR\13RTRY" + +#define x_RFLG_OWN 0x80 /* If 0 then owned by driver */ +#define x_RFLG_ERRS 0x40 /* Error summary */ +#define x_RFLG_FRAM 0x20 /* Framing error */ +#define x_RFLG_OFLO 0x10 /* Message overflow */ +#define x_RFLG_CRC 0x08 /* CRC error */ +#define x_RFLG_STP 0x02 /* Start of packet */ +#define x_RFLG_ENP 0x01 /* End of packet */ + +#define x_RFLG_BITS "\10\10OWN\7ERRS\6FRAM\5OFLO\4CRC\2STP\1ENP" + +#define x_RERR_BUFL 0x8000 /* Buffer length error */ +#define x_RERR_UBTO 0x4000 /* UNIBUS tiemout */ +#define x_RERR_NCHN 0x2000 /* No data chaining */ +#define x_RERR_MLEN 0x0fff /* Message length */ + +#define x_RERR_BITS "\20\20BUFL\17UBTO\16NCHN" + +/* mode description bits */ +#define x_MOD_HDX 0x0001 /* Half duplex mode */ +#define x_MOD_LOOP 0x0004 /* Enable internal loopback */ +#define x_MOD_DTCR 0x0008 /* Disables CRC generation */ +#define x_MOD_DMNT 0x0200 /* Disable maintenance features */ +#define x_MOD_ECT 0x0400 /* Enable collision test */ +#define x_MOD_TPAD 0x1000 /* Transmit message pad enable */ +#define x_MOD_DRDC 0x2000 /* Disable data chaining */ +#define x_MOD_ENAL 0x4000 /* Enable all multicast */ +#define x_MOD_PROM 0x8000 /* Enable promiscuous mode */ + +struct x_de_buf { + struct x_ether_header x_db_head; /* header */ + char x_db_data[x_ETHERMTU]; /* packet data */ + x_int x_db_crc; /* CRC - on receive only */ +}; + +#endif diff --git a/x_include/vaxif/x_if_dmc.h b/x_include/vaxif/x_if_dmc.h new file mode 100644 index 0000000..4d99416 --- /dev/null +++ b/x_include/vaxif/x_if_dmc.h @@ -0,0 +1,107 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_DMC_H_ +#define x__VAXIF_IF_DMC_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_dmc.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * DMC-11 Interface + */ + +struct x_dmcdevice { + char x_bsel0; + char x_bsel1; + char x_bsel2; + char x_bsel3; + x_short x_sel4; + x_short x_sel6; +}; + +/* + * dmc software packet encapsulation. This allows the dmc + * link to be multiplexed among several protocols. + * The first eight bytes of the dmc header are garbage, + * since on a vax the uba has been known to mung these + * bytes. The next two bytes encapsulate packet type. + */ +struct x_dmc_header { + char x_dmc_buf[8]; /* space for uba on vax */ + x_short x_dmc_type; /* encapsulate packet type */ +}; + +/* packet types */ +#define x_DMC_IPTYPE 1 +#define x_DMC_TRAILER 2 +#define x_DMC_NTRAILER 16 + +/* + * DMCMTU includes space for data (1024) + + * protocol header (256) + trailer descriptor (4). + * The software link encapsulation header (dmc_header) + * is handled separately. + */ +#define x_DMCMTU 1284 + +#define x_RDYSCAN 16 /* loop delay for RDYI after RQI */ + +/* defines for bsel0 */ +#define x_DMC_BACCI 0 +#define x_DMC_CNTLI 1 +#define x_DMC_PERR 2 +#define x_DMC_BASEI 3 +#define x_DMC_WRITE 0 /* transmit block */ +#define x_DMC_READ 4 /* read block */ +#define x_DMC_RQI 0040 /* port request bit */ +#define x_DMC_IEI 0100 /* enable input interrupts */ +#define x_DMC_RDYI 0200 /* port ready */ +#define x_DMC0BITS "\10\8RDI\7IEI\6RQI" + +/* defines for bsel1 */ +#define x_DMC_MCLR 0100 /* DMC11 Master Clear */ +#define x_DMC_RUN 0200 /* clock running */ +#define x_DMC1BITS "\10\8RUN\7MCLR" + +/* defines for bsel2 */ +#define x_DMC_BACCO 0 +#define x_DMC_CNTLO 1 +#define x_DMC_OUX 0 /* transmit block */ +#define x_DMC_OUR 4 /* read block */ +#define x_DMC_IEO 0100 /* enable output interrupts */ +#define x_DMC_RDYO 0200 /* port available */ +#define x_DMC2BITS "\10\8RDO\7IEO" + +/* defines for CNTLI mode */ +#define x_DMC_HDPLX 02000 /* half duplex DDCMP operation */ +#define x_DMC_SEC 04000 /* half duplex secondary station */ +#define x_DMC_MAINT 00400 /* enter maintenance mode */ + +/* defines for BACCI/O and BASEI mode */ +#define x_DMC_XMEM 0140000 /* xmem bit position */ +#define x_DMC_CCOUNT 0037777 /* character count mask */ +#define x_DMC_RESUME 0002000 /* resume (BASEI only) */ + +/* defines for CNTLO */ +#define x_DMC_CNTMASK 01777 + +#define x_DMC_DATACK 01 +#define x_DMC_TIMEOUT 02 +#define x_DMC_NOBUFS 04 +#define x_DMC_MAINTREC 010 +#define x_DMC_LOSTDATA 020 +#define x_DMC_DISCONN 0100 +#define x_DMC_START 0200 +#define x_DMC_NEXMEM 0400 +#define x_DMC_ERROR 01000 + +#define x_DMC_FATAL (x_DMC_ERROR|x_DMC_NEXMEM|x_DMC_START|x_DMC_LOSTDATA|x_DMC_MAINTREC) +#define x_CNTLO_BITS \ + "\10\12ERROR\11NEXMEM\10START\7DISC\5LSTDATA\4MAINT\3NOBUF\2TIMEO\1DATACK" + +#endif diff --git a/x_include/vaxif/x_if_ecreg.h b/x_include/vaxif/x_if_ecreg.h new file mode 100644 index 0000000..4038308 --- /dev/null +++ b/x_include/vaxif/x_if_ecreg.h @@ -0,0 +1,72 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_ECREG_H_ +#define x__VAXIF_IF_ECREG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_ecreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * 3Com Ethernet controller registers. + */ +struct x_ecdevice { + x_short x_ec_rcr; /* Receive Control Register */ + x_short x_ec_xcr; /* Transmit Control Register */ +}; + +/* + * Control and status bits -- rcr + */ +#define x_EC_SPIE 0x8000 /* set parity interrupt enable */ +#define x_EC_ASTEP 0x4000 /* increment address counter */ +#define x_EC_AROM 0x2000 /* 1: Use address ROM, 0: use RAM */ +#define x_EC_PE 0x2000 /* Parity error */ +#define x_EC_AWCLK 0x1000 /* address write clock bit */ +#define x_EC_PIE 0x1000 /* Parity interrupt enable (read) */ +#define x_EC_ADATA 0x0f00 /* address/filtering */ +#define x_EC_RDONE 0x0080 /* receive done */ +#define x_EC_MDISAB 0x0080 /* memory disable */ +#define x_EC_RINTEN 0x0040 /* receive interrupt enable */ +#define x_EC_RCLR 0x0020 /* clear RDONE bit */ +#define x_EC_RWBN 0x0010 /* submit buffer for receive */ +#define x_EC_RBN 0x000f /* buffer number */ + +#define x_EC_RBITS "\10\16PE\15PIE\10RDONE\7RINTEN" + +/* + * Control and status bits -- xcr + */ +#define x_EC_JAM 0x8000 /* collision dectected */ +#define x_EC_JINTEN 0x4000 /* collision interrupt enable */ +#define x_EC_JCLR 0x2000 /* clear collision detect */ +#define x_EC_UECLR 0x0100 /* reset controller */ +#define x_EC_XDONE 0x0080 /* transmit done */ +#define x_EC_XINTEN 0x0040 /* transmit interrupt enable */ +#define x_EC_XCLR 0x0020 /* clear XDONE bit */ +#define x_EC_XWBN 0x0010 /* submit buffer for transmit */ +#define x_EC_XBN 0x000f /* buffer number */ + +#define x_EC_XBITS "\10\20JAM\17JINTEN\10XDONE\7XINTEN" + +/* + * Useful combinations + */ +#define x_EC_READ (0x600|x_EC_RINTEN|x_EC_RWBN) +#define x_EC_WRITE (x_EC_JINTEN|x_EC_XINTEN|x_EC_XWBN) +#define x_EC_CLEAR (x_EC_JINTEN|x_EC_XINTEN|x_EC_JCLR) + +/* + * Buffer number definitions + */ +#define x_ECTBF 0 /* Buffer for transmit */ +#define x_ECRLBF 1 /* First buffer for receive */ +#define x_ECRHBF 15 /* Last buffer for receive */ + +#define x_ECRDOFF 528 /* Packet offset in read buffer */ + +#endif diff --git a/x_include/vaxif/x_if_en.h b/x_include/vaxif/x_if_en.h new file mode 100644 index 0000000..702fcce --- /dev/null +++ b/x_include/vaxif/x_if_en.h @@ -0,0 +1,39 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_EN_H_ +#define x__VAXIF_IF_EN_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_en.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Structure of a Ethernet header. + */ +struct x_en_header { + x_u_char x_en_shost; + x_u_char x_en_dhost; + x_u_short x_en_type; +}; + +#define x_ENTYPE_PUP 0x0200 /* PUP protocol */ +#define x_ENTYPE_IP 0x0201 /* IP protocol */ + +/* + * The ENTYPE_NTRAILER packet types starting at + * ENTYPE_TRAIL have (type-ENTYPE_TRAIL)*512 bytes + * of data followed by an Ethernet type (as given above) + * and then the (variable-length) header. + */ +#define x_ENTYPE_TRAIL 0x1000 /* Trailer type */ +#define x_ENTYPE_NTRAILER 16 + +#define x_EN_BROADCAST 0 /* Hardware broadcast address */ + +#endif diff --git a/x_include/vaxif/x_if_enreg.h b/x_include/vaxif/x_if_enreg.h new file mode 100644 index 0000000..3b22ea5 --- /dev/null +++ b/x_include/vaxif/x_if_enreg.h @@ -0,0 +1,45 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_ENREG_H_ +#define x__VAXIF_IF_ENREG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_enreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Xerox experimental ethernet registers. + * + * N.B.: status register and device address are read/write, + * device address is read-only, rest are WRITE ONLY! + */ +struct x_endevice { + x_short x_en_owc; /* output word count (10 bits) */ + x_short x_en_oba; /* output buffer address */ + x_short x_en_ostat; /* output control and status */ + x_short x_en_odelay; /* output start delay, 25usec units */ + x_short x_en_iwc; /* input word count */ + x_short x_en_iba; /* input buffer address */ + x_short x_en_istat; /* input csr */ + x_short x_en_addr; /* ~device address (low 8 bits) */ +}; + +/* + * Control and status bits. + */ +#define x_EN_IERROR 0x8000 /* CRC error, buf ovflo or overrun */ +#define x_EN_OERROR 0x8000 /* collision or output underrun */ +#define x_EN_OPDONE 0x0080 /* previous operation completed */ +#define x_EN_IEN 0x0040 /* enable interrupt when DONE */ +#define x_EN_PROMISCUOUS 0x0002 /* promiscuous, input any packet */ +#define x_EN_GO 0x0001 /* start op bit */ + +#define x_EN_BITS "\10\20ERR\10OPDONE\7IEN\2PROM\1GO" + +#define x_spl_enet() x_spl5() + +#endif diff --git a/x_include/vaxif/x_if_exreg.h b/x_include/vaxif/x_if_exreg.h new file mode 100644 index 0000000..3efbebb --- /dev/null +++ b/x_include/vaxif/x_if_exreg.h @@ -0,0 +1,257 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_EXREG_H_ +#define x__VAXIF_IF_EXREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_exreg.h 7.1 (Berkeley) 6/5/86 + */ + +struct x_exdevice { + char x_xd_porta; /* write on porta resets EXOS */ + char x_xd_pad_a; + char x_xd_portb; /* write on portb interrupts EXOS */ + /* read on portb returns status bits */ + char x_xd_pad_b; +}; + +/* EXOS I/O PORT A write definitions */ +#define x_EX_RESET 0 /* value doesn't really matter... */ + +/* EXOS I/O PORT B write definitions */ +#define x_EX_NTRUPT 0 + +/* EXOS I/O PORT B read definitions */ +#define x_EX_TESTOK 1 /* set when self-diagnostics passed */ +#define x_EX_UNREADY (1<<3) /* set until EXOS ready to read from B */ + +/* message buffer status field definitions */ +#define x_MH_OWNER 1 /* mask for status bit for owner */ +#define x_MH_HOST 0 /* if 0, the host owns the buffer */ +#define x_MH_EXOS 1 /* if 1, the EXOS owns the buffer */ + +/* EXOS Link Level request codes */ +#define x_LLTRANSMIT 0xC /* send a packet */ +#define x_LLRTRANSMIT 0xE /* send a packet, and self-receive */ +#define x_LLRECEIVE 0xD /* receive a packet */ +#define x_LLNET_MODE 0x8 /* read/write mode control objects */ +#define x_LLNET_ADDRS 0x9 /* read/write receive address slots */ +#define x_LLNET_RECV 0xA /* read/alter receive slot enable bit */ +#define x_LLNET_STSTCS 0xB /* read/reset network statistics objects */ + +/* Link Level return codes common to all requests */ +#define x_LL_OK 0 /* successful completion */ +#define x_LLX_MODE 0xA1 /* EXOS not in link level mode (impossible) */ + +/* LLTRANSMIT unique return codes */ +#define x_LLXM_1RTRY 0x1 /* successful xmission, 1 retry */ +#define x_LLXM_RTRYS 0x2 /* successful xmission, more than 1 retry */ +#define x_LLXM_NSQE 0x8 /* successful xmission, no SQE TEST signal */ +#define x_LLXM_CLSN 0x10 /* xmission failed, excess retries */ +#define x_LLXM_NCS 0x20 /* xmission failed, no carrier sense */ +#define x_LLXM_LNGTH 0x40 /* xmission failed, bad packet length */ +#define x_XMIT_BITS "\7\7LENGTH\6CARRIER\5XCLSNS\4SQETST" +#define x_LLXM_ERROR (x_LLXM_NSQE|x_LLXM_CLSN|x_LLXM_NCS|x_LLXM_LNGTH) + +/* LLRECEIVE unique return codes */ +#define x_LLRC_TRUNC 0x4 /* pkt received, but truncated to fit buffer */ +#define x_LLRC_ALIGN 0x10 /* pkt received, but with alignment error */ +#define x_LLRC_CRC 0x20 /* pkt received, but with CRC error */ +#define x_LLRC_BUFLEN 0x40 /* no pkt received, buffer less than 64 bytes */ + /* this should never happen here */ +#define x_RECV_BITS "\7\7BUFLEN\6CRC\5ALIGN\3TRUNC" + +/* LLNET_ADDRS unique return codes */ +#define x_LLNA_BADSLOT 0xD1 /* slot doesn't exist or can't be accessed */ +#define x_LLNA_BADADDR 0xD3 /* invalid address for designated slot */ + +/* LLNET_RECV unique return codes */ +#define x_LLNR_BADSLOT 0xD1 /* slot doesn't exist or can't be accessed */ +#define x_LLNR_BADADDR 0xD2 /* designated slot was empty */ + +/* address slot object indices */ +#define x_NULLSLOT 0 /* the null slot */ +#define x_MINMCSLOT 1 /* minimum multicast slot index */ +#define x_MAXMCSLOT 8 /* default maximum multicast slot index */ +#define x_PHYSSLOT 253 /* physical slot index */ +#define x_UNVRSSLOT 254 /* universal slot index */ +#define x_BROADSLOT 255 /* broadcast slot index */ + +/* request mask bit definitions */ +#define x_WRITE_OBJ 1 /* write the object */ +#define x_READ_OBJ 2 /* read the object */ +#define x_ENABLE_RCV 4 /* enable reception on designated slot */ + +/* NET_MODE options mask bit definitions */ +#define x_OPT_ALIGN 0x10 /* receive packets with alignment errors */ +#define x_OPT_CRC 0x20 /* receive packets with CRC errors */ +#define x_OPT_DSABLE 0x80 /* disconnect controller hardware */ + +/* NET_MODE mode field value definitions */ +#define x_MODE_OFF 0 /* stop transmission and reception */ +#define x_MODE_PERF 1 /* perfect multicast address filtering */ +#define x_MODE_HW 2 /* hardware-only multicast address filtering */ +#define x_MODE_PROM 3 /* promiscuous reception */ + +#define x_NFRAGMENTS 1 /* number fragments that the EXOS will scatter/gather */ +#define x_EXMAXRBUF 1520 /* per EXOS 101 manual 5.3.7 (maybe 1518 would do) */ + +/* + * N.B. Structures below are carefully constructed so that + * they correspond to the message formats that NX firmware + * defines. None of them should contain any compiler-instigated + * padding. Be especially careful about VAX C longword alignment! + */ + +struct x_stat_array { + x_u_long x_sa_fsent; /* frames sent without errors */ + x_u_long x_sa_xsclsn; /* frames aborted excess collisions */ + x_u_long x_sa_nsqe; /* frames subject to heartbeat failure */ + x_u_long x_sa_undef; /* undefined (TDR on EXOS 101) */ + x_u_long x_sa_frcvd; /* frames received no errors */ + x_u_long x_sa_align; /* frames received alignment error */ + x_u_long x_sa_crc; /* frames received crc error */ + x_u_long x_sa_flost; /* frames lost */ +}; + +struct x_buf_blk { /* packet/buffer block descriptor */ + x_u_short x_bb_len; /* length of block, in bytes */ + x_u_short x_bb_addr[2]; /* address of block */ + /* + * Array above is really a single u_long field. + * We kludge its definition to defeat word-alignment. + * Access would look like: + * longaddr = *(u_long *)bp->.mb_er.er_blks[0].bb_addr; + */ +}; + +struct x_net_mode { /* read/write mode control objects */ +/*12*/ x_u_char x_nm_rqst; /* request code */ +/*13*/ x_u_char x_nm_rply; /* reply code */ +/*14*/ x_u_char x_nm_mask; /* bit-wise switches for read, write */ +/*15*/ x_u_char x_nm_optn; /* acceptable packet reception errors */ +/*16*/ x_u_char x_nm_mode; /* EXOS filtering mode */ +/*17*/ +}; + +struct x_net_addrs { /* read/write receive address slots */ +/*12*/ x_u_char x_na_rqst; /* request code */ +/*13*/ x_u_char x_na_rply; /* reply code */ +/*14*/ x_u_char x_na_mask; /* bit-wise switches for read, write */ +/*15*/ x_u_char x_na_slot; /* index of address slot */ +/*16*/ x_u_char x_na_addrs[6]; /* address read and/or written */ +/*22*/ +}; + +struct x_net_recv { /* read/alter receive slot enable bit */ +/*12*/ x_u_char x_nr_rqst; /* request code */ +/*13*/ x_u_char x_nr_rply; /* reply code */ +/*14*/ x_u_char x_nr_mask; /* bit-wise switches for read, write */ +/*15*/ x_u_char x_nr_slot; /* index of address slot */ +/*16*/ +}; + +struct x_net_ststcs { /* read/reset network statistics objects */ +/*12*/ x_u_char x_ns_rqst; /* request code */ +/*13*/ x_u_char x_ns_rply; /* reply code */ +/*14*/ x_u_char x_ns_mask; /* bit-wise switches for read, write */ +/*15*/ x_u_char x_ns_rsrv; /* reserved for EXOS */ +/*16*/ x_u_short x_ns_nobj; /* number of objects to work on */ +/*18*/ x_u_short x_ns_xobj; /* index of first object to work on */ +/*20*/ x_u_long x_ns_bufp; /* pointer to statistics buffer */ +/*24*/ +}; + +struct x_enet_xmit { /* send a packet on the Ethernet */ +/*12*/ x_u_char x_et_rqst; /* request code */ +/*13*/ x_u_char x_et_rply; /* reply code */ +/*14*/ x_u_char x_et_slot; /* address slot matching dest address */ +/*15*/ x_u_char x_et_nblock; /* number of blocks composing packet */ +/*16*/ struct x_buf_blk x_et_blks[x_NFRAGMENTS]; /* array of block descriptors */ +/*22-64*/ +}; + +struct x_enet_recv { /* receive a packet on the Ethernet */ +/*12*/ x_u_char x_er_rqst; /* request code */ +/*13*/ x_u_char x_er_rply; /* reply code */ +/*14*/ x_u_char x_er_slot; /* address slot matching dest address */ +/*15*/ x_u_char x_er_nblock; /* number of blocks composing buffer */ +/*16*/ struct x_buf_blk x_er_blks[x_NFRAGMENTS]; /* array of block descriptors */ +/*22-64*/ +}; + +/* we send requests and receive replys with the EXOS using this structure */ +struct x_ex_msg { +/*00*/ x_u_short x_mb_link; /* address of next message buffer */ +/*02*/ x_u_char x_mb_rsrv; /* reserved for use by EXOS */ +/*03*/ x_u_char x_mb_status; /* used bit-wise for message protocol */ +/*04*/ x_u_short x_mb_length; /* length, in bytes, of the rest */ +/*06*/ x_short x_mb_1rsrv; /* reserved for used by EXOS */ +/*08*/ x_long x_mb_mid; /* available to user */ +/*12*/ union x_mb_all { + struct x_net_mode x_mb_net_mode; + struct x_net_addrs x_mb_net_addrs; + struct x_net_recv x_mb_net_recv; + struct x_net_ststcs x_mb_net_ststcs; + struct x_enet_xmit x_mb_enet_xmit; + struct x_enet_recv x_mb_enet_recv; + } x_mb_all; +/* following field is used only by host, not read by board */ + struct x_ex_msg *x_mb_next; /* host's pointer to next message */ +}; +#define x_mb_nm x_mb_all.x_mb_net_mode +#define x_mb_na x_mb_all.x_mb_net_addrs +#define x_mb_nr x_mb_all.x_mb_net_recv +#define x_mb_ns x_mb_all.x_mb_net_ststcs +#define x_mb_et x_mb_all.x_mb_enet_xmit +#define x_mb_er x_mb_all.x_mb_enet_recv +#define x_mb_rqst x_mb_nm.x_nm_rqst +#define x_mb_rply x_mb_nm.x_nm_rply +#define x_MBDATALEN (sizeof(union x_mb_all)+6) + +struct x_confmsg { +/*00*/ x_u_short x_cm_1rsrv; /* reserved, must be 1 */ +/*02*/ char x_cm_vc[4]; /* returns ASCII version code */ +/*06*/ x_u_char x_cm_cc; /* returns config completion code */ +/*07*/ x_u_char x_cm_opmode; /* specifies operation mode */ +/*08*/ x_u_short x_cm_dfo; /* specifies host data format option */ +/*10*/ x_u_char x_cm_dcn1; /* reserved, must be 1 */ +/*11*/ x_u_char x_cm_2rsrv[2]; /* reserved, must be 0 */ +/*13*/ x_u_char x_cm_ham; /* specifies host address mode */ +/*14*/ x_u_char x_cm_3rsrv; /* reserved, must be 0 */ +/*15*/ x_u_char x_cm_mapsiz; /* reserved, must be 0 */ +/*16*/ x_u_char x_cm_byteptrn[4]; /* host data format option test pattern */ +/*20*/ x_u_short x_cm_wordptrn[2]; +/*24*/ x_u_long x_cm_lwordptrn; +/*28*/ x_u_char x_cm_rsrvd[20]; +/*48*/ x_u_long x_cm_mba; /* use 0xFFFFFFFF in link level mode */ +/*52*/ x_u_char x_cm_nproc; /* use 0xFF in link level mode */ +/*53*/ x_u_char x_cm_nmbox; /* use 0xFF in link level mode */ +/*54*/ x_u_char x_cm_nmcast; /* use 0xFF in link level mode */ +/*55*/ x_u_char x_cm_nhost; /* use 1 in link level mode */ + + /* the next five parameters define the request message queue */ +/*56*/ x_u_long x_cm_h2xba; /* base address of message queue */ +/*60*/ x_u_short x_cm_h2xhdr; /* address offset of msg Q header */ +/*62*/ x_u_char x_cm_h2xtyp; /* interrupt type */ +/*63*/ x_u_char x_cm_h2xval; /* interrupt value (not used) */ +/*64*/ x_u_short x_cm_h2xaddr; /* interrupt vector */ +/*66*/ x_u_short x_cm_h2xpad; /* pad out unused portion of vector */ + + /* the next five parameters define the reply message queue */ +/*68*/ x_u_long x_cm_x2hba; /* base address of message queue */ +/*72*/ x_u_short x_cm_x2hhdr; /* address offset of msg Q header */ +/*74*/ x_u_char x_cm_x2htyp; /* interrupt type */ +/*75*/ x_u_char x_cm_x2hval; /* interrupt value (not used) */ +/*76*/ x_u_short x_cm_x2haddr; /* interrupt vector */ +/*78*/ x_u_short x_cm_x2hpad; /* pad out unused portion of vector */ +/*80*/ +}; + +#endif diff --git a/x_include/vaxif/x_if_hdhreg.h b/x_include/vaxif/x_if_hdhreg.h new file mode 100644 index 0000000..3677471 --- /dev/null +++ b/x_include/vaxif/x_if_hdhreg.h @@ -0,0 +1,109 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_HDHREG_H_ +#define x__VAXIF_IF_HDHREG_H_ + +#include + +/* @(#)if_hdhreg.h 7.1 (Berkeley) 6/5/86 */ + +/* $Header$ */ + +/* + * ACC IF-11/HDH interface + */ + +struct x_hdhregs { /* device registers */ + x_u_short x_csr; /* control and status register */ + x_u_char x_iochn; /* logical channel */ + x_u_char x_ioadx; /* address extension (A16,A17) */ + x_u_short x_ioadl; /* buffer address (A0-A15) */ + x_u_short x_iocnt; /* byte count */ + x_u_char x_iofcn; /* UMC funciton code */ + x_u_char x_iosbf; /* UMC subfunction code */ + x_u_char x_ioini; /* comm regs valid flag */ + x_u_char x_staack; /* interrupt acknowledge flag */ + x_u_char x_ionmi; /* NMI routine active flag */ + x_u_char x_ioxfrg; /* UMR transfer grant flag */ + x_u_char x_stachn; /* interrupt channel number */ + x_u_char x_statyp; /* interrupt type code */ + x_u_char x_stacc; /* completion function code */ + x_u_char x_stacs; /* completion subfunction code */ + x_u_short x_stacnt; /* completion byte count */ +}; + +/* defines for CSR */ + +#define x_HDH_UER 0100000 /* UMC error condition */ +#define x_HDH_NXM 0040000 /* non-existent memory error */ +#define x_HDH_PER 0020000 /* UNIBUS parity error */ +#define x_HDH_ZRUN 0010000 /* Z80 running */ +#define x_HDH_ZGO 0004000 /* Z80 not in wait state */ +#define x_HDH_MBLK 0000200 /* memory swap state (0=main, 1=srv) */ +#define x_HDH_SRV 0000100 /* select UMC service memory */ +#define x_HDH_MAIN 0000040 /* select UMC main memory */ +#define x_HDH_DMA 0000020 /* DMA enable */ +#define x_HDH_WRT 0000010 /* DMA write enable */ +#define x_HDH_IEN 0000004 /* interrupt enable */ +#define x_HDH_RST 0000002 /* reset */ +#define x_HDH_NMI 0000001 /* cause NMI */ + +#define x_HDH_BITS \ +"\10\20UER\17NXM\16PER\15ZRUN\14ZGO\10MBLK\7SRV\6MAIN\5DMA\4WRT\3IEN\2RST\1NMI" + +/* start i/o function code definitions */ + +#define x_HDHWRT 0 /* write to if-11 */ +#define x_HDHRDB 1 /* read from if-11 */ +#define x_HDHSTR 2 /* stream flag */ +#define x_HDHEOS 6 /* end of stream flag */ +#define x_HDHABT 8 /* abort flag */ +#define x_HDHUMR 16 /* UMR protocol flag */ + +/* interrupt type definitions */ + +#define x_HDHSACK 0 /* start i/o ack */ +#define x_HDHDONE 1 /* i/o completion */ +#define x_HDHXREQ 2 /* UMR protocol transfer request */ + +/* i/o completion codes */ + +#define x_HDHIOCOK 0001 /* successful completion */ +#define x_HDHIOCOKP 0002 /* successful completion, more data pending */ +#define x_HDHIOCABT 0361 /* i/o aborted */ +#define x_HDHIOCERR 0321 /* program error */ +#define x_HDHIOCOVR 0363 /* overrun error */ +#define x_HDHIOCUBE 0374 /* non-existant memory or unibus error */ + +/* UMR protocol transfer grant code definitions */ + +#define x_HDHXEVN 1 /* start with even address */ +#define x_HDHXODD 2 /* start with odd address */ +#define x_HDHNUMR 4 /* non-UMR transfer */ +#define x_HDHXABT 8 /* abort transfer */ + +/* HDH supervisor request code definitions */ +#define x_HDHINIT 0x42 /* SYSINIT opcode */ + +#define x_HDHSUP 0xf0 /* supervisor HDH status/line control prefix */ +#define x_HDHIMP 0x400 /* IMP line up modifier */ +#define x_HDHREFL 0x800 /* reflect mode modifier */ +#define x_HDHINLB 0x1000 /* internal loopback modifier */ +#define x_HDHEXLP 0x2000 /* external loopback modifier */ +#define x_HDHRQST (x_HDHSUP+0x0000) /* line status request */ +#define x_HDHRQUP (x_HDHSUP+0x0100) /* line up request */ +#define x_HDHRQDN (x_HDHSUP+0x0200) /* line down request */ + +/* HDH supervisor reply code definitions */ + +#define x_HDHIACK (x_HDHSUP+0x4200) /* line init ack */ +#define x_HDHLNUP (x_HDHSUP+0x0100) /* line up reply */ +#define x_HDHLNDN (x_HDHSUP+0x0200) /* line down reply */ +#define x_HDHLNACK (x_HDHSUP+0x0300) /* ack line up request (but line is down now) */ +#define x_HDHTIMO (x_HDHSUP+0x0400) /* line timeout */ +#define x_HDHLOOP (x_HDHSUP+0x0500) /* loopback message */ +#define x_HDHDTERR (x_HDHSUP+0x0600) /* host data error detected */ +#define x_HDHSQRCV (x_HDHSUP+0x0700) /* HDLC sequence error detected by IMP */ +#define x_HDHSQERR (x_HDHSUP+0x0800) /* HDLC sequence error detected by if-11 */ + +#endif diff --git a/x_include/vaxif/x_if_hy.h b/x_include/vaxif/x_if_hy.h new file mode 100644 index 0000000..f8ffc76 --- /dev/null +++ b/x_include/vaxif/x_if_hy.h @@ -0,0 +1,314 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_HY_H_ +#define x__VAXIF_IF_HY_H_ + +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_hy.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * 4.2 BSD Unix Kernel - Vax Network Interface Support + * + * $Header: if_hy.h,v 10.0 84/06/30 19:51:21 steveg Stable $ + * $Locker: $ + * + * Modifications from Berkeley 4.2 BSD + * Copyright (c) 1983, Tektronix Inc. + * All Rights Reserved + * + * + * $Log: if_hy.h,v $ + * Revision 10.0 84/06/30 19:51:21 steveg + * Big Build + * + * Revision 3.13 84/05/30 19:40:58 steveg + * update hy_stat to reflect new microcode + * + * Revision 3.12 84/05/30 19:06:57 steveg + * move driver state number definition here from if_hy.c + * + * Revision 3.11 84/05/30 18:56:15 steveg + * add definition of HYE_MAX and HYE_SIZE + * + * Revision 3.10 84/05/30 17:14:04 steveg + * add hyl_filter + * + * Revision 3.9 84/05/30 13:45:24 steveg + * rework logging + * + * Revision 3.8 84/05/04 05:18:59 steveg + * hyr_key now a u_long + * + * Revision 3.7 84/05/01 22:45:20 steveg + * add H_RLOOPBK for A710 remote end loopback command + * + * + */ + +/* + * Structure of a HYPERchannel adapter header + */ +struct x_hy_hdr { + x_short x_hyh_ctl; /* control */ + x_short x_hyh_access; /* access code */ + union { + x_short x_hyh_addr; + char x_hyh_baddr[2]; + } x_hyh_uto, x_hyh_ufrom; /* to/from address */ + x_short x_hyh_param; /* parameter word */ + x_short x_hyh_type; /* record type */ +}; + +#define x_hyh_to x_hyh_uto.x_hyh_addr +#define x_hyh_to_port x_hyh_uto.x_hyh_baddr[1] +#define x_hyh_to_adapter x_hyh_uto.x_hyh_baddr[0] + +#define x_hyh_from x_hyh_ufrom.x_hyh_addr +#define x_hyh_from_port x_hyh_ufrom.x_hyh_baddr[1] +#define x_hyh_from_adapter x_hyh_ufrom.x_hyh_baddr[0] + +/* + * Structure of a HYPERchannel message header (from software) + */ +struct x_hym_hdr { + struct { + x_short x_hymd_mplen; /* message proper len, if associated data */ + } x_hym_d; + struct x_hy_hdr x_hym_h; /* hardware header, MUST BE LAST */ +}; + +#define x_hym_mplen x_hym_d.x_hymd_mplen + +#define x_hym_ctl x_hym_h.x_hyh_ctl +#define x_hym_access x_hym_h.x_hyh_access +#define x_hym_param x_hym_h.x_hyh_param +#define x_hym_type x_hym_h.x_hyh_type + +#define x_hym_to x_hym_h.x_hyh_to +#define x_hym_to_port x_hym_h.x_hyh_to_port +#define x_hym_to_adapter x_hym_h.x_hyh_to_adapter + +#define x_hym_from x_hym_h.x_hyh_from +#define x_hym_from_port x_hym_h.x_hyh_from_port +#define x_hym_from_adapter x_hym_h.x_hyh_from_adapter + +#define x_HYM_SWLEN (sizeof(struct x_hym_hdr) - sizeof(struct x_hy_hdr)) + +/* + * HYPERchannel header word control bits + */ +#define x_H_XTRUNKS 0x00F0 /* transmit trunks */ +#define x_H_RTRUNKS 0x000F /* remote trunks to transmit on for loopback */ +#define x_H_ASSOC 0x0100 /* has associated data */ +#define x_H_LOOPBK 0x00FF /* loopback command */ +#define x_H_RLOOPBK 0x008F /* A710 remote loopback command */ + +/* + * Hyperchannel record types + */ +#define x_HYLINK_IP 0 /* Internet Protocol Packet */ + +/* + * Routing database + */ +#define x_HYRSIZE 37 /* max number of adapters in routing tables */ + +struct x_hy_route { + x_time_t x_hyr_lasttime; /* last update time */ + x_u_char x_hyr_gateway[256]; + struct x_hyr_hash { + x_u_long x_hyr_key; /* desired address */ + x_u_short x_hyr_flags; /* status flags - see below */ + x_u_short x_hyr_size; /* number of entries */ + union { + /* + * direct entry (can get there directly) + */ + struct { + x_u_short x_hyru_dst; /* adapter number & port */ + x_u_short x_hyru_ctl; /* trunks to try */ + x_u_short x_hyru_access; /* access code (mostly unused) */ + } x_hyr_d; +#define x_hyr_dst x_hyr_u.x_hyr_d.x_hyru_dst +#define x_hyr_ctl x_hyr_u.x_hyr_d.x_hyru_ctl +#define x_hyr_access x_hyr_u.x_hyr_d.x_hyru_access + /* + * indirect entry (one or more hops required) + */ + struct { + x_u_char x_hyru_pgate; /* 1st gateway slot */ + x_u_char x_hyru_egate; /* # gateways */ + x_u_char x_hyru_nextgate; /* gateway to use next */ + } x_hyr_i; +#define x_hyr_pgate x_hyr_u.x_hyr_i.x_hyru_pgate +#define x_hyr_egate x_hyr_u.x_hyr_i.x_hyru_egate +#define x_hyr_nextgate x_hyr_u.x_hyr_i.x_hyru_nextgate + } x_hyr_u; + } x_hyr_hash[x_HYRSIZE]; +}; + +/* + * routing table set/get structure + * + * used to just pass the entire routing table through, but 4.2 ioctls + * limit the data part of an ioctl to 128 bytes or so and use the + * interface name to get things sent the right place. + * see ../net/if.h for additional details. + */ +struct x_hyrsetget { + char x_hyrsg_name[x_IFNAMSIZ]; /* if name, e.g. "hy0" */ + struct x_hy_route *x_hyrsg_ptr; /* pointer to routing table */ + x_unsigned_int x_hyrsg_len; /* size of routing table provided */ +}; + +#define x_HYR_INUSE 0x01 /* entry in use */ +#define x_HYR_DIR 0x02 /* direct entry */ +#define x_HYR_GATE 0x04 /* gateway entry */ +#define x_HYR_LOOP 0x08 /* hardware loopback entry */ +#define x_HYR_RLOOP 0x10 /* remote adapter hardware loopback entry */ + +#define x_HYRHASH(x_x) (((x_x) ^ ((x_x) >> 16)) % x_HYRSIZE) + +#define x_HYSETROUTE x__IOW(x_i, 0x80, struct x_hyrsetget) +#define x_HYGETROUTE x__IOW(x_i, 0x81, struct x_hyrsetget) + +struct x_hylsetget { + char x_hylsg_name[x_IFNAMSIZ]; /* if name, e.g. "hy0" */ + x_int x_hylsg_cmd; /* logging command */ + x_caddr_t x_hylsg_ptr; /* pointer to table */ + x_u_long x_hylsg_len; /* size of table provided */ +}; + +#define x_HYSETLOG x__IOW(x_i, 0x82, struct x_hylsetget) +#define x_HYGETLOG x__IOW(x_i, 0x83, struct x_hylsetget) +#define x_HYGETELOG x__IOW(x_i, 0x84, struct x_hylsetget) + +/* + * Structure of Statistics Record (counters) + */ +struct x_hy_stat { + x_u_char x_hyc_df0[3]; /* # data frames trunk 0 */ + x_u_char x_hyc_df1[3]; /* # data frames trunk 1 */ + x_u_char x_hyc_df2[3]; /* # data frames trunk 2 */ + x_u_char x_hyc_df3[3]; /* # data frames trunk 3 */ + x_u_char x_hyc_cancel[2]; /* # cancel operations */ + x_u_char x_hyc_abort[2]; /* # aborts */ + x_u_char x_hyc_ret0[3]; /* # retransmissions trunk 0 */ + x_u_char x_hyc_ret1[3]; /* # retransmissions trunk 1 */ + x_u_char x_hyc_ret2[3]; /* # retransmissions trunk 2 */ + x_u_char x_hyc_ret3[3]; /* # retransmissions trunk 3 */ + x_u_char x_hyc_atype[3]; /* adapter type and revision level */ + x_u_char x_hyc_uaddr; /* adapter unit number */ +}; + +/* + * Structure of the Status Record + */ +struct x_hy_status { + x_u_char x_hys_gen_status; /* general status byte */ + x_u_char x_hys_last_fcn; /* last function code issued */ + x_u_char x_hys_resp_trunk; /* trunk response byte */ + x_u_char x_hys_status_trunk; /* trunk status byte */ + x_u_char x_hys_recd_resp; /* recieved response byte */ + x_u_char x_hys_error; /* error code */ + x_u_char x_hys_caddr; /* compressed addr of 1st msg on chain */ + x_u_char x_hys_pad; /* not used */ +}; + +/* + * Get port number from status record + */ +#define x_PORTNUM(x_p) (((x_p)->x_hys_gen_status >> 6) & 0x03) + +#define x_HYL_SIZE 16*1024 +struct x_hy_log { + struct x_hy_log *x_hyl_self; + x_u_char x_hyl_enable; /* logging enabled? */ + x_u_char x_hyl_onerr; /* state to enter on error */ + x_u_short x_hyl_wait; /* number of bytes till next wakeup */ + x_u_short x_hyl_count; /* number of samples till stop */ + x_u_short x_hyl_icount; /* initial value of hyl_count */ + x_u_long x_hyl_filter; /* log items with specific bits set */ + x_u_char *x_hyl_eptr; /* &hy_log.hyl_buf[HYL_SIZE] */ + x_u_char *x_hyl_ptr; /* pointer into hyl_buf */ + x_u_char x_hyl_buf[x_HYL_SIZE]; /* log buffer space */ +}; + +#define x_HYL_NOP 0 +#define x_HYL_UP 1 /* markup */ +#define x_HYL_STATUS 2 /* status results (struct hy_status) */ +#define x_HYL_STATISTICS 3 /* statistics (struct hy_stat) */ +#define x_HYL_XMIT 4 /* packed being send (struct hym_hdr) */ +#define x_HYL_RECV 5 /* recieved pkt (short len; struct hym_hdr) */ +#define x_HYL_CMD 6 /* cmd issued (uchar cmd, state; short count) */ +#define x_HYL_INT 7 /* interrupt (short csr, wcr) */ +#define x_HYL_CANCEL 8 /* cancel transmit attempt */ +#define x_HYL_RESET 9 /* hyinit or unibus reset */ +#define x_HYL_IOCTL 10 /* hyioctl */ + +#define x_HYL_DISABLED 0 /* logging disabled */ +#define x_HYL_CONTINUOUS 1 /* continuous logging */ +#define x_HYL_CATCHN 2 /* hyl_count transactions being captured */ + +/* + * error code histograms + */ +#define x_HYE_MAX 0x18 /* maximum adapter error code */ +#define x_HYE_BINS 4 /* number of command bins */ +#define x_HYE_SIZE (x_HYE_MAX+1)*x_HYE_BINS /* size of histogram buffer */ + +/* + * Requests for service (in order by descending priority). + */ +#define x_RQ_ENDOP 001 /* end the last adapter function */ +#define x_RQ_REISSUE 002 /* reissue previous cmd after status */ +#define x_RQ_STATUS 004 /* get the status of the adapter */ +#define x_RQ_STATISTICS 010 /* get the statistics of the adapter */ +#define x_RQ_MARKDOWN 020 /* mark this adapter port down */ +#define x_RQ_MARKUP 040 /* mark this interface up */ + +#define x_RQ_XASSOC 0100 /* associated data to transmit */ + +/* + * Driver states. + */ +#define x_STARTUP 0 /* initial state (before fully there) */ +#define x_IDLE 1 /* idle state */ +#define x_STATSENT 2 /* status cmd sent to adapter */ +#define x_ENDOPSENT 3 /* end operation cmd sent */ +#define x_RECVSENT 4 /* input message cmd sent */ +#define x_RECVDATASENT 5 /* input data cmd sent */ +#define x_XMITSENT 6 /* transmit message cmd sent */ +#define x_XMITDATASENT 7 /* transmit data cmd sent */ +#define x_WAITING 8 /* waiting for messages */ +#define x_CLEARSENT 9 /* clear wait for message cmd sent */ +#define x_MARKPORT 10 /* mark this host's adapter port down issued */ +#define x_RSTATSENT 11 /* read statistics cmd sent to adapter */ + +#ifdef x_HYLOG +char *x_hy_state_names[] = { + "Startup", + "Idle", + "Status Sent", + "End op Sent", + "Recieve Message Proper Sent", + "Recieve Data Sent", + "Transmit Message Proper Sent", + "Transmit Data Sent", + "Wait for Message Sent", + "Clear Wait for Message Sent", + "Mark Port Down Sent", + "Read Statistics Sent" +}; +#endif + +#endif diff --git a/x_include/vaxif/x_if_hyreg.h b/x_include/vaxif/x_if_hyreg.h new file mode 100644 index 0000000..eeaf5e0 --- /dev/null +++ b/x_include/vaxif/x_if_hyreg.h @@ -0,0 +1,193 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_HYREG_H_ +#define x__VAXIF_IF_HYREG_H_ + +#include + +/* + * @(#)if_hyreg.h 7.1 (Berkeley) 6/5/86 + * + * $Header: if_hyreg.h,v 10.0 84/06/30 19:51:34 steveg Stable $ + * $Locker: $ + * + * Modifications from Berkeley 4.2 BSD + * Copyright (c) 1983, Tektronix Inc. + * All Rights Reserved + * + */ + +/* + * Network Systems Corporation Hyperchannel interface + * + * supports A410 adapter interfaced via a DEC DR-11B, NSC PI-13 or PI-14 + * (PI-14 is a PI-13 with different line drivers, software is + * identical to a PI-13) + * + * Written by Steve Glaser, Tektronix Inc., July 1982 + * + * NOTE: + * + * DR11B code has not been fully checked out with 4.1a. + * The first adapters at Tek came with DR11Bs, and the code once worked, + * but those have been upgraded to PI-13s. + */ + +/* + * The HYPERchannel driver sends and receives messages formatted: + * + * +---------------------------------------+ --- + * | | /|\ + * | HYPERchannel adapter header (hy_hdr) | | + * | | | + * +---------------------------------------+ | + * | | | + * | Internet Protocol header (ip) | message proper + * | | (64 bytes max) + * +---------------------------------------+ | + * | | | + * | TCP header + user data | | + * | (if it all fits here) | | + * | | \|/ + * +---------------------------------------+ --- + * + * +---------------------------------------+ --- + * | | /|\ + * | | | + * | TCP header + user data | associated data + * | | | + * | | \|/ + * +---------------------------------------+ --- + * + * If all of the datagram will fit in the message proper (including + * the TCP header and user data) the entire datagram is passed in + * the message proper and the associated data feature of the HYPERchannel + * is not used. + * + * The mapping from internet addresses to HYPERchannel addresses is: + * + * 0 7 8 15 16 31 + * +---------+---------+-----------------------+ + * | network | special | HYPERchannel address | + * +---------+---------+-----------------------+ + * + * |<------------ internet address ----------->| + * + * The hyperchannel address is decoded as follows: + * + * 0 7 8 13 14 15 + * +-------------------+----------------+------+ + * | adapter number | zero | port | + * +-------------------+----------------+------+ + * + * The low 2 bits are port number (interpreted by hyperchannel hardware). + * + * The encoding of special bits is: + * + * 00 normal packet + * + * 01 loop this packet back to the sender at the + * specified adapter (ip header source/destination addresses + * swapped before sending, command bits added to tell the + * remote HYPERchannel adapter debug & performance studies] + * this code acts like 02 (below) if the ip destination (before + * any swapping) and the destination address don't match (e.g. + * this packet is being routed through a gateway) + * + * 02 loop this packet back to the sender at the + * specified adapter, but go through the specified adapter's + * IP. This is for testing IP's store and forward mechanism. + * + * other undefined, currently treated as normal packet + * + */ +#define x_MPSIZE 64 /* "Message Proper" size */ +#define x_MAXRETRY 4 + +/* + * Device registers + */ +struct x_hydevice { + x_short x_hyd_wcr; /* word count (negated) */ + x_u_short x_hyd_bar; /* bus address bits 15-0 */ + x_u_short x_hyd_csr; /* control and status */ + x_u_short x_hyd_dbuf; /* data buffer */ +}; + +/* + * CSR bit layout + */ +#define x_S_ERROR 0100000 /* error */ +#define x_S_NEX 0040000 /* non-existent memory error */ +#define x_S_ATTN 0020000 /* attn (always zero) */ +#ifdef x_PI13 +#define x_S_STKINTR 0010000 /* stacked interrupt */ +#else +#define x_S_MAINT 0010000 /* maintenance (not used) */ +#endif +#define x_S_A 0004000 /* device status A (recieve data available) */ +#define x_S_B 0002000 /* device status B (normal termination) */ +#define x_S_C 0001000 /* device status C (abnormal termination) */ +#ifdef x_PI13 +#define x_S_POWEROFF 0000400 /* power off indicator */ +#else +#define x_S_CYCLE 0000400 /* cycle (not used) */ +#endif +#define x_S_READY 0000200 /* ready */ +#define x_S_IE 0000100 /* interrupt enable */ +#define x_S_XBA 0000060 /* bus address bit bits 17 and 16 */ +#define x_S_CLRINT 0000014 /* clear stacked interrupt */ +#define x_S_IATTN 0000010 /* interrupt on attention only */ +#define x_S_WC 0000004 /* interrupt on word count == 0 only */ +#define x_S_IATTNWC 0000000 /* interrupt on word count == 0 and attention */ +#define x_S_BURST 0000002 /* burst mode DMA (not used) */ +#define x_S_GO 0000001 /* go */ + +#define x_XBASHIFT 12 + +#define x_HY_CSR_BITS "\20\ +\20Ex_RROR\17x_NEX\16x_ATTN\15x_STKINTR\14x_RECV_DATA\13x_NORMAL\12x_ABNORMAL\11x_POWER\ +\10x_READY\07x_IENABLE\06x_XBA17\05x_XBA16\04x_IATTN\03x_IWC\02x_BURST\01x_GO" + +/* + * PI13 status conditions + */ +#define x_HYS_RECVDATA(x_x) (((x_x)->x_hyd_csr & x_S_A) != 0) /* get adapter data */ +#define x_HYS_NORMAL(x_x) (((x_x)->x_hyd_csr & x_S_B) != 0) /* done normally */ +#define x_HYS_ABNORMAL(x_x) (((x_x)->x_hyd_csr & x_S_C) != 0) /* done abnormally */ +#define x_HYS_ERROR(x_x) (((x_x)->x_hyd_csr & x_S_ERROR) != 0) /* error condition */ +#define x_HYS_DONE(x_x) (((x_x)->x_hyd_csr & (x_S_ERROR|x_S_B|x_S_C)) != 0) + +/* + * Function Codes for the Hyperchannel Adapter + * The codes are offset so they can be "or"ed into + * the reg data buffer + */ +#define x_HYF_XMITMSG 0x04 /* transmit message */ +#define x_HYF_XMITDATA 0x08 /* transmit associated data */ +#define x_HYF_XMITLSTDATA 0x0C /* transmit last associated data */ +#define x_HYF_XMITLOCMSG 0x10 /* transmit local message */ +#define x_HYF_INPUTMSG 0x24 /* input message proper */ +#define x_HYF_INPUTDATA 0x28 /* input assiciated data */ +#define x_HYF_STATUS 0x40 /* request status */ +#define x_HYF_DUMPREGS 0x50 /* dump extention registers */ +#define x_HYF_MARKP0 0x60 /* mark down port 0 */ +#define x_HYF_MARKP1 0x64 /* mark down port 1 */ +#define x_HYF_MARKP2 0x68 /* mark down port 2 */ +#define x_HYF_MARKP3 0x6C /* mark down port 3 */ +#define x_HYF_MP0RR 0x70 /* mark down port 0 and reroute messages */ +#define x_HYF_MP1RR 0x74 /* mark down port 1 and reroute messages */ +#define x_HYF_MP2RR 0x78 /* mark down port 2 and reroute messages */ +#define x_HYF_MP3RR 0x7C /* mark down port 3 and reroute messages */ +#define x_HYF_RSTATS 0xA0 /* read statistics */ +#define x_HYF_RCSTATS 0xA4 /* read and clear statistics */ +#define x_HYF_SETTEST 0xC0 /* enable test operations *set test mode) */ +#define x_HYF_SADDR_LEN 0xC4 /* test mode: set address and length */ +#define x_HYF_WBUFF 0xC8 /* test mode: write buffer */ +#define x_HYF_RBUFF 0xCC /* test mode: read buffer */ +#define x_HYF_CLRADAPTER 0xE0 /* clear adapter */ +#define x_HYF_END_OP 0xE4 /* end operation */ +#define x_HYF_CLRWFMSG 0xE6 /* clear wait for mwssage */ +#define x_HYF_WAITFORMSG 0xE8 /* wait for message */ + +#endif diff --git a/x_include/vaxif/x_if_il.h b/x_include/vaxif/x_if_il.h new file mode 100644 index 0000000..6267548 --- /dev/null +++ b/x_include/vaxif/x_if_il.h @@ -0,0 +1,61 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_IL_H_ +#define x__VAXIF_IF_IL_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_il.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Structure of an Ethernet header -- receive format + */ +struct x_il_rheader { + x_u_char x_ilr_status; /* Frame Status */ + x_u_char x_ilr_fill1; + x_u_short x_ilr_length; /* Frame Length */ + x_u_char x_ilr_dhost[6]; /* Destination Host */ + x_u_char x_ilr_shost[6]; /* Source Host */ + x_u_short x_ilr_type; /* Type of packet */ +}; + +/* + * Structure of statistics record + */ +struct x_il_stats { + x_u_short x_ils_fill1; + x_u_short x_ils_length; /* Length (should be 62) */ + x_u_char x_ils_addr[6]; /* Ethernet Address */ + x_u_short x_ils_frames; /* Number of Frames Received */ + x_u_short x_ils_rfifo; /* Number of Frames in Receive FIFO */ + x_u_short x_ils_xmit; /* Number of Frames Transmitted */ + x_u_short x_ils_xcollis; /* Number of Excess Collisions */ + x_u_short x_ils_frag; /* Number of Fragments Received */ + x_u_short x_ils_lost; /* Number of Times Frames Lost */ + x_u_short x_ils_multi; /* Number of Multicasts Accepted */ + x_u_short x_ils_rmulti; /* Number of Multicasts Rejected */ + x_u_short x_ils_crc; /* Number of CRC Errors */ + x_u_short x_ils_align; /* Number of Alignment Errors */ + x_u_short x_ils_collis; /* Number of Collisions */ + x_u_short x_ils_owcollis; /* Number of Out-of-window Collisions */ + x_u_short x_ils_fill2[8]; + char x_ils_module[8]; /* Module ID */ + char x_ils_firmware[8]; /* Firmware ID */ +}; + +/* + * Structure of Collision Delay Time Record + */ +struct x_il_collis { + x_u_short x_ilc_fill1; + x_u_short x_ilc_length; /* Length (should be 0-32) */ + x_u_short x_ilc_delay[16]; /* Delay Times */ +}; + +#endif diff --git a/x_include/vaxif/x_if_ilreg.h b/x_include/vaxif/x_if_ilreg.h new file mode 100644 index 0000000..6efac2f --- /dev/null +++ b/x_include/vaxif/x_if_ilreg.h @@ -0,0 +1,129 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_ILREG_H_ +#define x__VAXIF_IF_ILREG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_ilreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Interlan Ethernet Communications Controller interface + */ +struct x_ildevice { + x_short x_il_csr; /* Command and Status Register */ + x_short x_il_bar; /* Buffer Address Register */ + x_short x_il_bcr; /* Byte Count Register */ +}; + +/* + * Command and status bits + */ +#define x_IL_EUA 0xc000 /* Extended Unibus Address */ +#define x_IL_CMD 0x3f00 /* Command Function Code */ +#define x_IL_CDONE 0x0080 /* Command Done */ +#define x_IL_CIE 0x0040 /* Command Interrupt Enable */ +#define x_IL_RDONE 0x0020 /* Receive DMA Done */ +#define x_IL_RIE 0x0010 /* Receive Interrupt Enable */ +#define x_IL_STATUS 0x000f /* Command Status Code */ + +#define x_IL_BITS "\20\10CDONE\7CIE\6RDONE\5RIE" + +/* command definitions */ +#define x_ILC_MLPBAK 0x0100 /* Set Module Interface Loopback Mode */ +#define x_ILC_ILPBAK 0x0200 /* Set Internal Loopback Mode */ +#define x_ILC_CLPBAK 0x0300 /* Clear Loopback Mode */ +#define x_ILC_PRMSC 0x0400 /* Set Promiscuous Receive Mode */ +#define x_ILC_CLPRMSC 0x0500 /* Clear Promiscuous Receive Mode */ +#define x_ILC_RCVERR 0x0600 /* Set Receive-On-Error Bit */ +#define x_ILC_CRCVERR 0x0700 /* Clear Receive-On-Error Bit */ +#define x_ILC_OFFLINE 0x0800 /* Go Offline */ +#define x_ILC_ONLINE 0x0900 /* Go Online */ +#define x_ILC_DIAG 0x0a00 /* Run On-board Diagnostics */ +#define x_ILC_ISA 0x0d00 /* Set Insert Source Address Mode */ +#define x_ILC_CISA 0x0e00 /* Clear Insert Source Address Mode */ +#define x_ILC_DEFPA 0x0f00 /* Set Physical Address to Default */ +#define x_ILC_ALLMC 0x1000 /* Set Receive All Multicast Packets */ +#define x_ILC_CALLMC 0x1100 /* Clear Receive All Multicast */ +#define x_ILC_STAT 0x1800 /* Report and Reset Statistics */ +#define x_ILC_DELAYS 0x1900 /* Report Collision Delay Times */ +#define x_ILC_RCV 0x2000 /* Supply Receive Buffer */ +#define x_ILC_LDXMIT 0x2800 /* Load Transmit Data */ +#define x_ILC_XMIT 0x2900 /* Load Transmit Data and Send */ +#define x_ILC_LDGRPS 0x2a00 /* Load Group Addresses */ +#define x_ILC_RMGRPS 0x2b00 /* Delete Group Addresses */ +#define x_ILC_LDPA 0x2c00 /* Load Physical Address */ +#define x_ILC_FLUSH 0x3000 /* Flush Receive BAR/BCR Queue */ +#define x_ILC_RESET 0x3f00 /* Reset */ + +/* + * Error codes found in the status bits of the csr. + */ +#define x_ILERR_SUCCESS 0 /* command successful */ +#define x_ILERR_RETRIES 1 /* " " with retries */ +#define x_ILERR_BADCMD 2 /* illegal command */ +#define x_ILERR_INVCMD 3 /* invalid command */ +#define x_ILERR_RECVERR 4 /* receiver error */ +#define x_ILERR_BUFSIZ 5 /* buffer size too big */ +#define x_ILERR_FRAMESIZ 6 /* frame size too small */ +#define x_ILERR_COLLISIONS 8 /* excessive collisions */ +#define x_ILERR_BUFALIGNMENT 10 /* buffer not word aligned */ +#define x_ILERR_NXM 15 /* non-existent memory */ + +#define x_NILERRS 16 +#ifdef x_ILERRS +char *x_ilerrs[x_NILERRS] = { + "success", /* 0 */ + "success with retries", /* 1 */ + "illegal command", /* 2 */ + "inappropriate command", /* 3 */ + "failure", /* 4 */ + "buffer size exceeded", /* 5 */ + "frame too small", /* 6 */ + 0, /* 7 */ + "excessive collisions", /* 8 */ + 0, /* 9 */ + "buffer alignment error", /* 10 */ + 0, /* 11 */ + 0, /* 12 */ + 0, /* 13 */ + 0, /* 14 */ + "non-existent memory" /* 15 */ +}; +#endif + +/* + * Diagnostics codes. + */ +#define x_ILDIAG_SUCCESS 0 /* no problems */ +#define x_ILDIAG_CHKSUMERR 1 /* ROM/RAM checksum error */ +#define x_ILDIAG_DMAERR 2 /* DMA not working */ +#define x_ILDIAG_XMITERR 3 /* xmit circuitry failure */ +#define x_ILDIAG_RECVERR 4 /* rcvr circuitry failure */ +#define x_ILDIAG_LOOPBACK 5 /* loopback test failed */ + +#define x_NILDIAGS 6 +#ifdef x_ILDIAGS +char *x_ildiag[x_NILDIAGS] = { + "success", /* 0 */ + "checksum error", /* 1 */ + "NM10 dma error", /* 2 */ + "transmitter error", /* 3 */ + "receiver error", /* 4 */ + "loopback failure", /* 5 */ +}; +#endif + +/* + * Frame status bits, returned in frame status byte + * at the top of each received packet. + */ +#define x_ILFSTAT_C 0x1 /* CRC error */ +#define x_ILFSTAT_A 0x2 /* alignment error */ +#define x_ILFSTAT_L 0x4 /* 1+ frames lost just before */ + +#endif diff --git a/x_include/vaxif/x_if_ix.h b/x_include/vaxif/x_if_ix.h new file mode 100644 index 0000000..29320a8 --- /dev/null +++ b/x_include/vaxif/x_if_ix.h @@ -0,0 +1,65 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_IX_H_ +#define x__VAXIF_IF_IX_H_ + +#include + +/* + * Copyright (c) 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_ix.h 7.1 (Berkeley) 6/5/86 + */ + +union x_ix_stats { + struct { /* General statistics below */ + x_u_char x_macg_physaddr[6]; + x_u_short x_macg_pad; + x_u_long x_dlag_rcvmac; /* packets received by DLA from MAC */ + x_u_long x_dlag_rcvpass; /* packets passed to users by DLA */ + x_u_long x_dlag_txreq; /* packets sent by users to DLA */ + x_u_long x_dlag_txsnt; /* packets sent by DLA to MAC */ + x_u_short x_dlag_chaopn; /* channels open */ + x_u_short x_dlag_maxopn; /* max channels opened concurrently */ + x_u_long x_macg_frmtos; /* packets discarded by MAC */ + x_u_long x_macg_frmpas; /* packets sent to DLA by MAC */ + x_u_long x_macg_x2x; /* packets put on wire by MAC */ + x_u_long x_macg_x2r; /* packets looped by MAC */ + x_u_long x_macg_xrty; /* transmitter retries */ + x_u_short x_macg_noap; /* open MAC paths */ + x_u_short x_macg_nprom; /* open promiscuous paths */ + x_u_short x_macg_conopn; /* max concurrent MAC paths */ + x_u_short x_sysg_crce; /* CRC errors */ + x_u_short x_sysg_alne; /* alignment errors */ + x_u_short x_sysg_rsce; /* resource errors */ + x_u_short x_sysg_ovre; /* overrun errors */ + } x_ixg; + struct { /* Channel statistics below */ + x_u_long x_dabc_rcvacc; /* packets received */ + x_u_long x_dabc_rcvtoss; /* packets discarded, queue full */ + x_u_long x_dabc_rcvpass; /* packets passed to user */ + x_u_long x_dabc_txreq; /* packets sent by user */ + x_u_long x_dabc_txsent; /* packets sent to MAC */ + x_u_long x_macc_rcvcnt; /* packets received by MAC */ + x_u_long x_macc_txtcnt; /* packets sent by MAC to wire */ + x_u_long x_macc_lowmem; /* packets discarded, no mem */ + } x_ixc; +}; +#define x_IXC_MAP(x_a) (((x_a) << 6) | 0100077) + +#define x_IXC_OPEN x_IXC_MAP(1) /* Open Channel */ +#define x_IXC_CLOSE x_IXC_MAP(2) /* Close Channel */ +#define x_IXC_MCAST x_IXC_MAP(3) /* Set Multicast Addresses */ +#define x_IXC_RECV x_IXC_MAP(4) /* Receive Frame */ +#define x_IXC_RECVF x_IXC_MAP(5) /* Receive Fragment */ +#define x_IXC_XMIT x_IXC_MAP(6) /* Send Frame */ +#define x_IXC_GSTAT x_IXC_MAP(7) /* Get General Statistics */ +#define x_IXC_CSTAT x_IXC_MAP(8) /* Get Channel Statistics */ +#define x_IXC_GSCLR x_IXC_MAP(9) /* Clear General Statistics */ +#define x_IXC_CSCLR x_IXC_MAP(10) /* Clear Channel Statistics */ +#define x_IXC_RESET x_IXC_MAP(11) /* Reset DLA module */ +#define x_IXC_LDPA x_IXC_MAP(12) /* Load Physical Address */ + +#endif diff --git a/x_include/vaxif/x_if_pclreg.h b/x_include/vaxif/x_if_pclreg.h new file mode 100644 index 0000000..299bbf4 --- /dev/null +++ b/x_include/vaxif/x_if_pclreg.h @@ -0,0 +1,68 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_PCLREG_H_ +#define x__VAXIF_IF_PCLREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_pclreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * DEC CSS PCL-11B Parallel Communications Interface + */ + +struct x_pcldevice { + x_u_short x_pcl_tcr; /* Transmitter Command Register */ + x_u_short x_pcl_tsr; /* Transmitter Status Register */ + x_u_short x_pcl_tsdb; /* Transmitter Source Data Buffer */ + x_short x_pcl_tsbc; /* Transmitter Source Byte Count */ + x_u_short x_pcl_tsba; /* Transmitter Source Bus Address */ + x_u_short x_pcl_tmmr; /* Transmitter Master/Maint Regs */ + x_u_short x_pcl_tscrc; /* Transmitter Source CRC */ + x_u_short x_pcl_spare; + x_u_short x_pcl_rcr; /* Receiver Command Register */ + x_u_short x_pcl_rsr; /* Receiver Status Register */ + x_u_short x_pcl_rddb; /* Receiver Destination Data Buffer */ + x_short x_pcl_rdbc; /* Receiver Destination Byte Count */ + x_u_short x_pcl_rdba; /* Receiver Destination Bus Address */ + x_u_short x_pcl_rdcrc; /* Receiver Destination CRC */ +}; + +/* Transmitter Command and Status Bits */ +#define x_PCL_STTXM (1<<0) /* Start transmission */ +#define x_PCL_TXINIT (1<<1) /* Transmitter Initialize */ +#define x_PCL_IE (1<<6) /* Interrupt Enable */ +#define x_PCL_SNDWD (1<<13) /* Send word */ +#define x_PCL_TXNPR (1<<14) /* Transmitter NPR */ +#define x_PCL_RIB (1<<15) /* Retry if busy */ + +#define x_PCL_RESPA (3<<0) /* Response A bits (tsr & rsr) */ +#define x_PCL_RESPB (3<<2) /* Response B bits (tsr & rsr) */ +#define x_PCL_MSTDWN (1<<11) /* Master down */ +#define x_PCL_ERR (1<<15) /* Error summary */ + +#define x_PCL_MASTER (1<<8) /* Set MASTER status */ +#define x_PCL_AUTOADDR (1<<12) /* Auto time slicing */ + +/* Receiver Command and Status Bits */ +#define x_PCL_RCVDAT (1<<0) /* Receive data */ +#define x_PCL_RCINIT (1<<1) /* Receiver Initialize */ +#define x_PCL_RCVWD (1<<13) /* Receive word */ +#define x_PCL_RCNPR (1<<14) /* Receive NRP */ +#define x_PCL_REJ (1<<15) /* Reject transmission */ + +#define x_PCL_BCOFL (1<<9) /* Byte Counter Overflow */ + +#define x_PCL_TERRBITS "\20\20ERR\17NXL\16MEM_OFL\15TXM_ERR\14MST_DWN\13TIM_OUT\12OVERRUN\11DTI_RDY\10SUC_TXF\07BUSY\06SOREJ\05TBS_BUSY" +#define x_PCL_TCSRBITS "\20\20RIB\17TX_NPR\16SND_WD\10RD_SILO\07IE\04DTO_RDY\03INH_ADI\02TX_INIT\01START_TXM" + +#define x_PCL_RERRBITS "\20\20ERR\17NXL\16MEM_OFL\15TXM_ERR\14PARITY\13TIM_OUT\12BC_OFL\11DTO_RDY\10SUC_TXF\07BUSY\06REJ_COMP\05CHN_OPN" +#define x_PCL_RCSRBITS "\20\20REJ\17RC_NPR\16RCV_WD\10LD_SILO\07IE\04DTI_RDY\03INH_ADI\02RC_INIT\01RCV_DAT" + +#endif diff --git a/x_include/vaxif/x_if_qereg.h b/x_include/vaxif/x_if_qereg.h new file mode 100644 index 0000000..53e45bf --- /dev/null +++ b/x_include/vaxif/x_if_qereg.h @@ -0,0 +1,144 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_QEREG_H_ +#define x__VAXIF_IF_QEREG_H_ + +#include + +/* @(#)if_qereg.h 7.1 (Berkeley) 6/5/86 */ + +/* @(#)if_qereg.h 1.2 (ULTRIX) 1/3/85 */ + +/**************************************************************** + * * + * Licensed from Digital Equipment Corporation * + * Copyright (c) * + * Digital Equipment Corporation * + * Maynard, Massachusetts * + * 1985, 1986 * + * All rights reserved. * + * * + * The Information in this software is subject to change * + * without notice and should not be construed as a commitment * + * by Digital Equipment Corporation. Digital makes no * + * representations about the suitability of this software for * + * any purpose. It is supplied "As Is" without expressed or * + * implied warranty. * + * * + * If the Regents of the University of California or its * + * licensees modify the software in a manner creating * + * diriviative copyright rights, appropriate copyright * + * legends may be placed on the drivative work in addition * + * to that set forth above. * + * * + ****************************************************************/ +/* --------------------------------------------------------------------- + * Modification History + * + * 13 Feb. 84 -- rjl + * + * Initial version of driver. derived from IL driver. + * + * --------------------------------------------------------------------- + */ + +/* + * Digital Q-BUS to NI Adapter + */ +struct x_qedevice { + x_u_short x_qe_sta_addr[2]; /* Station address (actually 6 */ + x_u_short x_qe_rcvlist_lo; /* Receive list lo address */ + x_u_short x_qe_rcvlist_hi; /* Receive list hi address */ + x_u_short x_qe_xmtlist_lo; /* Transmit list lo address */ + x_u_short x_qe_xmtlist_hi; /* Transmit list hi address */ + x_u_short x_qe_vector; /* Interrupt vector */ + x_u_short x_qe_csr; /* Command and Status Register */ +}; + +/* + * Command and status bits (csr) + */ +#define x_QE_RCV_ENABLE 0x0001 /* Receiver enable */ +#define x_QE_RESET 0x0002 /* Software reset */ +#define x_QE_NEX_MEM_INT 0x0004 /* Non existant mem interrupt */ +#define x_QE_LOAD_ROM 0x0008 /* Load boot/diag from rom */ +#define x_QE_XL_INVALID 0x0010 /* Transmit list invalid */ +#define x_QE_RL_INVALID 0x0020 /* Receive list invalid */ +#define x_QE_INT_ENABLE 0x0040 /* Interrupt enable */ +#define x_QE_XMIT_INT 0x0080 /* Transmit interrupt */ +#define x_QE_ILOOP 0x0100 /* Internal loopback */ +#define x_QE_ELOOP 0x0200 /* External loopback */ +#define x_QE_STIM_ENABLE 0x0400 /* Sanity timer enable */ +#define x_QE_POWERUP 0x1000 /* Tranceiver power on */ +#define x_QE_CARRIER 0x2000 /* Carrier detect */ +#define x_QE_RCV_INT 0x8000 /* Receiver interrupt */ + +/* + * Transmit and receive ring discriptor --------------------------- + * + * The QNA uses the flag, status1 and the valid bit as a handshake/semiphore + * mechinism. + * + * The flag word is written on ( bits 15,15 set to 1 ) when it reads the + * descriptor. If the valid bit is set it considers the address to be valid. + * When it uses the buffer pointed to by the valid address it sets status word + * one. + */ +struct x_qe_ring { + x_u_short x_qe_flag; /* Buffer utilization flags */ + x_u_short x_qe_addr_hi:6, /* Hi order bits of buffer addr */ + x_qe_odd_begin:1, /* Odd byte begin and end (xmit)*/ + x_qe_odd_end:1, + x_qe_fill1:4, + x_qe_setup:1, /* Setup packet */ + x_qe_eomsg:1, /* End of message flag */ + x_qe_chain:1, /* Chain address instead of buf */ + x_qe_valid:1; /* Address field is valid */ + x_u_short x_qe_addr_lo; /* Low order bits of address */ + x_short x_qe_buf_len; /* Negative buffer length */ + x_u_short x_qe_status1; /* Status word one */ + x_u_short x_qe_status2; /* Status word two */ +}; + +/* + * Status word definations (receive) + * word1 + */ +#define x_QE_OVF 0x0001 /* Receiver overflow */ +#define x_QE_CRCERR 0x0002 /* CRC error */ +#define x_QE_FRAME 0x0004 /* Framing alignment error */ +#define x_QE_SHORT 0x0008 /* Packet size < 10 bytes */ +#define x_QE_RBL_HI 0x0700 /* Hi bits of receive len */ +#define x_QE_RUNT 0x0800 /* Runt packet */ +#define x_QE_DISCARD 0x1000 /* Discard the packet */ +#define x_QE_ESETUP 0x2000 /* Looped back setup or eloop */ +#define x_QE_ERROR 0x4000 /* Receiver error */ +#define x_QE_LASTNOT 0x8000 /* Not the last in the packet */ +/* word2 */ +#define x_QE_RBL_LO 0x00ff /* Low bits of receive len */ + +/* + * Status word definations (transmit) + * word1 + */ +#define x_QE_CCNT 0x00f0 /* Collision count this packet */ +#define x_QE_FAIL 0x0100 /* Heart beat check failure */ +#define x_QE_ABORT 0x0200 /* Transmission abort */ +#define x_QE_STE16 0x0400 /* Sanity timer default on */ +#define x_QE_NOCAR 0x0800 /* No carrier */ +#define x_QE_LOSS 0x1000 /* Loss of carrier while xmit */ +/* word2 */ +#define x_QE_TDR 0x3fff /* Time domain reflectometry */ + +/* + * General constant definations + */ +#define x_QEALLOC 0 /* Allocate an mbuf */ +#define x_QENOALLOC 1 /* No mbuf allocation */ +#define x_QEDEALLOC 2 /* Release an mbuf chain */ + +#define x_QE_NOTYET 0x8000 /* Descriptor not in use yet */ +#define x_QE_INUSE 0x4000 /* Descriptor being used by QNA */ +#define x_QE_MASK 0xc000 /* Lastnot/error/used mask */ + +#endif diff --git a/x_include/vaxif/x_if_uba.h b/x_include/vaxif/x_if_uba.h new file mode 100644 index 0000000..fca8709 --- /dev/null +++ b/x_include/vaxif/x_if_uba.h @@ -0,0 +1,115 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_UBA_H_ +#define x__VAXIF_IF_UBA_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_uba.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Structure and routine definitions + * for UNIBUS network interfaces. + */ + +#define x_IF_MAXNUBAMR 10 +/* + * Each interface has structures giving information + * about UNIBUS resources held by the interface + * for each send and receive buffer. + * + * We hold IF_NUBAMR map registers for datagram data, starting + * at ifr_mr. Map register ifr_mr[-1] maps the local network header + * ending on the page boundary. Bdp's are reserved for read and for + * write, given by ifr_bdp. The prototype of the map register for + * read and for write is saved in ifr_proto. + * + * When write transfers are not full pages on page boundaries we just + * copy the data into the pages mapped on the UNIBUS and start the + * transfer. If a write transfer is of a (1024 byte) page on a page + * boundary, we swap in UNIBUS pte's to reference the pages, and then + * remap the initial pages (from ifu_wmap) when the transfer completes. + * + * When read transfers give whole pages of data to be input, we + * allocate page frames from a network page list and trade them + * with the pages already containing the data, mapping the allocated + * pages to replace the input pages for the next UNIBUS data input. + */ + +/* + * Information per interface. + */ +struct x_ifubinfo { + x_short x_iff_uban; /* uba number */ + x_short x_iff_hlen; /* local net header length */ + struct x_uba_regs *x_iff_uba; /* uba regs, in vm */ + x_short x_iff_flags; /* used during uballoc's */ +}; + +/* + * Information per buffer. + */ +struct x_ifrw { + x_caddr_t x_ifrw_addr; /* virt addr of header */ + x_short x_ifrw_bdp; /* unibus bdp */ + x_short x_ifrw_flags; /* type, etc. */ +#define x_IFRW_W 0x01 /* is a transmit buffer */ + x_int x_ifrw_info; /* value from ubaalloc */ + x_int x_ifrw_proto; /* map register prototype */ + struct x_pte *x_ifrw_mr; /* base of map registers */ +}; + +/* + * Information per transmit buffer, including the above. + */ +struct x_ifxmt { + struct x_ifrw x_ifrw; + x_caddr_t x_ifw_base; /* virt addr of buffer */ + struct x_pte x_ifw_wmap[x_IF_MAXNUBAMR]; /* base pages for output */ + struct x_mbuf *x_ifw_xtofree; /* pages being dma'd out */ + x_short x_ifw_xswapd; /* mask of clusters swapped */ + x_short x_ifw_nmr; /* number of entries in wmap */ +}; +#define x_ifw_addr x_ifrw.x_ifrw_addr +#define x_ifw_bdp x_ifrw.x_ifrw_bdp +#define x_ifw_flags x_ifrw.x_ifrw_flags +#define x_ifw_info x_ifrw.x_ifrw_info +#define x_ifw_proto x_ifrw.x_ifrw_proto +#define x_ifw_mr x_ifrw.x_ifrw_mr + +/* + * Most interfaces have a single receive and a single transmit buffer, + * and use struct ifuba to store all of the unibus information. + */ +struct x_ifuba { + struct x_ifubinfo x_ifu_info; + struct x_ifrw x_ifu_r; + struct x_ifxmt x_ifu_xmt; +}; + +#define x_ifu_uban x_ifu_info.x_iff_uban +#define x_ifu_hlen x_ifu_info.x_iff_hlen +#define x_ifu_uba x_ifu_info.x_iff_uba +#define x_ifu_flags x_ifu_info.x_iff_flags +#define x_ifu_w x_ifu_xmt.x_ifrw +#define x_ifu_xtofree x_ifu_xmt.x_ifw_xtofree + +#ifdef x_KERNEL +#define x_if_ubainit(x_ifuba, x_uban, x_hlen, x_nmr) \ + x_if_ubaminit(&(x_ifuba)->x_ifu_info, x_uban, x_hlen, x_nmr, \ + &(x_ifuba)->x_ifu_r, 1, &(x_ifuba)->x_ifu_xmt, 1) +#define x_if_rubaget(x_ifu, x_totlen, x_off0, x_ifp) \ + x_if_ubaget(&(x_ifu)->x_ifu_info, &(x_ifu)->x_ifu_r, x_totlen, x_off0, x_ifp) +#define x_if_wubaput(x_ifu, x_m) \ + x_if_ubaput(&(x_ifu)->x_ifu_info, &(x_ifu)->x_ifu_xmt, x_m) +/*struct mbuf *if_ubaget();*/ +#endif + +#endif diff --git a/x_include/vaxif/x_if_vv.h b/x_include/vaxif/x_if_vv.h new file mode 100644 index 0000000..7ed6296 --- /dev/null +++ b/x_include/vaxif/x_if_vv.h @@ -0,0 +1,121 @@ +#include "x_.h" + +#ifndef x__VAXIF_IF_VV_H_ +#define x__VAXIF_IF_VV_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)if_vv.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * ECO 176-748 changed the braodcast address from 0 to 0xff, at + * CTL (p1002) serial number around 150. + * It was implemented in August, 1982. This is a field-installable ECO, + * which improves net reliability. If the broadcast address has not been + * changed, comment out the following line. + */ +#define x_NEW_BROADCAST /* new chip for broadcast problem */ + +/* + * Local network header for proNET Ring + * This is arbitrated by "jas@proteon" + * (aka John Shriver, 617-655-3340) + */ + +struct x_vv_header { + /* the first two fields are required by the hardware */ + x_u_char x_vh_dhost; /* destination address */ + x_u_char x_vh_shost; /* source address */ + /* the next three fields are the local network header */ + x_u_char x_vh_version; /* header version */ + x_u_char x_vh_type; /* packet type => protocol number */ + x_short x_vh_info; /* protocol-specific information */ +}; + +#define x_RING_VERSION 2 /* current version of v2lni header */ + +/* + * Packet types (protocol numbers) in proNET protocol header + * Other types are defined, but are proprietary. + */ +#define x_RING_IP 1 +#define x_RING_TRAILER 2 /* offset now in vh_info only */ +#define x_RING_ARP 3 +#define x_RING_HDLC 4 +#define x_RING_VAXDB 5 +#define x_RING_RINGWAY 6 +#define x_RING_RINGWAYM 8 +#define x_RING_NOVELL 10 +#define x_RING_PUP 12 +#define x_RING_XNS 14 +#define x_RING_DIAGNOSTICS 15 /* protocol type for testing */ +#define x_RING_ECHO 16 + +#ifdef x_NEW_BROADCAST +#define x_VV_BROADCAST 0xff /* hardware-defined broadcast address */ +#else +#define x_VV_BROADCAST 0x00 /* hardware-defined broadcast address */ +#endif + +/* + * Proteon proNET Hardware definitions + * register bit definitions + */ +#define x_VV_ENB 01 /* Enable Operation */ +#define x_VV_DEN 02 /* Enable DMA */ +#define x_VV_HEN 04 /* Host Relay Enable (Rcv) */ +#define x_VV_CPB 04 /* Clear Packet Buffer (Xmit) */ +#define x_VV_STE 010 /* Self Test Enable (Rcv) */ +#define x_VV_UT1 010 /* Unused (Xmit) */ +#define x_VV_LPB 020 /* Modem Disable (Rcv) */ +#define x_VV_INR 020 /* Initialize Ring (Xmit) */ +#define x_VV_RST 040 /* Reset */ +#define x_VV_IEN 0100 /* Interrupt Enable */ +#define x_VV_RDY 0200 /* Done */ +#define x_VV_DPR 0400 /* Data Present (Rcv) */ +#define x_VV_RFS 0400 /* Refused (Xmit) */ +#define x_VV_NXM 01000 /* Non Existent Memory */ +#define x_VV_OVR 02000 /* Overrun */ +#define x_VV_ODB 04000 /* Odd Byte (Rcv) */ +#define x_VV_UT2 04000 /* Unused (Xmit) */ +#define x_VV_LDE 010000 /* Parity on 10 megabit (Rcv), */ + /* Link Data Error on 80 megabit (Rcv) */ +#define x_VV_OPT 010000 /* Output Timeout (Xmit) */ +#define x_VV_NOK 020000 /* Ring Not OK */ +#define x_VV_BDF 040000 /* Bad Format in Operation */ +#define x_VV_NIR 0100000 /* Not in Ring */ + +#define x_VVXERR (x_VV_NXM|x_VV_OVR|x_VV_OPT|x_VV_BDF) /* Xmit errs */ +#define x_VVRERR (x_VV_NXM|x_VV_OVR|x_VV_ODB|x_VV_BDF|x_VV_DPR) /* Rcv errs */ +#define x_VVFE (x_VV_NXM|x_VV_OVR) /* Fatal errors */ + +#define x_VV_IBITS \ +"\10\20NIR\17BDF\16NOK\15LDE\14ODB\13OVR\12NXM\11DPR\10RDY\7IEN\6RST\5LPB\4STE\3HEN\2DEN\1ENB" + +#define x_VV_OBITS \ +"\10\20NIR\17BDF\16NOK\15OPT\13OVR\12NXM\11RFS\10RDY\7IEN\6RST\5INR\3HEN\2DEN\1ENB" + +/* device registers */ +struct x_vvreg { + x_short x_vvicsr; /* input csr */ + x_u_short x_vviwc; /* input word count */ + x_u_short x_vviba; /* input addr lo */ + x_u_short x_vviea; /* input addr hi */ + x_short x_vvocsr; /* output csr */ + x_u_short x_vvowc; /* output word count */ + x_u_short x_vvoba; /* output addr lo */ + x_u_short x_vvoea; /* output addr hi */ +}; + +#define x_VVRETRY 7 /* output retry limit */ +#define x_VVIDENTSUCC 5 /* number of successes required in self-test */ +#define x_VVIDENTRETRY 10 /* identify loop attempt limit */ +#define x_VVTIMEOUT 60 /* seconds before a transmit timeout */ + +#endif diff --git a/x_include/vaxmba/x_hpreg.h b/x_include/vaxmba/x_hpreg.h new file mode 100644 index 0000000..421284c --- /dev/null +++ b/x_include/vaxmba/x_hpreg.h @@ -0,0 +1,172 @@ +#include "x_.h" + +#ifndef x__VAXMBA_HPREG_H_ +#define x__VAXMBA_HPREG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)hpreg.h 7.1 (Berkeley) 6/5/86 + */ + +struct x_hpdevice { + x_int x_hpcs1; /* control and status register 1 */ + x_int x_hpds; /* drive status */ + x_int x_hper1; /* error register 1 */ + x_int x_hpmr; /* maintenance */ + x_int x_hpas; /* attention summary */ + x_int x_hpda; /* desired address register */ + x_int x_hpdt; /* drive type */ + x_int x_hpla; /* look ahead */ + x_int x_hpsn; /* serial number */ + x_int x_hpof; /* offset register */ + x_int x_hpdc; /* desired cylinder address register */ + x_int x_hpcc; /* current cylinder */ +#define x_hphr x_hpcc /* holding register */ +/* on an rp drive, mr2 is called er2 and er2 is called er3 */ +/* we use rm terminology here */ + x_int x_hpmr2; /* maintenance register 2 */ + x_int x_hper2; /* error register 2 */ + x_int x_hpec1; /* burst error bit position */ + x_int x_hpec2; /* burst error bit pattern */ +}; + +/* hpcs1 */ +#define x_HP_SC 0100000 /* special condition */ +#define x_HP_TRE 0040000 /* transfer error */ +#define x_HP_DVA 0004000 /* drive available */ +#define x_HP_RDY 0000200 /* controller ready */ +#define x_HP_IE 0000100 /* interrupt enable */ +/* bits 5-1 are the command */ +#define x_HP_GO 0000001 + +/* commands */ +#define x_HP_NOP 000 /* no operation */ +#define x_HP_UNLOAD 002 /* offline drive */ +#define x_HP_SEEK 004 /* seek */ +#define x_HP_RECAL 006 /* recalibrate */ +#define x_HP_DCLR 010 /* drive clear */ +#define x_HP_RELEASE 012 /* release */ +#define x_HP_OFFSET 014 /* offset */ +#define x_HP_RTC 016 /* return to centerline */ +#define x_HP_PRESET 020 /* read-in preset */ +#define x_HP_PACK 022 /* pack acknowledge */ +#define x_HP_SEARCH 030 /* search */ +#define x_HP_DIAGNOSE 034 /* diagnose drive */ +#define x_HP_WCDATA 050 /* write check data */ +#define x_HP_WCHDR 052 /* write check header and data */ +#define x_HP_WCOM 060 /* write data */ +#define x_HP_WHDR 062 /* write header */ +#define x_HP_WTRACKD 064 /* write track descriptor */ +#define x_HP_RCOM 070 /* read data */ +#define x_HP_RHDR 072 /* read header and data */ +#define x_HP_RTRACKD 074 /* read track descriptor */ + +/* hpds */ +#define x_HPDS_ATA 0100000 /* attention active */ +#define x_HPDS_ERR 0040000 /* composite drive error */ +#define x_HPDS_PIP 0020000 /* positioning in progress */ +#define x_HPDS_MOL 0010000 /* medium on line */ +#define x_HPDS_WRL 0004000 /* write locked */ +#define x_HPDS_LST 0002000 /* last sector transferred */ +#define x_HPDS_PGM 0001000 /* programmable */ +#define x_HPDS_DPR 0000400 /* drive present */ +#define x_HPDS_DRY 0000200 /* drive ready */ +#define x_HPDS_VV 0000100 /* volume valid */ +/* bits 1-5 are spare */ +#define x_HPDS_OM 0000001 /* offset mode */ + +#define x_HPDS_DREADY (x_HPDS_DPR|x_HPDS_DRY|x_HPDS_MOL|x_HPDS_VV) +#define x_HPDS_BITS \ +"\10\20ATA\17ERR\16PIP\15MOL\14WRL\13LST\12PGM\11DPR\10DRY\7VV\1OM" + +/* hper1 */ +#define x_HPER1_DCK 0100000 /* data check */ +#define x_HPER1_UNS 0040000 /* drive unsafe */ +#define x_HPER1_OPI 0020000 /* operation incomplete */ +#define x_HPER1_DTE 0010000 /* drive timing error */ +#define x_HPER1_WLE 0004000 /* write lock error */ +#define x_HPER1_IAE 0002000 /* invalid address error */ +#define x_HPER1_AOE 0001000 /* address overflow error */ +#define x_HPER1_HCRC 0000400 /* header crc error */ +#define x_HPER1_HCE 0000200 /* header compare error */ +#define x_HPER1_ECH 0000100 /* ecc hard error */ +#define x_HPER1_WCF 0000040 /* write clock fail */ +#define x_HPER1_FER 0000020 /* format error */ +#define x_HPER1_PAR 0000010 /* parity error */ +#define x_HPER1_RMR 0000004 /* register modification refused */ +#define x_HPER1_ILR 0000002 /* illegal register */ +#define x_HPER1_ILF 0000001 /* illegal function */ + +#define x_HPER1_BITS \ +"\10\20DCK\17UNS\16OPI\15DTE\14WLE\13IAE\12AOE\11HCRC\10HCE\ +\7Ex_CH\6x_WCF\5x_FER\4x_PAR\3x_RMR\2x_ILR\1x_ILF" +#define x_HPER1_HARD \ + (x_HPER1_WLE|x_HPER1_IAE|x_HPER1_AOE|\ + x_HPER1_FER|x_HPER1_RMR|x_HPER1_ILR|x_HPER1_ILF) + +/* hper2 */ +#define x_HPER2_BSE 0100000 /* bad sector error */ +#define x_HPER2_SKI 0040000 /* seek incomplete */ +#define x_HPER2_OPE 0020000 /* operator plug error */ +#define x_HPER2_IVC 0010000 /* invalid command */ +#define x_HPER2_LSC 0004000 /* loss of system clock */ +#define x_HPER2_LBC 0002000 /* loss of bit check */ +#define x_HPER2_DVC 0000200 /* device check */ +#define x_HPER2_SSE 0000040 /* skip sector error (rm80) */ +#define x_HPER2_DPE 0000010 /* data parity error */ + +#define x_HPER2_BITS \ +"\10\20BSE\17SKI\16OPE\15IVC\14LSC\13LBC\10DVC\6SSE\4DPE" +#define x_HPER2_HARD (x_HPER2_OPE) + +/* hpof */ +#define x_HPOF_CMO 0100000 /* command modifier */ +#define x_HPOF_MTD 0040000 /* move track descriptor */ +#define x_HPOF_FMT22 0010000 /* 16 bit format */ +#define x_HPOF_ECI 0004000 /* ecc inhibit */ +#define x_HPOF_HCI 0002000 /* header compare inhibit */ +#define x_HPOF_SSEI 0001000 /* skip sector inhibit */ + +#define x_HPOF_P400 020 /* +400 uinches */ +#define x_HPOF_M400 0220 /* -400 uinches */ +#define x_HPOF_P800 040 /* +800 uinches */ +#define x_HPOF_M800 0240 /* -800 uinches */ +#define x_HPOF_P1200 060 /* +1200 uinches */ +#define x_HPOF_M1200 0260 /* -1200 uinches */ + +/* hphr (alias hpcc) commands */ +#define x_HPHR_MAXCYL 0x8017 /* maximum cylinder address */ +#define x_HPHR_MAXTRAK 0x8018 /* maximum track address */ +#define x_HPHR_MAXSECT 0x8019 /* maximum sector address */ +#define x_HPHR_FMTENABLE 0xffff /* enable format command in cs1 */ + +/* hpmr */ +#define x_HPMR_SZ 0174000 /* ML11 system size */ +#define x_HPMR_ARRTYP 0002000 /* ML11 array type */ +#define x_HPMR_TRT 0001400 /* ML11 transfer rate */ + +/* + * Systems Industries kludge: use value in + * the serial # register to figure out real drive type. + */ +#define x_SIMB_MB 0xff00 /* model byte value */ +#define x_SIMB_S6 0x2000 /* switch s6 */ +#define x_SIMB_LU 0x0007 /* logical unit (should = drive #) */ + +#define x_SI9775D 0x0700 /* 9775 direct */ +#define x_SI9775M 0x0e00 /* 9775 mapped */ +#define x_SI9730D 0x0b00 /* 9730 direct */ +#define x_SI9730M 0x0d00 /* 9730 mapped */ +#define x_SI9766 0x0300 /* 9766 */ +#define x_SI9762 0x0100 /* 9762 */ +#define x_SICAPD 0x0500 /* Capricorn direct */ +#define x_SICAPN 0x0400 /* Capricorn mapped */ +#define x_SI9751D 0x0f00 /* Eagle direct */ + +#define x_SIRM03 0x8000 /* RM03 indication */ +#define x_SIRM05 0x0000 /* RM05 pseudo-indication */ + +#endif diff --git a/x_include/vaxmba/x_htreg.h b/x_include/vaxmba/x_htreg.h new file mode 100644 index 0000000..3926073 --- /dev/null +++ b/x_include/vaxmba/x_htreg.h @@ -0,0 +1,118 @@ +#include "x_.h" + +#ifndef x__VAXMBA_HTREG_H_ +#define x__VAXMBA_HTREG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)htreg.h 7.1 (Berkeley) 6/5/86 + */ + +struct x_htdevice { + x_int x_htcs1; /* control status register */ + x_int x_htds; /* drive status register */ + x_int x_hter; /* error register */ + x_int x_htmr; /* maintenance register */ + x_int x_htas; /* attention status register */ + x_int x_htfc; /* frame counter */ + x_int x_htdt; /* drive type register */ + x_int x_htck; /* nrzi check (crc) error character */ + x_int x_htsn; /* serial number register */ + x_int x_httc; /* tape controll register */ +}; + +/* htcs1 */ +#define x_HT_GO 000001 /* go bit */ +#define x_HT_SENSE 000000 /* no operations (sense) */ +#define x_HT_REWOFFL 000002 /* rewind offline */ +#define x_HT_REW 000006 /* rewind */ +#define x_HT_DCLR 000010 /* drive clear */ +#define x_HT_RIP 000020 /* read in preset */ +#define x_HT_ERASE 000024 /* erase */ +#define x_HT_WEOF 000026 /* write tape mark */ +#define x_HT_SFORW 000030 /* space forward */ +#define x_HT_SREV 000032 /* space reverse */ +#define x_HT_WCHFWD 000050 /* write check forward */ +#define x_HT_WCHREV 000056 /* write check reverse */ +#define x_HT_WCOM 000060 /* write forward */ +#define x_HT_RCOM 000070 /* read forward */ +#define x_HT_RREV 000076 /* read reverse */ + +/* htds */ +#define x_HTDS_ATA 0100000 /* attention active */ +#define x_HTDS_ERR 0040000 /* composite error */ +#define x_HTDS_PIP 0020000 /* positioning in progress */ +#define x_HTDS_MOL 0010000 /* medium on line */ +#define x_HTDS_WRL 0004000 /* write lock */ +#define x_HTDS_EOT 0002000 /* end of tape */ +/* bit 9 is unused */ +#define x_HTDS_DPR 0000400 /* drive present (always 1) */ +#define x_HTDS_DRY 0000200 /* drive ready */ +#define x_HTDS_SSC 0000100 /* slave status change */ +#define x_HTDS_PES 0000040 /* phase-encoded status */ +#define x_HTDS_SDWN 0000020 /* settle down */ +#define x_HTDS_IDB 0000010 /* identification burst */ +#define x_HTDS_TM 0000004 /* tape mark */ +#define x_HTDS_BOT 0000002 /* beginning of tape */ +#define x_HTDS_SLA 0000001 /* slave attention */ + +#define x_HTDS_BITS \ +"\10\20ATA\17ERR\16PIP\15MOL\14WRL\13EOT\11DPR\10DRY\ +\7x_SSC\6x_PES\5x_SDWN\4x_IDB\3x_TM\2x_BOT\1x_SLA" + +/* hter */ +#define x_HTER_CORCRC 0100000 /* correctible data or ecc */ +#define x_HTER_UNS 0040000 /* unsafe */ +#define x_HTER_OPI 0020000 /* operation incomplete */ +#define x_HTER_DTE 0010000 /* drive timing error */ +#define x_HTER_NEF 0004000 /* non-executable function */ +#define x_HTER_CSITM 0002000 /* correctable skew/illegal tape mark */ +#define x_HTER_FCE 0001000 /* frame count error */ +#define x_HTER_NSG 0000400 /* non-standard gap */ +#define x_HTER_PEFLRC 0000200 /* format error or lrc error */ +#define x_HTER_INCVPE 0000100 /* incorrectable data error or vertical + parity error */ +#define x_HTER_DPAR 0000040 /* data parity error */ +#define x_HTER_FMT 0000020 /* format error */ +#define x_HTER_CPAR 0000010 /* control bus parity error */ +#define x_HTER_RMR 0000004 /* register modification refused */ +#define x_HTER_ILR 0000002 /* illegal register */ +#define x_HTER_ILF 0000001 /* illegal function */ + +#define x_HTER_BITS \ +"\10\20CORCRC\17UNS\16OPI\15DTE\14NEF\13CSITM\12FCE\11NSG\10PEFLRC\ +\7x_INCVPE\6Dx_PAR\5x_FMT\4x_CPAR\3x_RMR\2x_ILR\1x_ILF" +#define x_HTER_HARD \ + (x_HTER_UNS|x_HTER_OPI|x_HTER_NEF|x_HTER_DPAR|x_HTER_FMT|x_HTER_CPAR| \ + x_HTER_RMR|x_HTER_ILR|x_HTER_ILF) + +/* htdt */ +#define x_HTDT_NSA 0100000 /* not sector addressed; always 1 */ +#define x_HTDT_TAP 0040000 /* tape; always 1 */ +#define x_HTDT_MOH 0020000 /* moving head; always 0 */ +#define x_HTDT_7CH 0010000 /* 7 channel; always 0 */ +#define x_HTDT_DRQ 0004000 /* drive requested; always 0 */ +#define x_HTDT_SPR 0002000 /* slave present */ +/* bit 9 is spare */ +/* bits 8-0 are formatter/transport type */ + +/* httc */ +#define x_HTTC_ACCL 0100000 /* transport is not reading/writing */ +#define x_HTTC_FCS 0040000 /* frame count status */ +#define x_HTTC_SAC 0020000 /* slave address change */ +#define x_HTTC_EAODTE 0010000 /* enable abort on data xfer errors */ +/* bits 8-10 are density select */ +#define x_HTTC_800BPI 0001400 /* in bits 8-10, dens=1600 */ +#define x_HTTC_1600BPI 0002000 /* in bits 8-10, dens=800 */ +/* bits 4-7 are format select */ +#define x_HTTC_PDP11 0000300 /* in bits 4-7, pdp11 normal format */ +#define x_HTTC_EVEN 0000010 /* select even parity */ +/* bits 0 - 2 are slave select */ + +#define x_b_repcnt x_b_bcount +#define x_b_command x_b_resid + +#endif diff --git a/x_include/vaxmba/x_mbareg.h b/x_include/vaxmba/x_mbareg.h new file mode 100644 index 0000000..dbf13c7 --- /dev/null +++ b/x_include/vaxmba/x_mbareg.h @@ -0,0 +1,143 @@ +#include "x_.h" + +#ifndef x__VAXMBA_MBAREG_H_ +#define x__VAXMBA_MBAREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)mbareg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * VAX MASSBUS adapter registers + */ + +struct x_mba_regs { + x_int x_mba_csr; /* configuration register */ + x_int x_mba_cr; /* control register */ + x_int x_mba_sr; /* status register */ + x_int x_mba_var; /* virtual address register */ + x_int x_mba_bcr; /* byte count register */ + x_int x_mba_dr; + x_int x_mba_pad1[250]; + struct x_mba_drv { /* per drive registers */ + x_int x_mbd_cs1; /* control status */ + x_int x_mbd_ds; /* drive status */ + x_int x_mbd_er1; /* error register */ + x_int x_mbd_mr1; /* maintenance register */ + x_int x_mbd_as; /* attention status */ + x_int x_mbd_da; /* desired address (disks) */ +#define x_mbd_fc x_mbd_da /* frame count (tapes) */ + x_int x_mbd_dt; /* drive type */ + x_int x_mbd_la; /* look ahead (disks) */ +#define x_mbd_ck x_mbd_la /* ??? (tapes) */ + x_int x_mbd_sn; /* serial number */ + x_int x_mbd_of; /* ??? */ +#define x_mbd_tc x_mbd_of /* ??? */ + x_int x_mbd_fill[22]; + } x_mba_drv[8]; + struct x_pte x_mba_map[256]; /* io space virtual map */ + x_int x_mba_pad2[256*5]; /* to size of a nexus */ +}; + +/* + * Bits in mba_cr + */ +#define x_MBCR_INIT 0x1 /* init mba */ +#define x_MBCR_IE 0x4 /* enable mba interrupts */ + +/* + * Bits in mba_sr + */ +#define x_MBSR_DTBUSY 0x80000000 /* data transfer busy */ +#define x_MBSR_NRCONF 0x40000000 /* no response confirmation */ +#define x_MBSR_CRD 0x20000000 /* corrected read data */ +#define x_MBSR_CBHUNG 0x00800000 /* control bus hung */ +#define x_MBSR_PGE 0x00080000 /* programming error */ +#define x_MBSR_NED 0x00040000 /* non-existant drive */ +#define x_MBSR_MCPE 0x00020000 /* massbus control parity error */ +#define x_MBSR_ATTN 0x00010000 /* attention from massbus */ +#define x_MBSR_SPE 0x00004000 /* silo parity error */ +#define x_MBSR_DTCMP 0x00002000 /* data transfer completed */ +#define x_MBSR_DTABT 0x00001000 /* data transfer aborted */ +#define x_MBSR_DLT 0x00000800 /* data late */ +#define x_MBSR_WCKUP 0x00000400 /* write check upper */ +#define x_MBSR_WCKLWR 0x00000200 /* write check lower */ +#define x_MBSR_MXF 0x00000100 /* miss transfer error */ +#define x_MBSR_MBEXC 0x00000080 /* massbus exception */ +#define x_MBSR_MDPE 0x00000040 /* massbus data parity error */ +#define x_MBSR_MAPPE 0x00000020 /* page frame map parity error */ +#define x_MBSR_INVMAP 0x00000010 /* invalid map */ +#define x_MBSR_ERRCONF 0x00000008 /* error confirmation */ +#define x_MBSR_RDS 0x00000004 /* read data substitute */ +#define x_MBSR_ISTIMO 0x00000002 /* interface sequence timeout */ +#define x_MBSR_RDTIMO 0x00000001 /* read data timeout */ + +#define x_MBSR_BITS \ +"\20\40DTBUSY\37NRCONF\36CRD\30CBHUNG\24PGE\23NED\22MCPE\21ATTN\ +\17x_SPE\16Dx_TCMP\15Dx_TABT\14Dx_LT\13x_WCKUP\12x_WCKLWR\11x_MXF\10x_MBEXC\7x_MDPE\ +\6x_MAPPE\5x_INVMAP\4Ex_RRCONF\3x_RDS\2x_ISTIMO\1x_RDTIMO" + +#define x_MBSR_HARD (x_MBSR_PGE|x_MBSR_ERRCONF|x_MBSR_ISTIMO|x_MBSR_RDTIMO) + +#define x_MBSR_EBITS (~(x_MBSR_DTBUSY|x_MBSR_CRD|x_MBSR_ATTN|x_MBSR_DTCMP)) + +#ifdef x_KERNEL +extern char x_mbsr_bits[]; +#endif + +/* + * Commands for mbd_cs1 + */ +#define x_MB_WCOM 0x30 +#define x_MB_RCOM 0x38 +#define x_MB_GO 0x1 + +/* + * Bits in mbd_ds. + */ +#define x_MBDS_ERR 0x00004000 /* error in drive */ +#define x_MBDS_MOL 0x00001000 /* medium on line */ +#define x_MBDS_DPR 0x00000100 /* drive present */ +#define x_MBDS_DRY 0x00000080 /* drive ready */ + +#define x_MBDS_DREADY (x_MBDS_MOL|x_MBDS_DPR|x_MBDS_DRY) + +/* + * Bits in mbd_dt + */ +#define x_MBDT_NSA 0x8000 /* not sector addressible */ +#define x_MBDT_TAP 0x4000 /* is a tape */ +#define x_MBDT_MOH 0x2000 /* moving head */ +#define x_MBDT_7CH 0x1000 /* 7 channel */ +#define x_MBDT_DRQ 0x800 /* drive request required */ +#define x_MBDT_SPR 0x400 /* slave present */ + +#define x_MBDT_TYPE 0x1ff +#define x_MBDT_MASK (x_MBDT_NSA|x_MBDT_TAP|x_MBDT_TYPE) + +/* type codes for disk drives */ +#define x_MBDT_RP04 020 +#define x_MBDT_RP05 021 +#define x_MBDT_RP06 022 +#define x_MBDT_RP07 042 +#define x_MBDT_RM02 025 +#define x_MBDT_RM03 024 +#define x_MBDT_RM05 027 +#define x_MBDT_RM80 026 +#define x_MBDT_ML11A 0110 +#define x_MBDT_ML11B 0111 + +/* type codes for tape drives */ +#define x_MBDT_TM03 050 +#define x_MBDT_TE16 051 +#define x_MBDT_TU45 052 +#define x_MBDT_TU77 054 +#define x_MBDT_TU78 0101 + +#endif diff --git a/x_include/vaxmba/x_mbavar.h b/x_include/vaxmba/x_mbavar.h new file mode 100644 index 0000000..2762813 --- /dev/null +++ b/x_include/vaxmba/x_mbavar.h @@ -0,0 +1,154 @@ +#include "x_.h" + +#ifndef x__VAXMBA_MBAVAR_H_ +#define x__VAXMBA_MBAVAR_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)mbavar.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * This file contains definitions related to the kernel structures + * for dealing with the massbus adapters. + * + * Each mba has a mba_hd structure. + * Each massbus device has a mba_device structure. + * Each massbus slave has a mba_slave structure. + * + * At boot time we prowl the structures and fill in the pointers + * for devices which we find. + */ + +/* + * Per-mba structure. + * + * The initialization routine uses the information in the mbdinit table + * to initialize the what is attached to each massbus slot information. + * It counts the number of devices on each mba (to see if bothering to + * search/seek is appropriate). + * + * During normal operation, the devices attached to the mba which wish + * to transfer are queued on the mh_act? links. + */ +struct x_mba_hd { + x_short x_mh_active; /* set if mba is active */ + x_short x_mh_ndrive; /* number of devices, to avoid seeks */ + struct x_mba_regs *x_mh_mba; /* virt addr of mba */ + struct x_mba_regs *x_mh_physmba; /* phys addr of mba */ + struct x_mba_device *x_mh_mbip[8]; /* what is attached to each dev */ + struct x_mba_device *x_mh_actf; /* head of queue to transfer */ + struct x_mba_device *x_mh_actl; /* tail of queue to transfer */ +}; + +/* + * Per-device structure + * (one for each RM/RP disk, and one for each tape formatter). + * + * This structure is used by the device driver as its argument + * to the massbus driver, and by the massbus driver to locate + * the device driver for a particular massbus slot. + * + * The device drivers hang ready buffers on this structure, + * and the massbus driver will start i/o on the first such buffer + * when appropriate. + */ +struct x_mba_device { + struct x_mba_driver *x_mi_driver; + x_short x_mi_unit; /* unit number to the system */ + x_short x_mi_mbanum; /* the mba it is on */ + x_short x_mi_drive; /* controller on mba */ + x_short x_mi_dk; /* driver number for iostat */ + x_short x_mi_alive; /* device exists */ + x_short x_mi_type; /* driver specific unit type */ + struct x_buf x_mi_tab; /* head of queue for this device */ + struct x_mba_device *x_mi_forw; +/* we could compute these every time, but hereby save time */ + struct x_mba_regs *x_mi_mba; + struct x_mba_drv *x_mi_drv; + struct x_mba_hd *x_mi_hd; +}; + +#define x_b_bdone x_b_bufsize /* redefinition for mi_tab XXX */ + +/* + * Tape formatter slaves are specified by + * the following information which is used + * at boot time to initialize the tape driver + * internal tables. + */ +struct x_mba_slave { + struct x_mba_driver *x_ms_driver; + x_short x_ms_ctlr; /* which of several formatters */ + x_short x_ms_unit; /* which unit to system */ + x_short x_ms_slave; /* which slave to formatter */ + x_short x_ms_alive; +}; + +/* + * Per device-type structure. + * + * Each massbus driver defines entries for a set of routines used + * by the massbus driver, as well as an array of types which are + * acceptable to it. + */ +struct x_mba_driver { + x_int (*x_md_attach)(); /* attach a device */ + x_int (*x_md_slave)(); /* attach a slave */ + x_int (*x_md_ustart)(); /* unit start routine */ + x_int (*x_md_start)(); /* setup a data transfer */ + x_int (*x_md_dtint)(); /* data transfer complete */ + x_int (*x_md_ndint)(); /* non-data transfer interrupt */ + x_short *x_md_type; /* array of drive type codes */ + char *x_md_dname, *x_md_sname; /* device, slave names */ + struct x_mba_device **x_md_info; /* backpointers to mbinit structs */ +}; + +/* + * Possible return values from unit start routines. + */ +#define x_MBU_NEXT 0 /* skip to next operation */ +#define x_MBU_BUSY 1 /* dual port busy; wait for intr */ +#define x_MBU_STARTED 2 /* non-data transfer started */ +#define x_MBU_DODATA 3 /* data transfer ready; start mba */ + +/* + * Possible return values from data transfer interrupt handling routines + */ +#define x_MBD_DONE 0 /* data transfer complete */ +#define x_MBD_RETRY 1 /* error occurred, please retry */ +#define x_MBD_RESTARTED 2 /* driver restarted i/o itself */ +#define x_MBD_REPOSITION 3 /* driver started unit, not transfer */ + +/* + * Possible return values from non-data-transfer interrupt handling routines + */ +#define x_MBN_DONE 0 /* non-data transfer complete */ +#define x_MBN_RETRY 1 /* failed; retry the operation */ +#define x_MBN_SKIP 2 /* don't do anything */ + +/* + * Clear attention status for specified device. + */ +#define x_mbclrattn(x_mi) ((x_mi)->x_mi_mba->x_mba_drv[0].x_mbd_as = 1 << (x_mi)->x_mi_drive) + +/* + * Kernel definitions related to mba. + */ +#ifdef x_KERNEL +x_int x_nummba; +#if x_NMBA > 0 +struct x_mba_hd x_mba_hd[x_NMBA]; +/*extern Xmba0int(), Xmba1int(), Xmba2int(), Xmba3int();*/ + +extern struct x_mba_device x_mbdinit[]; +extern struct x_mba_slave x_mbsinit[]; +#endif +#endif + +#endif diff --git a/x_include/vaxmba/x_mtreg.h b/x_include/vaxmba/x_mtreg.h new file mode 100644 index 0000000..a20c74b --- /dev/null +++ b/x_include/vaxmba/x_mtreg.h @@ -0,0 +1,138 @@ +#include "x_.h" + +#ifndef x__VAXMBA_MTREG_H_ +#define x__VAXMBA_MTREG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)mtreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * TU78 registers. + */ + +struct x_mtdevice { + x_int x_mtcs; /* control status register */ + x_int x_mter; /* error register */ + x_int x_mtca; /* command address, rec cnt, skp cnt reg */ + x_int x_mtmr1; /* maintenance register */ + x_int x_mtas; /* attention summary register */ + x_int x_mtbc; /* byte count register */ + x_int x_mtdt; /* drive type register */ + x_int x_mtds; /* drive status register */ + x_int x_mtsn; /* serial number register */ + x_int x_mtmr2; /* maintenance register */ + x_int x_mtmr3; /* maintenance register */ + x_int x_mtner; /* non-data transfer error register */ + x_int x_mtncs[4]; /* non-data transfer command registers */ + x_int x_mtia; /* internal address */ + x_int x_mtid; /* internal data */ +}; + +/* mtcs */ +#define x_MT_GO 000001 /* go bit */ +#define x_MT_NOOP 000002 /* no operation */ +#define x_MT_UNLOAD 000004 /* unload tape */ +#define x_MT_REW 000006 /* rewind */ +#define x_MT_SENSE 000010 /* sense */ +#define x_MT_DSE 000012 /* data security erase */ +#define x_MT_WTMPE 000014 /* write phase encoded tape mark */ +#define x_MT_WTM x_MT_WTMPE /* generic write tape mark */ +#define x_MT_WTMGCR 000016 /* write GCR tape mark */ +#define x_MT_SFORW 000020 /* space forward record */ +#define x_MT_SREV 000022 /* space reverse record */ +#define x_MT_SFORWF 000024 /* space forward file */ +#define x_MT_SREVF 000026 /* space reverse file */ +#define x_MT_SFORWE 000030 /* space forward either */ +#define x_MT_SREVE 000032 /* space reverse either */ +#define x_MT_ERGPE 000034 /* erase tape, set PE */ +#define x_MT_ERASE x_MT_ERGPE /* generic erase tape */ +#define x_MT_ERGGCR 000036 /* erase tape, set GCR */ +#define x_MT_CLSPE 000040 /* close file PE */ +#define x_MT_CLS x_MT_CLSPE /* generic close file */ +#define x_MT_CLSGCR 000042 /* close file GCR */ +#define x_MT_SLEOT 000044 /* space to logical EOT */ +#define x_MT_SFLEOT 000046 /* space forward file, stop on LEOT */ +#define x_MT_WCHFWD 000050 /* write check forward */ +#define x_MT_WCHREV 000056 /* write check reverse */ +#define x_MT_WRITEPE 000060 /* write phase encoded */ +#define x_MT_WRITE x_MT_WRITEPE /* generic write */ +#define x_MT_WRITEGCR 000062 /* write group coded */ +#define x_MT_READ 000070 /* read forward */ +#define x_MT_EXSNS 000072 /* read extended sense error log */ +#define x_MT_READREV 000076 /* read reverse */ +#define x_MT_GCR 000002 /* make generic ops GCR ops */ + +/* mtds */ +#define x_MTDS_RDY 0100000 /* tape ready */ +#define x_MTDS_PRES 0040000 /* tape unit has power */ +#define x_MTDS_ONL 0020000 /* online */ +#define x_MTDS_REW 0010000 /* tape rewinding */ +#define x_MTDS_PE 0004000 /* tape set for phase encoded */ +#define x_MTDS_BOT 0002000 /* tape at BOT */ +#define x_MTDS_EOT 0001000 /* tape at EOT */ +#define x_MTDS_FPT 0000400 /* write protected */ +#define x_MTDS_AVAIL 0000200 /* unit available */ +#define x_MTDS_SHR 0000100 /* unit is shared */ +#define x_MTDS_MAINT 0000040 /* maintenance mode */ +#define x_MTDS_DSE 0000020 /* DSE in progress */ + +#define x_MTDS_BITS \ +"\10\20RDY\17PRES\16ONL\15REW\14PE\13BOT\12EOT\11FPT\10AVAIL\ +\7x_SHR\6x_MAINT\5Dx_SE" + +/* mter */ +#define x_MTER_INTCODE 0377 /* mask for interrupt code */ +#define x_MTER_FAILCODE 0176000 /* failure code */ + +/* interrupt codes */ +#define x_MTER_DONE 001 /* operation complete */ +#define x_MTER_TM 002 /* unexpected tape mark */ +#define x_MTER_BOT 003 /* unexpected BOT detected */ +#define x_MTER_EOT 004 /* tape positioned beyond EOT */ +#define x_MTER_LEOT 005 /* unexpected LEOT detected */ +#define x_MTER_NOOP 006 /* no-op completed */ +#define x_MTER_RWDING 007 /* rewinding */ +#define x_MTER_FPT 010 /* write protect error */ +#define x_MTER_NOTRDY 011 /* not ready */ +#define x_MTER_NOTAVL 012 /* not available */ +#define x_MTER_OFFLINE 013 /* offline */ +#define x_MTER_NONEX 014 /* unit does not exist */ +#define x_MTER_NOTCAP 015 /* not capable */ +#define x_MTER_ONLINE 017 /* tape came online */ +#define x_MTER_LONGREC 020 /* long tape record */ +#define x_MTER_SHRTREC 021 /* short tape record */ +#define x_MTER_RETRY 022 /* retry */ +#define x_MTER_RDOPP 023 /* read opposite */ +#define x_MTER_UNREAD 024 /* unreadable */ +#define x_MTER_ERROR 025 /* error */ +#define x_MTER_EOTERR 026 /* EOT error */ +#define x_MTER_BADTAPE 027 /* tape position lost */ +#define x_MTER_TMFLTA 030 /* TM fault A */ +#define x_MTER_TUFLTA 031 /* TU fault A */ +#define x_MTER_TMFLTB 032 /* TM fault B */ +#define x_MTER_MBFLT 034 /* Massbus fault */ +#define x_MTER_KEYFAIL 077 /* keypad entry error */ + +/* mtdt */ +#define x_MTDT_NSA 0100000 /* not sector addressed; always 1 */ +#define x_MTDT_TAP 0040000 /* tape; always 1 */ +#define x_MTDT_MOH 0020000 /* moving head; always 0 */ +#define x_MTDT_7CH 0010000 /* 7 channel; always 0 */ +#define x_MTDT_DRQ 0004000 /* drive request required */ +#define x_MTDT_SPR 0002000 /* slave present; always 1 ??? */ +/* bit 9 is spare */ +/* bits 8-0 are formatter/transport type */ + +/* mtid */ +#define x_MTID_RDY 0100000 /* controller ready */ +#define x_MTID_CLR 0040000 /* controller clear */ + +#define x_b_repcnt x_b_bcount +#define x_b_command x_b_resid + +#endif diff --git a/x_include/vaxuba/x_adreg.h b/x_include/vaxuba/x_adreg.h new file mode 100644 index 0000000..2190783 --- /dev/null +++ b/x_include/vaxuba/x_adreg.h @@ -0,0 +1,38 @@ +#include "x_.h" + +#ifndef x__VAXUBA_ADREG_H_ +#define x__VAXUBA_ADREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)adreg.h 7.1 (Berkeley) 6/5/86 + */ + +struct x_addevice { + x_short x_ad_csr; /* Control status register */ + x_short x_ad_data; /* Data buffer */ +}; + +#define x_AD_CHAN x_ADIOSCHAN +#define x_AD_READ x_ADIOGETW +#define x_ADIOSCHAN x__IOW(x_a, 0, x_int) /* set channel */ +#define x_ADIOGETW x__IOR(x_a, 1, x_int) /* read one word */ + +/* + * Unibus CSR register bits + */ + +#define x_AD_START 01 +#define x_AD_SCHMITT 020 +#define x_AD_CLOCK 040 +#define x_AD_IENABLE 0100 +#define x_AD_DONE 0200 +#define x_AD_INCENABLE 040000 +#define x_AD_ERROR 0100000 + +#endif diff --git a/x_include/vaxuba/x_dhreg.h b/x_include/vaxuba/x_dhreg.h new file mode 100644 index 0000000..8709895 --- /dev/null +++ b/x_include/vaxuba/x_dhreg.h @@ -0,0 +1,62 @@ +#include "x_.h" + +#ifndef x__VAXUBA_DHREG_H_ +#define x__VAXUBA_DHREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)dhreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * DH-11 device register definitions. + */ +struct x_dhdevice { + union { + x_short x_dhcsr; /* control-status register */ + char x_dhcsrl; /* low byte for line select */ + } x_un; + x_short x_dhrcr; /* receive character register */ + x_short x_dhlpr; /* line parameter register */ + x_u_short x_dhcar; /* current address register */ + x_short x_dhbcr; /* byte count register */ + x_u_short x_dhbar; /* buffer active register */ + x_short x_dhbreak; /* break control register */ + x_short x_dhsilo; /* silo status register */ +}; + +/* Bits in dhcsr */ +#define x_DH_TI 0100000 /* transmit interrupt */ +#define x_DH_SI 0040000 /* storage interrupt */ +#define x_DH_TIE 0020000 /* transmit interrupt enable */ +#define x_DH_SIE 0010000 /* storage interrupt enable */ +#define x_DH_MC 0004000 /* master clear */ +#define x_DH_NXM 0002000 /* non-existant memory */ +#define x_DH_MM 0001000 /* maintenance mode */ +#define x_DH_CNI 0000400 /* clear non-existant memory interrupt */ +#define x_DH_RI 0000200 /* receiver interrupt */ +#define x_DH_RIE 0000100 /* receiver interrupt enable */ + +/* Bits in dhlpr */ +#define x_BITS6 01 +#define x_BITS7 02 +#define x_BITS8 03 +#define x_TWOSB 04 +#define x_PENABLE 020 +/* DEC manuals incorrectly say this bit causes generation of even parity. */ +#define x_OPAR 040 +#define x_HDUPLX 040000 + +#define x_DH_IE (x_DH_TIE|x_DH_SIE|x_DH_RIE) + +/* Bits in dhrcr */ +#define x_DH_PE 0010000 /* parity error */ +#define x_DH_FE 0020000 /* framing error */ +#define x_DH_DO 0040000 /* data overrun */ + +#endif diff --git a/x_include/vaxuba/x_dhureg.h b/x_include/vaxuba/x_dhureg.h new file mode 100644 index 0000000..b9aaf00 --- /dev/null +++ b/x_include/vaxuba/x_dhureg.h @@ -0,0 +1,148 @@ +#include "x_.h" + +#ifndef x__VAXUBA_DHUREG_H_ +#define x__VAXUBA_DHUREG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)dhureg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * DHU-11 device register definitions. + */ +struct x_dhudevice { + union { + x_short x_csr; /* control-status register */ + struct { + char x_csrl; /* low byte for line select */ + char x_csrh; /* high byte for tx line */ + } x_cb; + } x_un1; +#define x_dhucsr x_un1.x_csr +#define x_dhucsrl x_un1.x_cb.x_csrl +#define x_dhucsrh x_un1.x_cb.x_csrh + union { + x_short x_rbuf; /* recv.char/ds.change register (R) */ + x_short x_timo; /* delay between recv -> intr (W) */ + } x_un2; +#define x_dhurbuf x_un2.x_rbuf +#define x_dhutimo x_un2.x_timo + x_short x_dhulpr; /* line parameter register */ + union { + char x_fbyte[1]; /* fifo data byte (low byte only) (W) */ + x_short x_fdata; /* fifo data word (W) */ + char x_sbyte[2]; /* line status/fifo size (R) */ + } x_un3; +#define x_dhubyte x_un3.x_fbyte[0] +#define x_dhufifo x_un3.x_fdata +#define x_dhusize x_un3.x_sbyte[0] +#define x_dhustat x_un3.x_sbyte[1] + x_short x_dhulcr; /* line control register */ + x_short x_dhubar1; /* buffer address register 1 */ + char x_dhubar2; /* buffer address register 2 */ + char x_dhulcr2; /* xmit enable bit */ + x_short x_dhubcr; /* buffer count register */ +}; + +/* Bits in dhucsr */ +#define x_DHU_CS_TIE 0x4000 /* transmit interrupt enable */ +#define x_DHU_CS_DFAIL 0x2000 /* diagnostic fail */ +#define x_DHU_CS_RI 0x0080 /* receiver interrupt */ +#define x_DHU_CS_RIE 0x0040 /* receiver interrupt enable */ +#define x_DHU_CS_MCLR 0x0020 /* master clear */ +#define x_DHU_CS_SST 0x0010 /* skip self test (with DHU_CS_MCLR) */ +#define x_DHU_CS_IAP 0x000f /* indirect address pointer */ + +#define x_DHU_IE (x_DHU_CS_TIE|x_DHU_CS_RIE) + +/* map unit into iap register select */ +#define x_DHU_SELECT(x_unit) ((x_unit) & x_DHU_CS_IAP) + +/* Transmitter bits in high byte of dhucsr */ +#define x_DHU_CSH_TI 0x80 /* transmit interrupt */ +#define x_DHU_CSH_NXM 0x10 /* transmit dma err: non-exist-mem */ +#define x_DHU_CSH_TLN 0x0f /* transmit line number */ + +/* map csrh line bits into line */ +#define x_DHU_TX_LINE(x_csrh) ((x_csrh) & x_DHU_CSH_TLN) + +/* Bits in dhurbuf */ +#define x_DHU_RB_VALID 0x8000 /* data valid */ +#define x_DHU_RB_STAT 0x7000 /* status bits */ +#define x_DHU_RB_DO 0x4000 /* data overrun */ +#define x_DHU_RB_FE 0x2000 /* framing error */ +#define x_DHU_RB_PE 0x1000 /* parity error */ +#define x_DHU_RB_RLN 0x0f00 /* receive line number */ +#define x_DHU_RB_RDS 0x00ff /* receive data/status */ +#define x_DHU_RB_DIAG 0x0001 /* if DHU_RB_STAT -> diag vs modem */ + +/* map rbuf line bits into line */ +#define x_DHU_RX_LINE(x_rbuf) (((x_rbuf) & x_DHU_RB_RLN) >> 8) + +/* Bits in dhulpr */ +#define x_DHU_LP_TSPEED 0xf000 +#define x_DHU_LP_RSPEED 0x0f00 +#define x_DHU_LP_TWOSB 0x0080 +#define x_DHU_LP_EPAR 0x0040 +#define x_DHU_LP_PENABLE 0x0020 +#define x_DHU_LP_BITS8 0x0018 +#define x_DHU_LP_BITS7 0x0010 +#define x_DHU_LP_BITS6 0x0008 + +/* Bits in dhustat */ +#define x_DHU_ST_DSR 0x80 /* data set ready */ +#define x_DHU_ST_RI 0x20 /* ring indicator */ +#define x_DHU_ST_DCD 0x10 /* carrier detect */ +#define x_DHU_ST_CTS 0x04 /* clear to send */ +#define x_DHU_ST_DHU 0x01 /* always one on a dhu, zero on dhv */ + +/* Bits in dhulcr */ +#define x_DHU_LC_RTS 0x1000 /* request to send */ +#define x_DHU_LC_DTR 0x0200 /* data terminal ready */ +#define x_DHU_LC_MODEM 0x0100 /* modem control enable */ +#define x_DHU_LC_MAINT 0x00c0 /* maintenance mode */ +#define x_DHU_LC_FXOFF 0x0020 /* force xoff */ +#define x_DHU_LC_OAUTOF 0x0010 /* output auto flow */ +#define x_DHU_LC_BREAK 0x0008 /* break control */ +#define x_DHU_LC_RXEN 0x0004 /* receiver enable */ +#define x_DHU_LC_IAUTOF 0x0002 /* input auto flow */ +#define x_DHU_LC_TXABORT 0x0001 /* transmitter abort */ + +/* Bits in dhulcr2 */ +#define x_DHU_LC2_TXEN 0x80 /* transmitter enable */ + +/* Bits in dhubar2 */ +#define x_DHU_BA2_DMAGO 0x80 /* transmit dma start */ +#define x_DHU_BA2_XBA 0x03 /* top two bits of dma address */ +#define x_DHU_XBA_SHIFT 16 /* amount to shift xba bits */ + +/* Bits for dhumctl only: stat bits are shifted up 16 */ +#define x_DHU_ON (x_DHU_LC_DTR|x_DHU_LC_RTS|x_DHU_LC_MODEM) +#define x_DHU_OFF x_DHU_LC_MODEM + +#define x_DHU_DSR (x_DHU_ST_DSR << 16) +#define x_DHU_RNG (x_DHU_ST_RI << 16) +#define x_DHU_CAR (x_DHU_ST_DCD << 16) +#define x_DHU_CTS (x_DHU_ST_CTS << 16) + +#define x_DHU_RTS x_DHU_LC_RTS +#define x_DHU_DTR x_DHU_LC_DTR +#define x_DHU_BRK x_DHU_LC_BREAK +#define x_DHU_LE x_DHU_LC_MODEM + +/* bits in dm lsr, copied from dmreg.h */ +#define x_DML_DSR 0000400 /* data set ready, not a real DM bit */ +#define x_DML_RNG 0000200 /* ring */ +#define x_DML_CAR 0000100 /* carrier detect */ +#define x_DML_CTS 0000040 /* clear to send */ +#define x_DML_SR 0000020 /* secondary receive */ +#define x_DML_ST 0000010 /* secondary transmit */ +#define x_DML_RTS 0000004 /* request to send */ +#define x_DML_DTR 0000002 /* data terminal ready */ +#define x_DML_LE 0000001 /* line enable */ + +#endif diff --git a/x_include/vaxuba/x_dmfreg.h b/x_include/vaxuba/x_dmfreg.h new file mode 100644 index 0000000..c4a9c9d --- /dev/null +++ b/x_include/vaxuba/x_dmfreg.h @@ -0,0 +1,156 @@ +#include "x_.h" + +#ifndef x__VAXUBA_DMFREG_H_ +#define x__VAXUBA_DMFREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)dmfreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * DMF-32 definitions. + */ + +/* + * "dmf" (unqualified) refers to the async portion of the dmf32, + * "dmfc" to the combo portion, + * "dmfs" to the sync portion, + * "dmfl" to the lp portion, and + * "dmfd" to the dr portion. + */ +struct x_dmfdevice { + x_short x_dmfccsr0; /* combo csr 0 */ + x_short x_dmfccsr1; /* combo csr 1 */ + x_short x_dmfs[4]; + x_short x_dmfcsr; /* control-status register */ + x_short x_dmflpr; /* line parameter register */ + x_short x_dmfrbuf; /* receiver buffer (ro) */ + union { + x_u_short x_dmfirw; /* indirect register word */ + x_u_char x_dmfirc[2]; /* " " bytes */ + } x_dmfun; + x_short x_dmfl_ctrl; /* line printer control register */ + x_short x_dmfl_indrct; /* line printer indirect register */ + x_short x_dmfd[4]; /* for dr11 (not implemented) */ +}; + +#define x_dmfrsp x_dmfrbuf /* receive silo parameter register (wo) */ +#define x_dmftbuf x_dmfun.x_dmfirc[0] /* transmit buffer */ +#define x_dmftsc x_dmfun.x_dmfirc[0] /* transmit silo count */ +#define x_dmfrms x_dmfun.x_dmfirc[1] /* receive modem status */ +#define x_dmflctms x_dmfun.x_dmfirw /* line control, transmit modem status */ +#define x_dmftba x_dmfun.x_dmfirw /* transmit buffer address */ +#define x_dmftcc x_dmfun.x_dmfirw /* transmit character count */ + +/* bits in dmfcsr */ +#define x_DMF_TI 0100000 /* transmit interrupt */ +#define x_DMF_TIE 0040000 /* transmit interrupt enable */ +#define x_DMF_NXM 0020000 /* non-existant memory */ +#define x_DMF_LIN 0003400 /* transmit line number */ +#define x_DMF_RI 0000200 /* receiver interrupt */ +#define x_DMF_RIE 0000100 /* receiver interrupt enable */ +#define x_DMF_CLR 0000040 /* master reset */ +#define x_DMF_IAD 0000037 /* indirect address register */ + +#define x_DMFIR_TBUF 000 /* select tbuf indirect register */ +#define x_DMFIR_LCR 010 /* select lcr indirect register */ +#define x_DMFIR_TBA 020 /* select tba indirect register */ +#define x_DMFIR_TCC 030 /* select tcc indirect register */ + +/* bits in dmflpr */ +#define x_BITS6 (01<<3) +#define x_BITS7 (02<<3) +#define x_BITS8 (03<<3) +#define x_TWOSB 0200 +#define x_PENABLE 040 +#define x_EPAR 0100 + +#define x_DMF_IE (x_DMF_TIE|x_DMF_RIE) + +#define x_DMF_SILOCNT 32 /* size of DMF output silo (per line) */ + +/* bits in dmfrbuf */ +#define x_DMF_DSC 0004000 /* data set change */ +#define x_DMF_PE 0010000 /* parity error */ +#define x_DMF_FE 0020000 /* framing error */ +#define x_DMF_DO 0040000 /* data overrun */ + +/* bits in dmfrms */ +#define x_DMF_USRR 0004 /* user modem signal (pin 25) */ +#define x_DMF_SR 0010 /* secondary receive */ +#define x_DMF_CTS 0020 /* clear to send */ +#define x_DMF_CAR 0040 /* carrier detect */ +#define x_DMF_RNG 0100 /* ring */ +#define x_DMF_DSR 0200 /* data set ready */ + +/* bits in dmftms */ +#define x_DMF_USRW 0001 /* user modem signal (pin 18) */ +#define x_DMF_DTR 0002 /* data terminal ready */ +#define x_DMF_RATE 0004 /* data signal rate select */ +#define x_DMF_ST 0010 /* secondary transmit */ +#define x_DMF_RTS 0020 /* request to send */ +#define x_DMF_BRK 0040 /* pseudo break bit */ +#define x_DMF_PREEMPT 0200 /* preempt output */ + +/* flags for modem control */ +#define x_DMF_ON (x_DMF_DTR|x_DMF_RTS) +#define x_DMF_OFF 0 + +/* bits in dmflctms */ +#define x_DMF_MIE 0040 /* modem interrupt enable */ +#define x_DMF_FLUSH 0020 /* flush transmit silo */ +#define x_DMF_RBRK 0010 /* real break bit */ +#define x_DMF_RE 0004 /* receive enable */ +#define x_DMF_AUTOX 0002 /* auto XON/XOFF */ +#define x_DMF_TE 0001 /* transmit enable */ + +#define x_DMFLCR_ENA (x_DMF_MIE|x_DMF_RE|x_DMF_TE) + +/* bits in dm lsr, copied from dh.c */ +#define x_DML_USR 0001000 /* usr modem sig, not a real DM bit */ +#define x_DML_DSR 0000400 /* data set ready, not a real DM bit */ +#define x_DML_RNG 0000200 /* ring */ +#define x_DML_CAR 0000100 /* carrier detect */ +#define x_DML_CTS 0000040 /* clear to send */ +#define x_DML_SR 0000020 /* secondary receive */ +#define x_DML_ST 0000010 /* secondary transmit */ +#define x_DML_RTS 0000004 /* request to send */ +#define x_DML_DTR 0000002 /* data terminal ready */ +#define x_DML_LE 0000001 /* line enable */ + +/* dmf line printer csr def */ +#define x_DMFL_PEN (1<<0) /* print enable */ +#define x_DMFL_RESET (1<<1) /* master reset */ +#define x_DMFL_FORMAT (1<<2) /* format control */ +#define x_DMFL_UNUSED (3<<3) +#define x_DMFL_MAINT (1<<5) /* maintenance mode on */ +#define x_DMFL_IE (1<<6) /* intr enable */ +#define x_DMFL_PDONE (1<<7) /* print done bit */ +#define x_DMFL_INDIR (7<<8) /* indirect reg */ +#define x_DMFL_UNUSED2 (1<<11) +#define x_DMFL_CONV (1<<12) /* connect verify */ +#define x_DMFL_DAVRDY (1<<13) /* davfu ready */ +#define x_DMFL_OFFLINE (1<<14) /* printer offline */ +#define x_DMFL_DMAERR (1<<15) /* dma error bit */ +#define x_DMFL_BUFSIZ 512 /* max chars per dma */ +#define x_DMFL_DEFCOLS 132 /* default # of cols/line <=255 */ +#define x_DMFL_DEFLINES 66 /* default # of lines/page <=255 */ +#define x_DMFL_OPTIONS ((1 << 8) | (1 << 9) | (1 << 15)) + /* auto cr, real ff, no lower to upper */ + +/* + * Bits in the configuration register + */ +#define x_DMFC_CONFMASK 0xf000 /* picks off the configuration bits */ +#define x_DMFC_DR 0x1000 /* DR11 parallel interface */ +#define x_DMFC_LP 0x2000 /* LP dma parallel lineprinter i'face */ +#define x_DMFC_SYNC 0x4000 /* Synchronous serial interface */ +#define x_DMFC_ASYNC 0x8000 /* 8 Serial ports */ + +#endif diff --git a/x_include/vaxuba/x_dmreg.h b/x_include/vaxuba/x_dmreg.h new file mode 100644 index 0000000..e297ee5 --- /dev/null +++ b/x_include/vaxuba/x_dmreg.h @@ -0,0 +1,50 @@ +#include "x_.h" + +#ifndef x__VAXUBA_DMREG_H_ +#define x__VAXUBA_DMREG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)dmreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * DM-11 device register definitions. + */ +struct x_dmdevice { + x_short x_dmcsr; /* control status register */ + x_short x_dmlstat; /* line status register */ + x_short x_dmpad1[2]; +}; + +/* bits in dm csr */ +#define x_DM_RF 0100000 /* ring flag */ +#define x_DM_CF 0040000 /* carrier flag */ +#define x_DM_CTS 0020000 /* clear to send */ +#define x_DM_SRF 0010000 /* secondary receive flag */ +#define x_DM_CS 0004000 /* clear scan */ +#define x_DM_CM 0002000 /* clear multiplexor */ +#define x_DM_MM 0001000 /* maintenance mode */ +#define x_DM_STP 0000400 /* step */ +#define x_DM_DONE 0000200 /* scanner is done */ +#define x_DM_IE 0000100 /* interrupt enable */ +#define x_DM_SE 0000040 /* scan enable */ +#define x_DM_BUSY 0000020 /* scan busy */ + +/* bits in dm lsr */ +#define x_DML_RNG 0000200 /* ring */ +#define x_DML_CAR 0000100 /* carrier detect */ +#define x_DML_CTS 0000040 /* clear to send */ +#define x_DML_SR 0000020 /* secondary receive */ +#define x_DML_ST 0000010 /* secondary transmit */ +#define x_DML_RTS 0000004 /* request to send */ +#define x_DML_DTR 0000002 /* data terminal ready */ +#define x_DML_LE 0000001 /* line enable */ + +#define x_DML_ON (x_DML_DTR|x_DML_RTS|x_DML_LE) +#define x_DML_OFF (x_DML_LE) + +#endif diff --git a/x_include/vaxuba/x_dmzreg.h b/x_include/vaxuba/x_dmzreg.h new file mode 100644 index 0000000..55c5d68 --- /dev/null +++ b/x_include/vaxuba/x_dmzreg.h @@ -0,0 +1,153 @@ +#include "x_.h" + +#ifndef x__VAXUBA_DMZREG_H_ +#define x__VAXUBA_DMZREG_H_ + +#include + +/* + * Copyright (c) 1985, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)dmzreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * HISTORY + * 23-Apr-85 Joe Camaratta (jcc) at Siemens RTL + * Header file for DEC's DMZ32 + */ + +struct x_dmzdevice { + x_short x_dmz_config; /* configuration cntl and status register */ + x_short x_dmz_diag; /* diagnostic control and status register */ + struct { + x_short x_octet_csr; /* octet control and status */ + x_short x_octet_lprm; /* line parameter */ + union{ + x_short x_octet_rb; /* receiver buffer */ + x_short x_octet_rsp; /* receive silo parameter */ + } x_octet_receive; + union{ + x_u_short x_word; /* word */ + x_u_char x_bytes[2]; /* bytes */ + } x_octet_ir; /* indirect registers */ + } x_octet[3]; + x_short x_dmz_unused[2]; +}; + +#define x_octet_sato x_octet_rsp + +/* aliases for asynchronous indirect control registers */ +#define x_IR_TBUF 000 /* transmit character */ +#define x_IR_RMSTSC 000 /* receive modem status, transmit silo count */ +#define x_IR_LCTMR 010 /* line control and transmit modem */ +#define x_IR_TBA 020 /* transmit buffer address register */ +#define x_IR_TCC 030 /* transmit character count (DMA) */ + +#define x_octet_tbf x_octet_ir.x_bytes[0] /* transmit buffer */ +#define x_octet_tbf2 x_octet_ir.x_word /* transmit buffer, 2 chars */ +#define x_octet_rmstsc x_octet_ir.x_word /* rcv modem status, xmit silo count */ +#define x_octet_lctmr x_octet_ir.x_word /* line control, xmit modem */ +#define x_octet_tba x_octet_ir.x_word /* transmit buffer address */ +#define x_octet_tcc x_octet_ir.x_word /* transmit character count */ + +/* bits in octet_csr */ +#define x_DMZ_TRDY 0100000 /* transmit ready */ +#define x_DMZ_TIE 0040000 /* transmit interrupt enable */ +#define x_DMZ_NXM 0030000 /* non-existant memory */ +#define x_DMZ_LIN 0003400 /* transmit line number */ +#define x_DMZ_RRDY 0000200 /* receiver data available */ +#define x_DMZ_RIE 0000100 /* receiver interrupt enable */ +#define x_DMZ_RESET 0000040 /* master reset */ +#define x_DMZ_IAD 0000037 /* indirect address register */ + +#define x_DMZ_IE (x_DMZ_TIE | x_DMZ_RIE) /* enable transmit and receive */ + +/* bits in octet_lprm (taken from dmfreg.h) */ +#define x_DMZ_6BT 0010 /* 6 bits per character */ +#define x_DMZ_7BT 0020 /* 7 bits per character */ +#define x_DMZ_8BT 0030 /* 8 bits per character */ +#define x_DMZ_PEN 0040 /* parity enable */ +#define x_DMZ_EPR 0100 /* even parity */ +#define x_DMZ_SCD 0200 /* stop code */ +#define x_DMZ_XTE 0170000 /* transmit rate */ +#define x_DMZ_RRT 0007400 /* receive rate */ +#define x_DMZ_LSL 0000007 /* line select */ + +/* baud rates */ +#define x_BR_50 000 +#define x_BR_75 001 +#define x_BR_110 002 +#define x_BR_134_5 003 +#define x_BR_150 004 +#define x_BR_300 005 +#define x_BR_600 006 +#define x_BR_1200 007 +#define x_BR_1800 010 +#define x_BR_2000 011 +#define x_BR_2400 012 +#define x_BR_3600 013 +#define x_BR_4800 014 +#define x_BR_7200 015 +#define x_BR_9600 016 +#define x_BR_19200 017 + +/* bits in octet_rb (taken from dmfreg.h) */ +#define x_DMZ_DSC 0004000 /* data set change */ +#define x_DMZ_PE 0010000 /* parity error */ +#define x_DMZ_FE 0020000 /* framing error */ +#define x_DMZ_DO 0040000 /* data overrun */ +#define x_DMZ_DV 0100000 /* data valid */ +#define x_DMZ_RL 0003400 /* line */ +#define x_DMZ_RD 0000377 /* data */ +#define x_DMZ_AT 0000377 /* alarm timeout */ + +/* bits in dmz_rmstsc */ +#define x_DMZ_TSC 0x00ff /* transmit silo count */ +#define x_DMZ_USRR 0x0400 /* user modem signal (pin 25) */ +#define x_DMF_SR 0x0800 /* secondary receive */ +#define x_DMZ_CTS 0x1000 /* clear to send */ +#define x_DMZ_CAR 0x2000 /* carrier detect */ +#define x_DMZ_RNG 0x4000 /* ring */ +#define x_DMZ_DSR 0x8000 /* data set ready */ + +/* bits in dmz_lctmr (tms half) */ +#define x_DMZ_USRW 0x0100 /* user modem signal (pin 18) */ +#define x_DMZ_DTR 0x0200 /* data terminal ready */ +#define x_DMZ_RATE 0x0400 /* data signal rate select */ +#define x_DMF_ST 0x0800 /* secondary transmit */ +#define x_DMZ_RTS 0x1000 /* request to send */ +#define x_DMZ_PREEMPT 0x8000 /* preempt output */ + +/* bits in octet_lctmr (lc half) */ +#define x_DMZ_MIE 0040 /* modem interrupt enable */ +#define x_DMZ_FLS 0020 /* flush transmit silo */ +#define x_DMZ_BRK 0010 /* send break bit */ +#define x_DMZ_RE 0004 /* receive enable */ +#define x_DMZ_AUT 0002 /* auto XON/XOFF */ +#define x_DMZ_TE 0001 /* transmit enable */ +#define x_DMZ_CF 0300 /* control function */ + +#define x_DMZ_LCE (x_DMZ_MIE|x_DMZ_RE|x_DMZ_TE) +#define x_DMZ_ON (x_DMZ_DTR|x_DMZ_RTS|x_DMZ_LCE) +#define x_DMZ_OFF x_DMZ_LCE + +/* bits in octet_tcc */ +#define x_DMZ_HA 0140000 /* high address bits */ + +/* bits added to dm lsr for DMGET/DMSET */ +#define x_DML_USR 0001000 /* usr modem sig, not a real DM bit */ +#define x_DML_DSR 0000400 /* data set ready, not a real DM bit */ + +#define x_DMZ_SIZ 32 /* size of DMZ output silo (per line) */ + +#define x_DMZ(x_a) (x_a/24) +#define x_OCTET(x_a) ((x_a%24)/8) +#define x_LINE(x_a) ((x_a%24)%8) + +#define x_DMZ_NOC_MASK 03 +#define x_DMZ_INTERFACE 000 + +#endif diff --git a/x_include/vaxuba/x_dzreg.h b/x_include/vaxuba/x_dzreg.h new file mode 100644 index 0000000..42f9e9f --- /dev/null +++ b/x_include/vaxuba/x_dzreg.h @@ -0,0 +1,96 @@ +#include "x_.h" + +#ifndef x__VAXUBA_DZREG_H_ +#define x__VAXUBA_DZREG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)dzreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * DZ-11/DZ-32 Registers and bits. + */ +struct x_dzdevice { + x_short x_dzcsr; + x_short x_dzrbuf; + union { + struct { + char x_dztcr0; + char x_dzdtr0; + char x_dztbuf0; + char x_dzbrk0; + } x_dz11; + struct { + x_short x_dzlcs0; + char x_dztbuf0; + char x_dzlnen0; + } x_dz32; + } x_dzun; +}; + +#define x_dzlpr x_dzrbuf +#define x_dzmsr x_dzun.x_dz11.x_dzbrk0 +#define x_dztcr x_dzun.x_dz11.x_dztcr0 +#define x_dzdtr x_dzun.x_dz11.x_dzdtr0 +#define x_dztbuf x_dzun.x_dz11.x_dztbuf0 +#define x_dzlcs x_dzun.x_dz32.x_dzlcs0 +#define x_dzbrk x_dzmsr +#define x_dzlnen x_dzun.x_dz32.x_dzlnen0 +#define x_dzmtsr x_dzun.x_dz32.x_dztbuf0 + +/* bits in dzlpr */ +#define x_BITS7 0020 +#define x_BITS8 0030 +#define x_TWOSB 0040 +#define x_PENABLE 0100 +#define x_OPAR 0200 + +/* bits in dzrbuf */ +#define x_DZ_PE 010000 +#define x_DZ_FE 020000 +#define x_DZ_DO 040000 + +/* bits in dzcsr */ +#define x_DZ_32 000001 /* DZ32 mode */ +#define x_DZ_MIE 000002 /* Modem Interrupt Enable */ +#define x_DZ_CLR 000020 /* Reset dz */ +#define x_DZ_MSE 000040 /* Master Scan Enable */ +#define x_DZ_RIE 000100 /* Receiver Interrupt Enable */ +#define x_DZ_MSC 004000 /* Modem Status Change */ +#define x_DZ_SAE 010000 /* Silo Alarm Enable */ +#define x_DZ_TIE 040000 /* Transmit Interrupt Enable */ +#define x_DZ_IEN (x_DZ_32|x_DZ_MIE|x_DZ_MSE|x_DZ_RIE|x_DZ_TIE) + +/* flags for modem-control */ +#define x_DZ_ON x_DZ_DTR +#define x_DZ_OFF 0 + +/* bits in dzlcs */ +#define x_DZ_ACK 0100000 /* ACK bit in dzlcs */ +#define x_DZ_RTS 0010000 /* Request To Send */ +#define x_DZ_ST 0004000 /* Secondary Transmit */ +#define x_DZ_BRK 0002000 /* Break */ +#define x_DZ_DTR 0001000 /* Data Terminal Ready */ +#define x_DZ_LE 0000400 /* Line Enable */ +#define x_DZ_DSR 0000200 /* Data Set Ready */ +#define x_DZ_RI 0000100 /* Ring Indicate */ +#define x_DZ_CD 0000040 /* Carrier Detect */ +#define x_DZ_CTS 0000020 /* Clear To Send */ +#define x_DZ_SR 0000010 /* Secondary Receive */ + +/* bits in dm lsr, copied from dmreg.h */ +#define x_DML_DSR 0000400 /* data set ready, not a real DM bit */ +#define x_DML_RNG 0000200 /* ring */ +#define x_DML_CAR 0000100 /* carrier detect */ +#define x_DML_CTS 0000040 /* clear to send */ +#define x_DML_SR 0000020 /* secondary receive */ +#define x_DML_ST 0000010 /* secondary transmit */ +#define x_DML_RTS 0000004 /* request to send */ +#define x_DML_DTR 0000002 /* data terminal ready */ +#define x_DML_LE 0000001 /* line enable */ + +#endif diff --git a/x_include/vaxuba/x_idcreg.h b/x_include/vaxuba/x_idcreg.h new file mode 100644 index 0000000..ab60a3d --- /dev/null +++ b/x_include/vaxuba/x_idcreg.h @@ -0,0 +1,111 @@ +#include "x_.h" + +#ifndef x__VAXUBA_IDCREG_H_ +#define x__VAXUBA_IDCREG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)idcreg.h 7.1 (Berkeley) 6/5/86 + */ + +#define x_NRB02SECT 40 /* RB02 sectors/track */ +#define x_NRB02TRK 2 /* RB02 tracks/cylinder */ +#define x_NRB02CYL 512 /* RB02 cylinders/disk */ +#define x_NRB80SECT 31 /* RB80 sectors/track */ +#define x_NRB80TRK 14 /* RB80 tracks/cylinder */ +#define x_NRB80CYL 559 /* RB80 cylinders/disk */ + +struct x_idcdevice { + x_int x_idccsr; /* control status register */ + x_int x_idcbar; /* bus address register */ + x_int x_idcbcr; /* byte count register */ + x_int x_idcdar; /* disk address register */ + x_int x_idcmpr; /* multi-purpose register */ + x_int x_idceccpos; /* ecc position register */ + x_int x_idceccpat; /* ecc pattern register */ + x_int x_idcreset; /* master reset register */ +}; + +/* idccsr */ +#define x_IDC_TOI 0x10000000 /* time out inhibit */ +#define x_IDC_ASSI 0x08000000 /* automatic skip sector inhibit */ +#define x_IDC_R80 0x04000000 /* selected disk is R80 */ +#define x_IDC_MTN 0x02000000 /* maintenance */ +#define x_IDC_IR 0x01000000 /* interrupt request */ +#define x_IDC_SSE 0x00800000 /* R80 skip sector error */ +#define x_IDC_SSEI 0x00400000 /* R80 skip sector error inhibit */ +#define x_IDC_ECS 0x00300000 /* R80 ecc status */ +#define x_IDC_ECS_NONE 0x00000000 /* no data error */ +#define x_IDC_ECS_HARD 0x00200000 /* hard ecc error */ +#define x_IDC_ECS_SOFT 0x00300000 /* soft ecc error */ +#define x_IDC_ATTN 0x000f0000 /* attention bits */ +#define x_IDC_ERR 0x00008000 /* composite error */ +#define x_IDC_DE 0x00004000 /* drive error */ +#define x_IDC_NXM 0x00002000 /* non-existant memory */ +#define x_IDC_DLT 0x00001000 /* data late */ +#define x_IDC_HNF x_IDC_DLT /* header not found */ +#define x_IDC_DCK 0x00000800 /* data check */ +#define x_IDC_OPI 0x00000400 /* operation incomplete */ +#define x_IDC_DS 0x00000300 /* drive select bits */ +#define x_IDC_CRDY 0x00000080 /* controller ready */ +#define x_IDC_IE 0x00000040 /* interrupt enable */ +#define x_IDC_FUNC 0x0000000e /* function code */ +#define x_IDC_DRDY 0x00000001 /* drive ready */ + +#define x_IDC_HARD (x_IDC_NXM|x_IDC_DE) + +#define x_IDCCSR_BITS \ +"\20\35TOI\34ASSI\33R80\32MTN\31IR\30SSE\27SSEI\26ECS1\25ECS0\24ATN3\ +\23x_ATN2\22x_ATN1\21x_ATN0\20Ex_RR\17Dx_E\16x_NXM\15Dx_LT\14Dx_CK\13x_OPI\12Dx_S1\11Dx_S0\ +\10x_CRDY\7x_IE\4x_F2\3x_F1\2x_F0\1Dx_RDY" + +/* function codes */ +#define x_IDC_NOP 000 /* no operation */ +#define x_IDC_WCHK 002 /* write check data */ +#define x_IDC_GETSTAT 004 /* get status */ +#define x_IDC_SEEK 006 /* seek */ +#define x_IDC_RHDR 010 /* read header */ +#define x_IDC_WRITE 012 /* write data */ +#define x_IDC_READ 014 /* read data */ +#define x_IDC_RNOHCHK 016 /* read data w/o header check */ + +/* idcmpr for RL02 get status command */ +#define x_IDCGS_RST 010 /* reset */ +#define x_IDCGS_GS 002 /* get status, must be 1 */ +#define x_IDCGS_M 001 /* mark, must be 1 */ +#define x_IDCGS_GETSTAT (x_IDCGS_RST|x_IDCGS_GS|x_IDCGS_M) + +/* RL02 status word */ +#define x_IDCDS_WDE 0100000 /* write data error */ +#define x_IDCDS_HCE 0040000 /* head current error */ +#define x_IDCDS_WL 0020000 /* write lock */ +#define x_IDCDS_SKTO 0010000 /* seek timeout */ +#define x_IDCDS_SPD 0004000 /* spindle error */ +#define x_IDCDS_WGE 0002000 /* write gate error */ +#define x_IDCDS_VC 0001000 /* volume check */ +#define x_IDCDS_DSE 0000400 /* drive select error */ +#define x_IDCDS_HS 0000100 /* head select */ +#define x_IDCDS_CO 0000040 /* cover open */ +#define x_IDCDS_HO 0000020 /* heads out */ +#define x_IDCDS_BH 0000010 /* brush home */ +#define x_IDCDS_STATE 0000007 /* drive state */ + +#define x_IDCRB02DS_BITS \ +"\10\20WDE\17HCE\16WL\15SKTO\14SPD\13WBE\12VC\11DSE\ +\7x_HS\6x_CO\5x_HO\4x_BH\3x_STC\2x_STB\1x_STA" + +/* R80 status word */ +#define x_IDCDS_WTP 0020000 /* write protect */ +#define x_IDCDS_DRDY 0010000 /* driver ready */ +#define x_IDCDS_ONCY 0004000 /* on cylinder */ +#define x_IDCDS_SKE 0002000 /* seek error */ +#define x_IDCDS_PLGV 0001000 /* plug valid */ +#define x_IDCDS_FLT 0000400 /* fault */ + +#define x_IDCRB80DS_BITS \ +"\10\16WTP\15DRDY\14ONCY\13SKE\12PLGV\11FLT\5SEC4\4SEC3\3SEC2\2SEC1\1SEC0" + +#endif diff --git a/x_include/vaxuba/x_ikreg.h b/x_include/vaxuba/x_ikreg.h new file mode 100644 index 0000000..7f52bd8 --- /dev/null +++ b/x_include/vaxuba/x_ikreg.h @@ -0,0 +1,124 @@ +#include "x_.h" + +#ifndef x__VAXUBA_IKREG_H_ +#define x__VAXUBA_IKREG_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ikreg.h 7.1 (Berkeley) 6/5/86 + */ + +struct x_ikdevice { + x_short x_ik_wc; /* Unibus word count reg */ + x_u_short x_ik_ubaddr; /* Unibus address register */ + x_u_short x_ik_ustat; /* Unibus status/command reg */ + x_u_short x_ik_data; /* Data register */ + x_u_short x_ik_xaddr; /* X address in frame buffer */ + x_u_short x_ik_yaddr; /* Y address in frame buffer */ + x_u_short x_ik_istat; /* Ikonas status/command reg */ + x_u_short x_ik_chan; /* Channel control register */ +}; + +#define x_IK_GETADDR x_IKIOGETADDR +#define x_IK_WAITINT x_IKIOWAITINT +#define x_IKIOGETADDR x__IOR(x_i, 0, x_caddr_t) /* get Unibus device address */ +#define x_IKIOWAITINT x__IO(x_i, 1) /* await device interrupt */ + +/* + * Unibus status/command register bits + */ + +#define x_IK_GO 01 +#define x_IK_IENABLE 0100 +#define x_IK_READY 0200 +#define x_IK_IKONAS_INTR 0100000 + +/* + * Ikonas status/command register bits + */ + +#define x_WORD32 0 +#define x_RES512 2 +#define x_RES1024 3 +#define x_READ_SELECT 0 +#define x_WRITE_MASK 010 +#define x_WRITE_SELECT 020 +#define x_HALFWORD 040 +#define x_DMAENABLE 0100 +#define x_INVISIBLE_IO 0200 +#define x_AUTOINCREMENT 0400 +#define x_RUN_PROCESSOR 01000 +#define x_CLEAR 02000 +#define x_BYTE_MODE 04000 +#define x_FRAME_ENABLE 010000 +#define x_PROC_ENABLE 020000 +#define x_RED_SELECT 0 +#define x_GREEN_SELECT 040000 +#define x_BLUE_SELECT 0100000 +#define x_ALPHA_SELECT 0140000 + +/* + * Frame buffer controller + */ + +#define x_FBC0 060000000 +#define x_FBC1 062000000 + +#define x_VIEWPORT_LOC 0 +#define x_VIEWPORT_SIZE 1 +#define x_WINDOW_LOC 2 +#define x_ZOOM 3 +#define x_DISPLAY_RATE 4 +#define x_VIDEO_CONTROL 5 +#define x_FORMAT_CONTROL_MASK 03 +#define x_CURSOR_ON 04 +#define x_LOW_RESOL 0 +#define x_HIGH_RESOL 010 +#define x_AUTO_CLEAR 040 +#define x_EXT_SYNC 0100 +#define x_COLOR_MAP_PAGES 0600 +#define x_HIGH_RESOL_SYNC 01000 +#define x_REPEAT_FIELD 02000 +#define x_PIXEL_CLOCK_RATE_MASK 077 +#define x_CURSOR_LOC 6 +#define x_CURSOR_SHADE 7 + +#define x_CURSOR_MAP 0400 + +/* + * Color map lookup table + */ + +#define x_CMAP0 040600000 +#define x_CMAP1 040610000 + +#define x_CHAN_SELECT 02000 + +/* + * Frame buffer memories + */ + +#define x_MEM0 000000000 +#define x_MEM1 004000000 + +/* + * Bit-slice processor + */ + +#define x_UMEM 040000000 +#define x_SCRPAD 040400000 +#define x_PROC 041200000 + +/* + * Frame grabber + */ + +#define x_FMG0 060200000 + +#endif diff --git a/x_include/vaxuba/x_npreg.h b/x_include/vaxuba/x_npreg.h new file mode 100644 index 0000000..effe29d --- /dev/null +++ b/x_include/vaxuba/x_npreg.h @@ -0,0 +1,476 @@ +#include "x_.h" + +#ifndef x__VAXUBA_NPREG_H_ +#define x__VAXUBA_NPREG_H_ + +#include +#include + +/* + * Copyright (c) 1986 MICOM-Interlan, Inc., Boxborough Mass + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)npreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * NPREG.H + * + * This file contain definitions of specific hardware interest + * to be used when communicating with the NI1510 Network Processor + * Board. More complete information can be found in the NI1510 + * Multibus compatible Ethernet Communications Processor Hardware + * Specification. + */ + +#define x_NNPCNN 4 /* Number of connections per board */ +#define x_NPUNIT(x_a) ((x_minor(x_a) >> 4) & 0x0F) +#define x_NPCONN(x_a) ((x_minor(x_a)) & 0x03) + +#define x_TRUE 1 +#define x_FALSE 0 + +#define x_IBOOTADDR 0xF8000l /* Addr of 80186 Boot ROM */ +#define x_INETBOOT 0xF8087l +#define x_IXEQADDR 0x400 /* Where to begin Board image XEQ */ +#define x_DIAGTIME 1200 /* Time for timeout /HZ seconds */ + +#define x_DELAYTIME 1000000L /* delay count */ +#define x_NPDELAY(x_N) {register x_int x_n = (x_N) >> 1; while(--x_n > 0); } + +/* Handy macros for talking to the Board */ + +#define x_RESET(x_x) (x_WCSR3(x_x->x_iobase,0xff)) +#define x_CLEARINT(x_x) {x_unsign16 x_y; x_y = x_RCSR2(x_x->x_iobase); } +#define x_INTNI(x_x) (x_WCSR1(x_x->x_iobase,0xFF)) + +/* Command and Status Register (CSR) Definitions */ + +/* + * CSR0 is the only direct means for data transfer between the host processor + * and the 3510. Access is controlled by the 80186 who sets the CSR1 Enable and + * Ready bits to allow writing here. Writing to this register will always + * result in an interrupt to the 80186. + */ + +/* + * Bit definitions for CSR1. + */ + +#define x_NPRFU 0x01 /* Reserved for Future Use */ +#define x_NPHOK 0x02 /* Hardware OK */ +#define x_NPLAN 0x04 /* Logic 0 indicates operational LAN exists */ +#define x_NP_IP 0x08 /* Interrupt pending from this board */ +#define x_NP_IE 0x10 /* Interrupts enabled for this board */ +#define x_NPRDR 0x20 /* Set when 80186 writes data into CSR0 */ +#define x_NPRDY 0x40 /* CSR0 ready to accept data */ +#define x_NPENB 0x80 /* CSR0 available for use by the host */ + +/* + * Bit defintions for CSR0 Command Block + */ + +#define x_NPLST 0x20 /* Last Command */ +#define x_NPCMD 0x80 /* Shared Memory Address */ +#define x_NPBGN 0x200 /* Begin Execution in On-Board Memory */ +#define x_NPCBI 0x800 /* Interrupt at completion of Command Block */ +#define x_NPDMP 0x2000 /* Dump 80186 On-Board Memory to Multibus */ +#define x_NPLD 0x8000 /* Load 80186 On-board Memory from Multibus */ + +/* + * CSR0 Count definitions. These are the lengths of the Command Blocks for the + * CSR0 commands above (not counting the Command Word itself). + */ + +#define x_LSTCNT 0 +#define x_CMDCNT 2 +#define x_BGNCNT 2 +#define x_CBICNT 1 +#define x_DMPCNT 5 +#define x_LDCNT 5 +#define x_IOCNT 5 + +/* Macros for reading and writing CSR's (Control and Status Registers) */ + +#define x_WCSR0(x_x,x_y) ((x_x)->x_CSR0 = x_y) +#define x_WCSR1(x_x,x_y) ((x_x)->x_CSR1 = x_y) +#define x_WCSR2(x_x,x_y) ((x_x)->x_CSR2 = x_y) +#define x_WCSR3(x_x,x_y) ((x_x)->x_CSR3 = x_y) + +#define x_RCSR0(x_x) ((x_x)->x_CSR0) +#define x_RCSR1(x_x) ((x_x)->x_CSR1) +#define x_RCSR2(x_x) ((x_x)->x_CSR2) +#define x_RCSR3(x_x) ((x_x)->x_CSR3) + +#define x_NPRESET 0x01 /* reset the board */ +#define x_NPSTART 0x04 /* start board execution */ +#define x_NPGPANIC 0x05 /* Get panic message */ +#define x_NPINIT 0x06 /* initialize software on board */ +#define x_NPSTATS 0x07 +#define x_NPRCSR0 0x08 /* read CSR0 */ +#define x_NPRCSR1 0x09 /* read CSR1 */ +#define x_NPRCSR2 0x0a /* read CSR2 */ +#define x_NPRCSR3 0x0b /* read CSR3 */ +#define x_NPWCSR0 0x0c /* write CSR0 */ +#define x_NPWCSR1 0x0d /* write CSR1 */ +#define x_NPWCSR2 0x0e /* write CSR2 */ +#define x_NPWCSR3 0x0f /* write CSR3 */ +#define x_NPPOLL 0x10 +#define x_NPKILL 0x11 +#define x_NPSETPROT 0x12 /* set the protocol to use */ +#define x_NPSETBOARD 0x13 /* set board to use */ +#define x_NPSETNPDEB 0x14 /* set nc debuging level */ +#define x_NPSETADDR 0x15 /* set host address */ +#define x_NPNETBOOT 0x16 /* boot from the network */ + +/* ICP Board Requests */ + +#define x_ICPLOAD 0x02 +#define x_ICPDUMP 0x03 +#define x_ICPPANIC 0x05 +#define x_ICPPOLL 0x10 + +/* + * Typedefs for the VAX + */ + +typedef x_short x_sign16; /* 16 bit signed value */ +typedef x_unsigned_short x_unsign16; /* 16 bit unsigned value */ +typedef x_unsigned_int x_unsign32; /* 32 bit unsigned value */ +typedef x_long x_paddr_t; /* Physical addresses */ + +/* + * Tunables + */ + +#define x_NUMCQE 40 /* Number of CQE's per board */ + +/* Host configuration word in Status Block */ + +/* + * To disable the lock/unlock internal function calls clear the 0x8000 + * bit in the host configuration word (HOSTCONF) + */ + +#define x_HOSTCONF 0x0109 /* See above */ +#define x_LOWBYTE 1 +#define x_HIGHBYTE 0 +#define x_BUFFMAPPED 0 + +/* + * Memory mapping definintions for PM68DUAL hardware. + */ + +#ifdef x_PM68DUAL +#define x_PISHMEM 0x200000 +#define x_PISHMEMSIZE 2 +#define x_PIOFF 0x8000 /* change this to unique mem add. */ +#define x_PIWINDOW x_MBUSBUFR + x_PIOFF +#define x_WINDOWSIZE 2 +#endif +#define x_NPMAXXFR 32768 /* Maximum number of bytes / read */ + +/* + * Define the protocols supported by the NP Driver. + */ + +#define x_NONE 0x00 /* No protocols active for a process */ +#define x_NPMAINT 0x01 /* Maintenance protocol, superusers only */ +#define x_NPNTS 0x02 /* NTS Terminal Server */ +#define x_NPDLA 0x04 /* Direct Datalink Access */ +#define x_NPXNS 0x06 /* Xerox NS ITP */ +#define x_NPTCP 0x08 /* TCP/IP */ +#define x_NPISO 0x0A /* ISO */ +#define x_NPCLCONN 0xFF /* Closed connection, i.e. no protocol */ + +/* + * Convert the protocol to a value used in the Device Protocol Mask field + * of the Shared Memory Status Block. + */ + +#define x_PROTOMASK(x_x) ( 1 << (x_x) ) + +/* + * Special requests handled by the NP Driver + */ + +#define x_OS_STP 03400 /* Shut down connection on I Board */ +#define x_NPSTOP 3 /* Conversion from above (OS_STP) */ +#define x_NPCHNGP 50 /* Change the protocol on a connection */ +#define x_NPCHNGB 51 /* Change the Board number */ + +/* + * Miscellaneous + */ + +#define x_ON 0x8000 /* Used for Command Q's scan and change flag */ +#define x_UBADDRMASK 0x3FFFF /* 18 bit UNIBUS address */ +#define x_INTMASK 0xFFFFFFFC /* Used for address validation */ +#define x_CMDMASK 0xFFFF /* Mask ioctl cmd field (see ioctl.h) */ +#define x_NPPSADDR 0x324 /* Pointer to addr of on-board panic string */ +#define x_PANLEN 133 /* length of the panic buffer */ + +/* + * Map function code from user to I-Board format + */ + +#define x_FUNCTMAP(x_x) (((x_x) << 6) | 077) /* Maps user function to NP funcs */ + +/* + * Round up to a 16 byte boundary + */ + +#define x_ROUND16(x_x) (((x_x) + 15) & (~0x0F)) /* Round to 16 byte boundary */ +#define x_ADDR24 1 /* Used by iomalloc() to specify 24 bit address */ + +#define x_NPERRSHIFT 8 /* Used in function ReqDone() */ +#define x_NPOK 0 + +#define x_LOWORD(x_X) (((x_ushort *)&(x_X))[0]) +#define x_HIWORD(x_X) (((x_ushort *)&(x_X))[1]) + +/* Everyday flag settings */ + +#define x_NPSET 1 +#define x_NPCLEAR 0 + +/* + * Command Queue Elements are the primary data structure for passing data + * between the driver and the device. + */ + +struct x_CQE { + + struct x_npreq *x_cqe_reqid;/* Address of asssociated npreq */ + x_unsign32 x_cqe_famid; /* Family ID (Process ID) */ + x_unsign16 x_cqe_func; /* I/O function to be performed */ +#ifdef x_mc68000 + char x_cqe_prot; /* Protocol type for I/O request */ + char x_cqe_lenrpb; /* Length of the RPB in bytes */ +#else + char x_cqe_lenrpb; /* Length of the RPB in bytes */ + char x_cqe_prot; /* Protocol type for I/O request */ +#endif + x_unsign16 x_cqe_ust0; /* Protocol status return */ + x_unsign16 x_cqe_ust1; /* Protocol status return */ + x_unsign16 x_cqe_devrsv; /* Reserved for use by device only! */ +#ifdef x_mc68000 + char x_cqe_char; /* CQE characteristics */ + char x_cqe_sts; /* Status return from device to user */ + char x_cqe_wind; /* Buffer mapping window size (page units) */ + char x_cqe_nbuf; /* Number of data buffers for I/O */ +#else + char x_cqe_sts; /* Status return from device to user */ + char x_cqe_char; /* CQE characteristics */ + char x_cqe_nbuf; /* Number of data buffers for I/O */ + char x_cqe_wind; /* Buffer mapping window size (page units) */ +#endif + x_unsign16 x_cqe_bcnt; /* Total number of bytes in the data buffer */ + x_unsign16 x_cqe_unused; /* Unused */ + x_unsign16 x_cqe_dma[2]; /* Address of the MULTIBUS data buffer */ + x_unsign16 x_rpb1; /* Word 1 of protocol parameters */ + x_unsign16 x_rpb2; /* Word 2 of protocol parameters */ + x_unsign16 x_rpb3; /* Word 3 of protocol parameters */ + x_unsign16 x_rpb4; /* Word 4 of protocol parameters */ + x_unsign16 x_rpb5; /* Word 5 of protocol parameters */ + x_unsign16 x_rpb6; /* Word 6 of protocol parameters */ + x_unsign16 x_rpb7; /* Word 7 of protocol parameters */ + x_unsign16 x_rpb8; /* Word 8 of protocol parameters */ + x_unsign16 x_rpb9; /* Word 9 of protocol parameters */ + x_unsign16 x_rpb10; /* Word 10 of protocol parameters */ + x_unsign16 x_rpb11; /* Word 11 of protocol parameters */ + x_unsign16 x_rpb12; /* Word 12 of protocol parameters */ + +}; + +/* + * NP Driver Request structure contains information about a request + * maintained solely by the driver. One per CQE, plus a header. + */ + +struct x_npreq { + + struct x_npreq *x_forw; /* Forward pointer for active list */ + struct x_npreq *x_back; /* Backward pointer for active list */ + struct x_npreq *x_free; /* Next member on free list */ + struct x_CQE *x_element; /* CQE associated with this request */ + x_int x_flags; /* Always useful */ + x_int x_reqcnt; /* Request count for reqtab */ + x_int x_bufoffset; /* Offset into buffer for turns */ + x_int x_bytecnt; /* Number of bytes to transfer */ + x_caddr_t x_virtmem; /* Virtual address of buffer */ + x_int x_mapbase; /* Address of the mapping register */ + x_int x_mapsize; /* Size of mapped area */ + x_caddr_t x_bufaddr; /* Address of the user buffer */ + struct x_buf x_buf; /* Buf structure needed for mem. mgmt */ + struct x_proc *x_procp; /* Pointer to process of requestor */ + x_caddr_t x_user; /* Structure passed by user from itpuser.h */ + x_int (*x_intr)(); /* Ptr to routine to call at interrupt time */ +}; + +/* + * Npmaster structure, one per device, is used for boardwise centralization + * of relevant information including queues, I/O addresses and request pools. + */ + +struct x_npmaster { + + struct x_npmaster *x_next; /* Linked list of these, NULL terminator */ + struct x_npspace *x_shmemp; /* Shared memory address (driver <-> device) */ + struct x_uba_device *x_devp; /* UBA Device for this unit */ + struct x_NPREG *x_iobase; /* I/O base address for this board */ + struct x_npreq *x_reqtab; /* Header for pool of CQE requests */ + x_int x_iomapbase; /* Base index of I/O map reg's allocated */ + x_int x_flags; /* State of the Board */ + x_int x_unit; /* Unit number of this device */ + x_int x_vector; /* Interrupt vector for this unit */ +}; + +struct x_npconn { + + struct x_npmaster *x_unit; /* Unit number (board) of this connection */ + x_unsign16 x_protocol; /* Protocol used on this connection */ + struct x_buf x_np_wbuf; /* write buf structure for raw access */ + struct x_buf x_np_rbuf; /* read buf structure for raw access */ +}; + +struct x_NPREG { + x_unsign16 x_CSR0; /* Control Status Register 0 */ + x_unsign16 x_CSR1; /* Control Status Register 1 */ + x_unsign16 x_CSR2; /* Control Status Register 2 */ + x_unsign16 x_CSR3; /* Control Status Register 3 */ + +}; + +/* + * The following structures are used for communicating with the + * Intelligent Board and are located in Shared Memory. + */ + +/* + * Status Block + */ + +struct x_NpStat{ + + x_unsign16 x_sb_drw; /* Device Request Word */ + x_unsign16 x_sb_hcw; /* Host Configuration Word */ + x_unsign16 x_sb_dcw; /* Device Configuration Word */ + x_unsign16 x_sb_dpm; /* Device Protocol Mask */ + x_unsign16 x_sb_dcq; /* Offset to Device CQ */ + x_unsign16 x_sb_hcq; /* Offset to Host CQ */ +}; + +/* + * Command Queue, two per device. One is owned by the driver and the other + * is owned by the device. + */ + +struct x_CmdQue { + + x_unsign16 x_scanflag; /* Scan Flag, MSB set if being scanned */ + x_unsign16 x_chngflag; /* Change Flag, MSB set by initiator */ + x_unsign16 x_cq_wrap; /* Offset to last CQE entry +2 */ + x_unsign16 x_cq_add; /* Offset to add a CQE to the queue */ + x_unsign16 x_cq_rem; /* Offset to remove a CQE from the queue */ + x_unsign16 x_cq_cqe[x_NUMCQE]; /* Command Queue Element Offsets */ +}; + +/* + * Structure of the shared memory area per board. Declared this way to avoid + * compiler word alignment vagaries when computing offsets. + */ + +struct x_npspace { + + struct x_NpStat x_statblock; /* Status Block */ + struct x_CmdQue x_devcq; /* Device's Command Queue */ + struct x_CmdQue x_hostcq; /* Host's Command Queue */ + struct x_CQE x_elements[x_NUMCQE]; /* Shared Command Queue Elements */ + x_unsign16 x_filler[8]; /* Here for 16 byte alignment */ +}; + +/* + * Structure of array of base addresses of I-Board controllers + * (See global data definitions in np.c) + */ + +struct x_npbase { + x_caddr_t x_baseaddr; +}; + +/* State of the NP Driver as kept in NpState */ + +#define x_ICPAVAIL 0x01 /* ICP is waiting for a request */ + +/* Tells ICP Process that there are no more requests for this board */ + +#define x_BRDDONE 1 + +/* Flags used by the driver (npreq structure) to monitor status of requests */ + +#define x_REQDONE 0x01 /* Request completed */ +#define x_IOIFC 0x02 /* Internal Function Code Request */ +#define x_IOERR 0x04 /* Error on Request */ +#define x_NPPEND 0x08 /* Unused at this time */ +#define x_IOABORT 0x10 /* Request aborted by ICP */ +#define x_KERNREQ 0x20 /* Request was from the kernel */ +#define x_WANTREQ 0x40 /* Process is waiting for a npreq structure */ +#define x_NPUIO 0x80 /* Process doing physio */ + +/* Service Request Commands from the Intelligent Board */ + +#define x_NOREQ 0x00 /* No service requested */ +#define x_NPLOAD 0x01 /* Dump request */ +#define x_NPDUMP 0x02 /* Load request */ +#define x_NPPANIC 0x100 /* Panic request */ + +/* Definitions of Status returned from the I-Board */ + +#define x_NPDONE 0x01 /* Normal completion */ +#define x_NPIFC 0x00 /* Internal Function Code request */ +#define x_NPPERR 0x80 /* Protocol error */ +#define x_NPMERR 0x82 /* Memory allocation failure on I-Board */ + +/* Definitions of IFC type requests from I-Board */ + +#define x_NPLOCK 0x64 /* Lock the process's data area */ +#define x_NPUNLOCK 0xA4 /* Unlock the process */ +#define x_NPREMAP 0x124 /* Window turn */ + +/* Definition of flags for the Npmaster structure */ + +#define x_CSRPEND 0x01 /* CSR0 command pending */ +#define x_PANICREQ 0x02 /* Panic request */ +#define x_DUMPREQ 0x04 /* Dump request */ +#define x_LOADREQ 0x08 /* Load request */ +#define x_BOARDREQ 0x10 /* Any request by the board */ +#define x_BADBOARD 0x20 /* Board disabled */ +#define x_AVAILABLE 0x40 /* Board available */ +#define x_BRDRESET 0x80 /* Board is being reset */ +#define x_PANIC1 0x100 /* Driver wants panic address */ +#define x_PANIC2 0x200 /* Driver wants panic string */ +#define x_PANIC3 0x400 /* Clear first byte of panic string */ + +/* + * Debugging Constants + */ + +#define x_DEBENTRY 0x0001 /* debug entry points */ +#define x_DEBMEM 0x0002 /* debug memory */ +#define x_DEBREQ 0x0004 /* debug requests */ +#define x_DEBCQE 0x0008 /* debug cqe's */ +#define x_DEBCQ 0x0010 /* debug cq's */ +#define x_DEBMAINT 0x0020 /* debug maintainance requests */ +#define x_DEBINTR 0x0040 /* debug interrupt routines */ +#define x_DEBINIT 0x0080 /* debug initialization routines */ +#define x_DEBIFC 0x0100 /* debug Internal function codes */ +#define x_DEBIOCTL 0x0200 /* debug ioctl calls */ +#define x_DEBOPEN 0x0400 /* debug open calls */ +#define x_DEBIO 0x0800 /* debug read & write calls */ +#define x_DEBCSR 0x1000 /* debug CSR commands */ +#define x_DEBLOCK 0x2000 /* debug lock / unlock calls */ +#define x_NOBOARD 0x4000 /* debug user/host interface */ + +#endif diff --git a/x_include/vaxuba/x_pdma.h b/x_include/vaxuba/x_pdma.h new file mode 100644 index 0000000..af5608b --- /dev/null +++ b/x_include/vaxuba/x_pdma.h @@ -0,0 +1,22 @@ +#include "x_.h" + +#ifndef x__VAXUBA_PDMA_H_ +#define x__VAXUBA_PDMA_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)pdma.h 7.1 (Berkeley) 6/5/86 + */ + +struct x_pdma { + struct x_dzdevice *x_p_addr; + char *x_p_mem; + char *x_p_end; + x_int x_p_arg; + x_int (*x_p_fcn)(); +}; + +#endif diff --git a/x_include/vaxuba/x_psreg.h b/x_include/vaxuba/x_psreg.h new file mode 100644 index 0000000..36bd404 --- /dev/null +++ b/x_include/vaxuba/x_psreg.h @@ -0,0 +1,215 @@ +#include "x_.h" + +#ifndef x__VAXUBA_PSREG_H_ +#define x__VAXUBA_PSREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)psreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * The Real Nitty Gritty Device Registers + */ + +struct x_psdevice { + x_short x_ps_data; /* data register */ + x_short x_ps_addr; /* address register */ + x_short x_ps_wcount; /* word count register */ + x_short x_ps_busaddr; /* unibus address register */ + x_short x_ps_iostat; /* io status register */ +}; + +/* + * Possible ioctl's + */ +#define x_PSIOAUTOREFRESH x__IO(x_p, 0) /* auto refresh */ +#define x_PSIOSINGLEREFRESH x__IO(x_p, 1) /* single refresh */ +#define x_PSIOAUTOMAP x__IO(x_p, 2) /* auto map */ +#define x_PSIOSINGLEMAP x__IO(x_p, 3) /* single map */ +#define x_PSIODOUBLEBUFFER x__IO(x_p, 4) /* double buffer */ +#define x_PSIOSINGLEBUFFER x__IO(x_p, 5) /* single buffer */ +#define x_PSIOWAITREFRESH x__IO(x_p, 6) /* await refresh */ +#define x_PSIOWAITMAP x__IO(x_p, 7) /* await map */ +#define x_PSIOWAITHIT x__IO(x_p, 8) /* await hit */ +#define x_PSIOSTOPREFRESH x__IO(x_p, 9) /* stop refresh */ +#define x_PSIOSTOPMAP x__IO(x_p,10) /* stop map */ +#define x_PSIOGETADDR x__IOR(x_p,11, x_int) /* get Unibus address */ +#define x_PSIOTIMEREFRESH x__IO(x_p,12) /* time refresh */ + +/* + * Picture system io status register bits + */ + +#define x_DIOREADY 0100000 +#define x_PSAHOLD 040000 +#define x_PSRESET 020000 +#define x_DIORESET 010000 +#define x_DMARESET 04000 +#define x_PSIE 0400 +#define x_DMAREADY 0200 +#define x_DMAIE 0100 +#define x_PASSIVE 010 +#define x_DMAIN 04 +#define x_NEXEM 02 +#define x_GO 01 + +/* + * Picture system memory mapping control registers: SCB 0177400-0177410 + */ + +#define x_EXMMR_DMA 0177400 +#define x_EXMMR_DIO 0177404 +#define x_EXMMR_RC 0177405 +#define x_EXMMR_MAPOUT 0177406 +#define x_EXMMR_MAPIN 0177407 +#define x_EXMSR 0177410 + +/* + * Extended memory status register bits + */ + +#define x_DBERROR 0100000 +#define x_SBERROR 040000 +#define x_MEMREADY 0200 +#define x_DBIE 0100 +#define x_MMENBL 02 +#define x_INITMEM 01 + +/* + * Size of extended memory + */ + +#define x_NEXMPAGES (256*2) +#define x_WORDSPERPAGE (256) + +/* + * MAP picture processor registers: SCB 0177750-0177753 + */ + +#define x_MAOL 0177750 +#define x_MAOA 0177751 +#define x_MAIA 0177752 +#define x_MASR 0177753 +#define x_MAMSR 0177754 + +/* + * MAP status register bits + */ + +#define x_PPDONE 0100000 +#define x_FIFOFULL 040000 +#define x_FIFOEMPTY 020000 +#define x_HIT 010000 +#define x_IB 04000 +#define x_TAKE 02000 +#define x_MMODE 01400 +#define x_MOSTOPPED 0200 +#define x_IOUT 0100 +#define x_MAO 040 +#define x_MAI 020 +#define x_HIT_HOLD 010 +#define x_RSR_HOLD 04 +#define x_VEC_HOLD 02 +#define x_MAP_RESET 01 + +/* + * Refresh controller registers: SCB 0177730-0177737 + */ + +#define x_RFCSN 0177730 +#define x_RFSN 0177731 +#define x_RFAWA 0177732 +#define x_RFAWL 0177733 +#define x_RFAIA 0177734 +#define x_RFASA 0177735 +#define x_RFAIL 0177736 +#define x_RFSR 0177737 + +/* + * Refresh controller status register bits + */ + +#define x_RFSTOPPED 0100000 +#define x_RFHOLD 040000 +#define x_RFSTART 020000 +#define x_AUTOREF 010000 +#define x_RFBLANK 04000 +#define x_RIGHT 02000 +#define x_LGFIFO_FULL 01000 +#define x_NOT_EXEC 0200 +#define x_SKIPSEG 0100 +#define x_WRITEBACK 040 +#define x_SEARCH 020 +#define x_MATCH_HOLD 010 +#define x_MATCH_DEC 04 +#define x_SEARCH_MODE 03 + +/* + * Interrupt control + */ + +#define x_RTCREQ 0177760 +#define x_RTCIE 0177761 +#define x_SYSREQ 0177762 +#define x_SYSIE 0177763 +#define x_DEVREQ 0177764 +#define x_DEVIE 0177765 + +/* + * System interrupt request bits + */ + +#define x_LPEN_REQ 0200 +#define x_MATCH_REQ 0100 +#define x_WBSTOP_REQ 040 +#define x_RFSTOP_REQ 020 +#define x_MOSTOP_REQ 010 +#define x_JUMP_REQ 04 +#define x_HIT_REQ 02 +#define x_HALT_REQ 01 + +/* + * Real-Time Clock registers + */ + +#define x_RTCCNT 0177744 +#define x_RTCSR 0177745 + +/* + * Real-Time Clock status register bits + */ + +#define x_HZ120 040 +#define x_EXT 020 +#define x_SYNC 010 +#define x_EXTSEL2 04 +#define x_EXTSEL1 02 +#define x_RUN 01 + +/* + * Control dials a/d registers + */ + +#define x_ADDR0 0177500 +#define x_ADDR1 0177501 +#define x_ADDR2 0177502 +#define x_ADDR3 0177503 +#define x_ADDR4 0177504 +#define x_ADDR5 0177505 +#define x_ADDR6 0177506 +#define x_ADDR7 0177507 + +/* + * Function switches and lights + */ + +#define x_FSWR 0177626 +#define x_FSLR 0177627 + +#endif diff --git a/x_include/vaxuba/x_rkreg.h b/x_include/vaxuba/x_rkreg.h new file mode 100644 index 0000000..54ea9cd --- /dev/null +++ b/x_include/vaxuba/x_rkreg.h @@ -0,0 +1,144 @@ +#include "x_.h" + +#ifndef x__VAXUBA_RKREG_H_ +#define x__VAXUBA_RKREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)rkreg.h 7.1 (Berkeley) 6/5/86 + */ + +#define x_NRK7CYL 815 +#define x_NRK6CYL 411 +#define x_NRKSECT 22 +#define x_NRKTRK 3 + +struct x_rkdevice { + x_short x_rkcs1; /* control status reg 1 */ + x_short x_rkwc; /* word count */ + x_u_short x_rkba; /* bus address */ + x_short x_rkda; /* disk address */ + x_short x_rkcs2; /* control status reg 2 */ + x_short x_rkds; /* drive status */ + x_short x_rker; /* driver error register */ + x_short x_rkatt; /* attention status/offset register */ + x_short x_rkcyl; /* current cylinder register */ + x_short x_rkxxx; + x_short x_rkdb; /* data buffer register */ + x_short x_rkmr1; /* maint reg 1 */ + x_short x_rkec1; /* burst error bit position */ + x_short x_rkec2; /* burst error bit pattern */ + x_short x_rkmr2; /* maint reg 2 */ + x_short x_rkmr3; /* maint reg 3 */ +}; + +/* rkcs1 */ +#define x_RK_CCLR 0100000 /* controller clear (also error) */ +#define x_RK_CERR x_RK_CCLR +#define x_RK_DI 0040000 /* drive interrupt */ +#define x_RK_DTCPAR 0020000 /* drive to controller parity */ +#define x_RK_CFMT 0010000 /* 18 bit word format */ +#define x_RK_CTO 0004000 /* controller timeout */ +#define x_RK_CDT 0002000 /* drive type (rk07/rk06) */ +/* bits 8 and 9 are the extended bus address */ +#define x_RK_CRDY 0000200 /* controller ready */ +#define x_RK_IE 0000100 /* interrupt enable */ +/* bits 1 to 4 are the function code */ +#define x_RK_GO 0000001 + +/* commands */ +#define x_RK_SELECT 000 /* select drive */ +#define x_RK_PACK 002 /* pack acknowledge */ +#define x_RK_DCLR 004 /* drive clear */ +#define x_RK_UNLOAD 006 /* unload */ +#define x_RK_START 010 /* start spindle */ +#define x_RK_RECAL 012 /* recalibrate */ +#define x_RK_OFFSET 014 /* offset */ +#define x_RK_SEEK 016 /* seek */ +#define x_RK_READ 020 /* read data */ +#define x_RK_WRITE 022 /* write data */ +#define x_RK_RHDR 026 /* read header */ +#define x_RK_WHDR 030 /* write header */ + +/* rkcs2 */ +#define x_RKCS2_DLT 0100000 /* data late */ +#define x_RKCS2_WCE 0040000 /* write check */ +#define x_RKCS2_UPE 0020000 /* unibus parity */ +#define x_RKCS2_NED 0010000 /* non-existant drive */ +#define x_RKCS2_NEM 0004000 /* non-existant memory */ +#define x_RKCS2_PGE 0002000 /* programming error */ +#define x_RKCS2_MDS 0001000 /* multiple drive select */ +#define x_RKCS2_UFE 0000400 /* unit field error */ +#define x_RKCS2_OR 0000200 /* output ready */ +#define x_RKCS2_IR 0000100 /* input ready */ +#define x_RKCS2_SCLR 0000040 /* subsystem clear */ +#define x_RKCS2_BAI 0000020 /* bus address increment inhibit */ +#define x_RKCS2_RLS 0000010 /* release */ +/* bits 0-2 are drive select */ + +#define x_RKCS2_BITS \ +"\10\20DLT\17WCE\16UPE\15NED\14NEM\13PGE\12MDS\11UFE\ +\10x_OR\7x_IR\6x_SCLR\5x_BAI\4x_RLS" + +#define x_RKCS2_HARD (x_RKCS2_NED|x_RKCS2_PGE) + +/* rkds */ +#define x_RKDS_SVAL 0100000 /* status valid */ +#define x_RKDS_CDA 0040000 /* current drive attention */ +#define x_RKDS_PIP 0020000 /* positioning in progress */ +/* bit 12 is spare */ +#define x_RKDS_WRL 0004000 /* write lock */ +/* bits 9 and 10 are spare */ +#define x_RKDS_DDT 0000400 /* disk drive type */ +#define x_RKDS_DRDY 0000200 /* drive ready */ +#define x_RKDS_VV 0000100 /* volume valid */ +#define x_RKDS_DROT 0000040 /* drive off track */ +#define x_RKDS_SPLS 0000020 /* speed loss */ +#define x_RKDS_ACLO 0000010 /* ac low */ +#define x_RKDS_OFF 0000004 /* offset mode */ +#define x_RKDS_DRA 0000001 /* drive available */ + +#define x_RKDS_DREADY (x_RKDS_DRA|x_RKDS_VV|x_RKDS_DRDY) +#define x_RKDS_BITS \ +"\10\20SVAL\17CDA\16PIP\14WRL\11DDT\ +\10Dx_RDY\7x_VV\6Dx_ROT\5x_SPLS\4x_ACLO\3x_OFF\1Dx_RA" +#define x_RKDS_HARD (x_RKDS_ACLO|x_RKDS_SPLS) + +/* rker */ +#define x_RKER_DCK 0100000 /* data check */ +#define x_RKER_UNS 0040000 /* drive unsafe */ +#define x_RKER_OPI 0020000 /* operation incomplete */ +#define x_RKER_DTE 0010000 /* drive timing error */ +#define x_RKER_WLE 0004000 /* write lock error */ +#define x_RKER_IDAE 0002000 /* invalid disk address error */ +#define x_RKER_COE 0001000 /* cylinder overflow error */ +#define x_RKER_HRVC 0000400 /* header vertical redundancy check */ +#define x_RKER_BSE 0000200 /* bad sector error */ +#define x_RKER_ECH 0000100 /* hard ecc error */ +#define x_RKER_DTYE 0000040 /* drive type error */ +#define x_RKER_FMTE 0000020 /* format error */ +#define x_RKER_DRPAR 0000010 /* control-to-drive parity error */ +#define x_RKER_NXF 0000004 /* non-executable function */ +#define x_RKER_SKI 0000002 /* seek incomplete */ +#define x_RKER_ILF 0000001 /* illegal function */ + +#define x_RKER_BITS \ +"\10\20DCK\17UNS\16OPI\15DTE\14WLE\13IDAE\12COE\11HRVC\ +\10x_BSE\7Ex_CH\6Dx_TYE\5x_FMTE\4Dx_RPAR\3x_NXF\2x_SKI\1x_ILF" +#define x_RKER_HARD \ + (x_RKER_WLE|x_RKER_IDAE|x_RKER_COE|x_RKER_DTYE|x_RKER_FMTE|x_RKER_ILF) + +/* offset bits in rkas */ +#define x_RKAS_P400 0020 /* +400 RK06, +200 RK07 */ +#define x_RKAS_M400 0220 /* -400 RK06, -200 RK07 */ +#define x_RKAS_P800 0040 /* +800 RK06, +400 RK07 */ +#define x_RKAS_M800 0240 /* -800 RK06, -400 RK07 */ +#define x_RKAS_P1200 0060 /* +800 RK06, +400 RK07 */ +#define x_RKAS_M1200 0260 /* -1200 RK06, -1200 RK07 */ + +#endif diff --git a/x_include/vaxuba/x_rlreg.h b/x_include/vaxuba/x_rlreg.h new file mode 100644 index 0000000..95c00af --- /dev/null +++ b/x_include/vaxuba/x_rlreg.h @@ -0,0 +1,122 @@ +#include "x_.h" + +#ifndef x__VAXUBA_RLREG_H_ +#define x__VAXUBA_RLREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)rlreg.h 7.1 (Berkeley) 6/5/86 + */ + +struct x_rldevice { + x_short x_rlcs; /* control status */ + x_u_short x_rlba; /* bus address */ + union { /* disk address */ + x_u_short x_seek; /* disk seek address */ + x_u_short x_rw; /* disk read/write address */ + x_u_short x_getstat; /* get disk status command */ + } x_rlda; + union { /* multi-purpose register */ + x_u_short x_getstat; /* get status */ + x_u_short x_readhdr; /* read header */ + x_u_short x_rw; /* read/write word count */ + } x_rlmp; +}; + +#define x_NRLCYLN 512 /* number of cylinders per disk */ +#define x_NRLTRKS 2 /* number of tracks per cylinder */ +#define x_NRLSECT 40 /* number of sectors per track */ +#define x_NRLBPSC 256 /* bytes per sector */ + +/* rlcs */ +/* commands */ +#define x_RL_NOOP 0000000 /* no-operation */ +#define x_RL_WCHECK 0000002 /* write check */ +#define x_RL_GETSTAT 0000004 /* get status */ +#define x_RL_SEEK 0000006 /* seek */ +#define x_RL_RHDR 0000010 /* read header */ +#define x_RL_WRITE 0000012 /* write data */ +#define x_RL_READ 0000014 /* read data */ +#define x_RL_RDNCK 0000016 /* read data without hdr check */ + +#define x_RL_DRDY 0000001 /* When set indicates drive ready */ +#define x_RL_BAE 0000060 /* UNIBUS address bits 16 & 17 */ +#define x_RL_IE 0000100 /* interrupt enable */ +#define x_RL_CRDY 0000200 /* controller ready */ +#define x_RL_DS0 0000400 /* drive select 0 */ +#define x_RL_DS1 0001000 /* drive select 1 */ +#define x_RL_OPI 0002000 /* operation incomplete */ +#define x_RL_DCRC 0004000 /* CRC error occurred */ +#define x_RL_DLT 0010000 /* data late or header not found */ +#define x_RL_NXM 0020000 /* non-existant memory */ +#define x_RL_DE 0040000 /* selected drive flagged an error */ +#define x_RL_ERR 0100000 /* composite error */ + +#define x_RL_DCRDY (x_RL_DRDY | x_RL_CRDY) + +#define x_RLCS_BITS \ +"\10\20ERR\17DE\16NXM\15DLT\14DCRC\13OPI\1DRDY" + +/* da_seek */ +#define x_RLDA_LOW 0000001 /* lower cylinder seek */ +#define x_RLDA_HGH 0000005 /* higher cylinder seek */ +#define x_RLDA_HSU 0000000 /* upper head select */ +#define x_RLDA_HSL 0000020 /* lower head select */ +#define x_RLDA_CA 0177600 /* cylinder address */ + +/* da_rw */ +#define x_RLDA_SA 0000077 /* sector address */ +#define x_RLDA_HST 0000000 /* upper head select */ +#define x_RLDA_HSB 0000100 /* lower head select */ + +/* da_getstat */ + +#define x_RL_GSTAT 0000003 /* Get status */ +#define x_RL_RESET 0000013 /* get status with reset */ + +/* mp_getstat */ +#define x_RLMP_STA 0000001 /* drive state: load cartridge */ +#define x_RLMP_STB 0000002 /* drive state: brush cycle */ +#define x_RLMP_STC 0000004 /* drive state: seek */ +#define x_RLMP_BH 0000010 /* set when brushes are home */ +#define x_RLMP_HO 0000020 /* set when brushes over the disk */ +#define x_RLMP_CO 0000040 /* set when cover open */ +#define x_RLMP_HS 0000100 /* indicates selected head: + 0 upper head + 1 lower head */ +#define x_RLMP_DT 0000200 /* indicates drive type: + 0 RL01 + 1 RL02 */ +#define x_RLMP_DSE 0000400 /* set on multiple drive selection */ +#define x_RLMP_VC 0001000 /* set on pack mounted and spining */ +#define x_RLMP_WGE 0002000 /* write gate error */ +#define x_RLMP_SPE 0004000 /* spin speed error */ +#define x_RLMP_SKTO 0010000 /*\* seek time out error */ +#define x_RLMP_WL 0020000 /* set on protected drive */ +#define x_RLMP_CHE 0040000 /* current head error */ +#define x_RLMP_WDE 0100000 /* write data error */ + +/* mp_rhc */ +#define x_RLMP_SA 0000077 /* sector address */ +#define x_RLMP_CA 0177600 /* cylinder address */ + +/* check these bits after a get status and reset */ +#define x_RLMP_STATUS (x_RLMP_WDE|x_RLMP_CHE|x_RLMP_SKTO|x_RLMP_SPE|x_RLMP_WGE \ + |x_RLMP_VC|x_RLMP_DSE|x_RLMP_CO|x_RLMP_HO|x_RLMP_BH|x_RLMP_STC|x_RLMP_STB|x_RLMP_STA) + +/* these are the bits that should be on in the above check */ +#define x_RLMP_STATOK (x_RLMP_HO|x_RLMP_BH|x_RLMP_STC|x_RLMP_STA) + +/* mp_rw */ +#define x_RLMP_WC 0017777 /* word count 2's complement */ + +#define x_RLER_BITS \ +"\10\20WDE\17CHE\16WL\15SKTO\14SPE\13WGE\12VC\11DSE\ +\10Dx_T\7x_HS\6x_CO\5x_HO\4x_BH\3x_STC\2x_STB\1x_STA" + +#endif diff --git a/x_include/vaxuba/x_rxreg.h b/x_include/vaxuba/x_rxreg.h new file mode 100644 index 0000000..f7e113b --- /dev/null +++ b/x_include/vaxuba/x_rxreg.h @@ -0,0 +1,114 @@ +#include "x_.h" + +#ifndef x__VAXUBA_RXREG_H_ +#define x__VAXUBA_RXREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)rxreg.h 7.1 (Berkeley) 6/5/86 + */ + +#ifdef x_KERNEL +#include "x_ioctl.h" +#else +#include +#endif + +/* + * RX02 registers + */ +struct x_rxdevice { + x_short x_rxcs; /* control/status register */ + x_short x_rxdb; /* data buffer register */ +}; + +/* + * RX211 Command and Status Register (RX2CS) + */ +#define x_RX_DRV0 0x0000 /* select drive 0 */ +#define x_RX_DRV1 0x0010 /* select drive 1 */ +#define x_RX_DONE 0x0020 /* function complete */ +#define x_RX_INTR 0x0040 /* interrupt enable */ +#define x_RX_TREQ 0x0080 /* transfer request (data only) */ +#define x_RX_SDEN 0x0000 /* single density */ +#define x_RX_DDEN 0x0100 /* double density */ +#define x_RX_EXT 0x3000 /* extended address bits */ +#define x_RX_INIT 0x4000 /* initialize RX211 interface */ +#define x_RX_ERR 0x8000 /* general error bit */ + +/* + * RX211 control function bits (0-3 of RX2CS) + */ +#define x_RX_FILL 0x0001 /* fill the buffer */ +#define x_RX_EMPTY 0x0003 /* empty the buffer */ +#define x_RX_WRITE 0x0005 /* write the buffer to disk */ +#define x_RX_READ 0x0007 /* read a disk sector to the buffer */ +#define x_RX_FORMAT 0x0009 /* set the media density (format) */ +#define x_RX_RDSTAT 0x000b /* read the disk status */ +#define x_RX_WDDS 0x000d /* write a deleted-data sector */ +#define x_RX_RDERR 0x000f /* read the error registers */ + +#define x_RXCS_BITS \ +"\20\20RX_ERR\17RX_INIT\11RX_DDEN\10RX_TREQ\7RX_IE\6RX_DONE\5RX_DRV1" + +/* + * RX211 Error and Status Register (RX2ES) -- + * information is located in RX2DB after completion of function. + * The READY bit's value is available only after a "read status". + */ +#define x_RXES_CRCERR 0x0001 /* CRC error (data read error) */ +#define x_RXES_IDONE 0x0004 /* reinitialization complete */ +#define x_RXES_DENERR 0x0010 /* density error */ +#define x_RXES_DBLDEN 0x0020 /* set if double density */ +#define x_RXES_DDMARK 0x0040 /* deleted-data mark */ +#define x_RXES_READY 0x0080 /* drive is ready */ + +#define x_RXES_BITS \ +"\20\14RXES_NXM\13RXES_WCOF\11RXES_DRV1\10RXES_RDY\7RXES_DDMK\6RXES_DDEN\5\ +x_RXES_DNER\4x_RXES_ACLO\3x_RXES_ID\1x_RXES_CRC" + +/* + * Ioctl commands, move to dkio.h later + */ +#define x_RXIOC_FORMAT x__IOW(x_d, 1, x_int) /* format the disk */ +#define x_RXIOC_WDDS x__IOW(x_d, 2, x_int) /* write `deleted data' mark */ + /* on next sector */ +#define x_RXIOC_RDDSMK x__IOR(x_d, 3, x_int) /* did last read sector contain */ + /* `deleted data'?*/ +#define x_RXIOC_GDENS x__IOR(x_d, 4, x_int) /* return density of current disk */ + +#ifdef x_RXDEFERR +/* + * Table of values for definitive error code (rxxt[0] & 0xff) + */ +struct x_rxdeferr { + x_short x_errval; + char *x_errmsg; +} x_rxdeferr[] = { + { 0010, "Can't find home on drive 0" }, + { 0020, "Can't find home on drive 1" }, + { 0040, "Bad track number requested" }, + { 0050, "Home found too soon" }, + { 0070, "Can't find desired sector" }, + { 0110, "No SEP clock seen" }, + { 0120, "No preamble found" }, + { 0130, "Preamble, but no ID mark" }, + { 0140, "Header CRC error"}, + { 0150, "Track addr wrong in header" }, + { 0160, "Too many tries for ID AM" }, + { 0170, "No data AM found" }, + { 0200, "Data CRC error" }, + { 0220, "Maintenance test failure" }, + { 0230, "Word count overflow" }, + { 0240, "Density error" }, + { 0250, "Set-density protocol bad" }, + { 0, "Undefined error code" } +}; +#endif + +#endif diff --git a/x_include/vaxuba/x_tmreg.h b/x_include/vaxuba/x_tmreg.h new file mode 100644 index 0000000..c8db076 --- /dev/null +++ b/x_include/vaxuba/x_tmreg.h @@ -0,0 +1,107 @@ +#include "x_.h" + +#ifndef x__VAXUBA_TMREG_H_ +#define x__VAXUBA_TMREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)tmreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * TM11 controller registers + */ +struct x_tmdevice { + x_u_short x_tmer; /* error register, per drive */ + x_u_short x_tmcs; /* control-status register */ + x_short x_tmbc; /* byte/frame count */ + x_u_short x_tmba; /* address */ + x_short x_tmdb; /* data buffer */ + x_short x_tmrd; /* read lines */ + x_short x_tmmr; /* maintenance register */ +#ifdef x_AVIV + x_short x_tmfsr; /* formatter status reading */ +#endif +}; + +#define x_b_repcnt x_b_bcount +#define x_b_command x_b_resid + +/* bits in tmcs */ +#define x_TM_GO 0000001 +#define x_TM_OFFL 0000000 /* offline */ +#define x_TM_RCOM 0000002 /* read */ +#define x_TM_WCOM 0000004 /* write */ +#define x_TM_WEOF 0000006 /* write-eof */ +#define x_TM_SFORW 0000010 /* space forward */ +#define x_TM_SREV 0000012 /* space backwards */ +#define x_TM_WIRG 0000014 /* write with xtra interrecord gap */ +#define x_TM_REW 0000016 /* rewind */ +#define x_TM_SENSE x_TM_IE /* sense (internal to driver) */ + +#define x_tmreverseop(x_cmd) ((x_cmd)==x_TM_SREV || (x_cmd)==x_TM_REW) + +/* TM_SNS is a pseudo-op used to get tape status */ +#define x_TM_IE 0000100 /* interrupt enable */ +#define x_TM_CUR 0000200 /* control unit is ready */ +#define x_TM_DCLR 0010000 /* drive clear */ +#define x_TM_D800 0060000 /* select 800 bpi density */ +#define x_TM_ERR 0100000 /* drive error summary */ + +/* bits in tmer */ +#define x_TMER_ILC 0100000 /* illegal command */ +#define x_TMER_EOF 0040000 /* end of file */ +#define x_TMER_CRE 0020000 /* cyclic redundancy error */ +#define x_TMER_PAE 0010000 /* parity error */ +#define x_TMER_BGL 0004000 /* bus grant late */ +#define x_TMER_EOT 0002000 /* at end of tape */ +#define x_TMER_RLE 0001000 /* record length error */ +#define x_TMER_BTE 0000400 /* bad tape error */ +#define x_TMER_NXM 0000200 /* non-existant memory */ +#define x_TMER_SELR 0000100 /* tape unit properly selected */ +#define x_TMER_BOT 0000040 /* at beginning of tape */ +#define x_TMER_CH7 0000020 /* 7 channel tape */ +#define x_TMER_SDWN 0000010 /* gap settling down */ +#define x_TMER_WRL 0000004 /* tape unit write protected */ +#define x_TMER_RWS 0000002 /* tape unit rewinding */ +#define x_TMER_TUR 0000001 /* tape unit ready */ + +#define x_TMER_BITS \ +"\10\20ILC\17EOF\16CRE\15PAE\14BGL\13EOT\12RLE\11BTE\10NXM\ +\7x_SELR\6x_BOT\5x_CH7\4x_SDWN\3x_WRL\2x_RWS\1x_TUR" + +#define x_TMER_HARD (x_TMER_ILC|x_TMER_EOT) +#define x_TMER_SOFT (x_TMER_CRE|x_TMER_PAE|x_TMER_BGL|x_TMER_RLE|x_TMER_BTE|x_TMER_NXM) + +#ifdef x_AVIV +/* bits in tmmr (formatter diagnostic reading) */ +#define x_DTS 000000 /* select dead track status */ +# define x_DTS_MASK 0xff + +#define x_DAB 010000 /* select diagnostic aid bits */ +# define x_DAB_MASK 037 /* reject code only */ + +#define x_RWERR 020000 /* select read-write errors */ +# define x_RWERR_MASK 01777 /* include bit 9 (MAI) */ +# define x_RWERR_BITS \ +"\10\12MAI\11CRC ERR\10WTMCHK\7UCE\6PART REC\5MTE\3END DATA CHK\ +\2x_VEL x_ERR\1Dx_IAG x_MODE" + +#define x_DRSENSE 030000 /* select drive sense */ +# define x_DRSENSE_MASK 0777 +# define x_DRSENSE_BITS \ +"\10\11WRTS\10EOTS\7BOTS\6WNHB\5PROS\4BWDS\3HDNG\2RDYS\1ON LINE" + +#define x_CRCF 040000 /* CRC-F Generator */ + +#define x_FSR_BITS \ +"\10\20REJ\17TMS\16OVRN\15DATACHK\14SSC\13EOTS\12WRTS\11ROMPS\10CRERR\ +\7x_ONLS\6x_BOTS\5x_HDENS\4x_BUPER\3x_FPTS\2x_REWS\1x_RDYS" +#endif + +#endif diff --git a/x_include/vaxuba/x_tmscpreg.h b/x_include/vaxuba/x_tmscpreg.h new file mode 100644 index 0000000..2fb63aa --- /dev/null +++ b/x_include/vaxuba/x_tmscpreg.h @@ -0,0 +1,89 @@ +#include "x_.h" + +#ifndef x__VAXUBA_TMSCPREG_H_ +#define x__VAXUBA_TMSCPREG_H_ + +/* @(#)tmscpreg.h 7.1 (Berkeley) 6/5/86 */ + +/* @(#)tmscpreg.h 1.1 11/2/84 84/09/25 */ + +/**************************************************************** + * * + * Licensed from Digital Equipment Corporation * + * Copyright (c) * + * Digital Equipment Corporation * + * Maynard, Massachusetts * + * 1985, 1986 * + * All rights reserved. * + * * + * The Information in this software is subject to change * + * without notice and should not be construed as a commitment * + * by Digital Equipment Corporation. Digital makes no * + * representations about the suitability of this software for * + * any purpose. It is supplied "As Is" without expressed or * + * implied warranty. * + * * + * If the Regents of the University of California or its * + * licensees modify the software in a manner creating * + * diriviative copyright rights, appropriate copyright * + * legends may be placed on the drivative work in addition * + * to that set forth above. * + * * + ****************************************************************/ +/* + * TMSCP registers and structures + */ + +struct x_tmscpdevice { + x_short x_tmscpip; /* initialization and polling */ + x_short x_tmscpsa; /* status and address */ +}; + +#define x_TMSCP_ERR 0100000 /* error bit */ +#define x_TMSCP_STEP4 0040000 /* step 4 has started */ +#define x_TMSCP_STEP3 0020000 /* step 3 has started */ +#define x_TMSCP_STEP2 0010000 /* step 2 has started */ +#define x_TMSCP_STEP1 0004000 /* step 1 has started */ +#define x_TMSCP_NV 0002000 /* no host settable interrupt vector */ +#define x_TMSCP_QB 0001000 /* controller supports Q22 bus */ +#define x_TMSCP_DI 0000400 /* controller implements diagnostics */ +#define x_TMSCP_OD 0000200 /* port allows odd host addr's in the buffer descriptor */ +#define x_TMSCP_IE 0000200 /* interrupt enable */ +#define x_TMSCP_MP 0000100 /* port supports address mapping */ +#define x_TMSCP_LF 0000002 /* host requests last fail response packet */ +#define x_TMSCP_PI 0000001 /* host requests adapter purge interrupts */ +#define x_TMSCP_GO 0000001 /* start operation, after init */ + + +/* + * TMSCP Communications Area + */ + +struct x_tmscpca { + x_short x_ca_xxx1; /* unused */ + char x_ca_xxx2; /* unused */ + char x_ca_bdp; /* BDP to purge */ + x_short x_ca_cmdint; /* command queue transition interrupt flag */ + x_short x_ca_rspint; /* response queue transition interrupt flag */ + x_long x_ca_rspdsc[x_NRSP];/* response descriptors */ + x_long x_ca_cmddsc[x_NCMD];/* command descriptors */ +}; + +#define x_ca_ringbase x_ca_rspdsc[0] + +#define x_TMSCP_OWN 0x80000000 /* port owns this descriptor (else host + owns it) */ +#define x_TMSCP_INT 0x40000000 /* allow interrupt on ring transition */ + +#define x_TMSCP_MAP 0x80000000 /* modifier for mapped buffer descriptors */ + +/* + * TMSCP packet info (same as MSCP) + */ +struct x_mscp_header { + x_short x_tmscp_msglen; /* length of MSCP packet */ + char x_tmscp_credits; /* low 4 bits: credits, high 4 bits: msgtype */ + char x_tmscp_vcid; /* virtual circuit id (connection id) */ +}; + +#endif diff --git a/x_include/vaxuba/x_tsreg.h b/x_include/vaxuba/x_tsreg.h new file mode 100644 index 0000000..9c6b9a3 --- /dev/null +++ b/x_include/vaxuba/x_tsreg.h @@ -0,0 +1,173 @@ +#include "x_.h" + +#ifndef x__VAXUBA_TSREG_H_ +#define x__VAXUBA_TSREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)tsreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * TS11 controller registers + */ +struct x_tsdevice { + x_u_short x_tsdb; /* data buffer */ + x_u_short x_tssr; /* status register */ +}; + +/* Bits in (unibus) status register */ +#define x_TS_SC 0100000 /* special condition (error) */ +#define x_TS_UPE 0040000 /* Unibus parity error */ +#define x_TS_SPE 0020000 /* serial bus parity error */ +#define x_TS_RMR 0010000 /* register modification refused */ +#define x_TS_NXM 0004000 /* nonexistant memory */ +#define x_TS_NBA 0002000 /* need buffer address */ +#define x_TS_XMEM 0001400 /* Unibus xmem bits */ +#define x_TS_SSR 0000200 /* subsytem ready */ +#define x_TS_OFL 0000100 /* off-line */ +#define x_TS_FTC 0000060 /* fatal termination class */ +#define x_TS_TC 0000016 /* termination class */ + +#define x_TS_SUCC 000 /* successful termination */ +#define x_TS_ATTN 002 /* attention */ +#define x_TS_ALERT 004 /* tape status alert */ +#define x_TS_REJECT 06 /* function reject */ +#define x_TS_RECOV 010 /* recoverable error */ +#define x_TS_RECNM 012 /* recoverable error, no tape motion */ +#define x_TS_UNREC 014 /* unrecoverable error */ +#define x_TS_FATAL 016 /* fatal error */ + +#define x_TSSR_BITS \ +"\10\20SC\17UPE\16SPE\15RMR\14NXM\13NBA\12A17\11A16\10SSR\ +\7x_OFL\6x_FC1\5x_FC0\4x_TC2\3x_TC1\2x_TC0\1-" + +#define x_b_repcnt x_b_bcount +#define x_b_command x_b_resid + +/* status message */ +struct x_ts_sts { + x_u_short x_s_sts; /* packet header */ + x_u_short x_s_len; /* packet length */ + x_u_short x_s_rbpcr; /* residual frame count */ + x_u_short x_s_xs0; /* extended status 0 - 3 */ + x_u_short x_s_xs1; + x_u_short x_s_xs2; + x_u_short x_s_xs3; +}; + +/* Error codes in xstat 0 */ +#define x_TS_TMK 0100000 /* tape mark detected */ +#define x_TS_RLS 0040000 /* record length short */ +#define x_TS_LET 0020000 /* logical end of tape */ +#define x_TS_RLL 0010000 /* record length long */ +#define x_TS_WLE 0004000 /* write lock error */ +#define x_TS_NEF 0002000 /* non-executable function */ +#define x_TS_ILC 0001000 /* illegal command */ +#define x_TS_ILA 0000400 /* illegal address */ +#define x_TS_MOT 0000200 /* capstan is moving */ +#define x_TS_ONL 0000100 /* on-line */ +#define x_TS_IES 0000040 /* interrupt enable status */ +#define x_TS_VCK 0000020 /* volume check */ +#define x_TS_PED 0000010 /* phase-encoded drive */ +#define x_TS_WLK 0000004 /* write locked */ +#define x_TS_BOT 0000002 /* beginning of tape */ +#define x_TS_EOT 0000001 /* end of tape */ + +#define x_TSXS0_BITS \ +"\10\20TMK\17RLS\16LET\15RLL\14WLE\13NEF\12ILC\11ILA\10MOT\ +\7x_ONL\6x_IES\5x_VCK\4x_PED\3x_WLK\2x_BOT\1Ex_OT" + +/* Error codes in xstat 1 */ +#define x_TS_DLT 0100000 /* data late */ +#define x_TS_COR 0020000 /* correctable data */ +#define x_TS_CRS 0010000 /* crease detected */ +#define x_TS_TIG 0004000 /* trash in the gap */ +#define x_TS_DBF 0002000 /* deskew buffer full */ +#define x_TS_SCK 0001000 /* speed check */ +#define x_TS_IPR 0000200 /* invalid preamble */ +#define x_TS_SYN 0000100 /* synchronization failure */ +#define x_TS_IPO 0000040 /* invalid postamble */ +#define x_TS_IED 0000020 /* invalid end of data */ +#define x_TS_POS 0000010 /* postamble short */ +#define x_TS_POL 0000004 /* postamble long */ +#define x_TS_UNC 0000002 /* uncorrectable data */ +#define x_TS_MTE 0000001 /* multitrack error */ + +#define x_TSXS1_BITS \ +"\10\20DLT\17-\16COR\15CRS\14TIG\13DBF\12SCK\11-\10IPR\ +\7x_SYN\6x_IPO\5x_IED\4x_POS\3x_POL\2Ux_NC\1x_MTE" + +/* Error codes in xstat 2 */ +#define x_TS_OPM 0100000 /* operation in progress */ +#define x_TS_SIP 0040000 /* silo parity error */ +#define x_TS_BPE 0020000 /* serial bus parity error */ +#define x_TS_CAF 0010000 /* capstan acceleration failure */ +#define x_TS_WCF 0002000 /* write card fail */ +#define x_TS_DTP 0000400 /* dead track parity */ +#define x_TS_DT 0000377 /* dead tracks */ + +#define x_TSXS2_BITS \ +"\10\20OPM\17SIP\16BPE\15CAF\14-\13WCF\12-\11DTP" + +/* Error codes in xstat 3 */ +#define x_TS_MEC 0177400 /* microdiagnostic error code */ +#define x_TS_LMX 0000200 /* limit exceeded */ +#define x_TS_OPI 0000100 /* operation incomplete */ +#define x_TS_REV 0000040 /* reverse */ +#define x_TS_CRF 0000020 /* capstan response fail */ +#define x_TS_DCK 0000010 /* density check */ +#define x_TS_NOI 0000004 /* noise record */ +#define x_TS_LXS 0000002 /* limit exceeded statically */ +#define x_TS_RIB 0000001 /* reverse into BOT */ + +#define x_TSXS3_BITS \ +"\10\10LMX\7OPI\6REV\5CRF\4DCK\3NOI\2LXS\1RIB" + +/* command message */ +struct x_ts_cmd { + x_u_short x_c_cmd; /* command */ + x_u_short x_c_loba; /* low order buffer address */ + x_u_short x_c_hiba; /* high order buffer address */ +#define x_c_repcnt x_c_loba + x_u_short x_c_size; /* byte count */ +}; + +/* commands and command bits */ +#define x_TS_ACK 0100000 /* ack - release command packet */ +#define x_TS_CVC 0040000 /* clear volume check */ +#define x_TS_IE 0000200 +#define x_TS_RCOM 0000001 +#define x_TS_REREAD 0001001 /* read data retry */ +#define x_TS_SETCHR 0000004 /* set characteristics */ +#define x_TS_WCOM 0000005 +#define x_TS_REWRITE 0001005 /* write data retry */ +#define x_TS_RETRY 0001000 /* retry bit for read and write */ +#define x_TS_SFORW 0000010 /* forward space record */ +#define x_TS_SREV 0000410 /* reverse space record */ +#define x_TS_SFORWF 0001010 /* forward space file */ +#define x_TS_SREVF 0001410 /* reverse space file */ +#define x_TS_REW 0002010 /* rewind */ +#define x_TS_OFFL 0000412 /* unload */ +#define x_TS_WEOF 0000011 /* write tape mark */ +#define x_TS_SENSE 0000017 /* get status */ + +/* characteristics data */ +struct x_ts_char { + x_long x_char_addr; /* address of status packet */ + x_u_short x_char_size; /* its size */ + x_u_short x_char_mode; /* characteristics */ +}; + +/* characteristics */ +#define x_TS_ESS 0200 /* enable skip tape marks stop */ +#define x_TS_ENB 0100 /* ??? */ +#define x_TS_EAI 0040 /* enable attention interrupts */ +#define x_TS_ERI 0020 /* enable message buffer release interrupts */ + +#endif diff --git a/x_include/vaxuba/x_ubareg.h b/x_include/vaxuba/x_ubareg.h new file mode 100644 index 0000000..a23f631 --- /dev/null +++ b/x_include/vaxuba/x_ubareg.h @@ -0,0 +1,199 @@ +#include "x_.h" + +#ifndef x__VAXUBA_UBAREG_H_ +#define x__VAXUBA_UBAREG_H_ + +#include +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ubareg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * VAX UNIBUS adapter registers + */ + +/* + * size of unibus address space in pages + */ +#define x_UBAPAGES 512 + +/* + * Number of UNIBUS map registers. We can't use the last 8k of UNIBUS + * address space for i/o transfers since it is used by the devices, + * hence have slightly less than 256K of UNIBUS address space. + */ +#define x_NUBMREG 496 + +#ifndef x_LOCORE +/* + * UBA hardware registers + */ +struct x_uba_regs { + x_int x_uba_cnfgr; /* configuration register */ + x_int x_uba_cr; /* control register */ + x_int x_uba_sr; /* status register */ + x_int x_uba_dcr; /* diagnostic control register */ + x_int x_uba_fmer; /* failed map entry register */ + x_int x_uba_fubar; /* failed UNIBUS address register */ + x_int x_pad1[2]; + x_int x_uba_brsvr[4]; + x_int x_uba_brrvr[4]; /* receive vector registers */ + x_int x_uba_dpr[16]; /* buffered data path register */ + x_int x_pad2[480]; + struct x_pte x_uba_map[x_NUBMREG]; /* unibus map register */ + x_int x_pad3[16]; /* no maps for device address space */ +}; +#endif + +#if defined(x_VAX780) || defined(x_VAX8600) +/* uba_cnfgr */ +#define x_UBACNFGR_UBINIT 0x00040000 /* unibus init asserted */ +#define x_UBACNFGR_UBPDN 0x00020000 /* unibus power down */ +#define x_UBACNFGR_UBIC 0x00010000 /* unibus init complete */ + +#define x_UBACNFGR_BITS \ +"\40\40PARFLT\37WSQFLT\36URDFLT\35ISQFLT\34MXTFLT\33XMTFLT\30ADPDN\27ADPUP\23UBINIT\22UBPDN\21UBIC" + +/* uba_cr */ +#define x_UBACR_MRD16 0x40000000 /* map reg disable bit 4 */ +#define x_UBACR_MRD8 0x20000000 /* map reg disable bit 3 */ +#define x_UBACR_MRD4 0x10000000 /* map reg disable bit 2 */ +#define x_UBACR_MRD2 0x08000000 /* map reg disable bit 1 */ +#define x_UBACR_MRD1 0x04000000 /* map reg disable bit 0 */ +#define x_UBACR_IFS 0x00000040 /* interrupt field switch */ +#define x_UBACR_BRIE 0x00000020 /* BR interrupt enable */ +#define x_UBACR_USEFIE 0x00000010 /* UNIBUS to SBI error field IE */ +#define x_UBACR_SUEFIE 0x00000008 /* SBI to UNIBUS error field IE */ +#define x_UBACR_CNFIE 0x00000004 /* configuration IE */ +#define x_UBACR_UPF 0x00000002 /* UNIBUS power fail */ +#define x_UBACR_ADINIT 0x00000001 /* adapter init */ + +/* uba_sr */ +#define x_UBASR_BR7FULL 0x08000000 /* BR7 receive vector reg full */ +#define x_UBASR_BR6FULL 0x04000000 /* BR6 receive vector reg full */ +#define x_UBASR_BR5FULL 0x02000000 /* BR5 receive vector reg full */ +#define x_UBASR_BR4FULL 0x01000000 /* BR4 receive vector reg full */ +#define x_UBASR_RDTO 0x00000400 /* UNIBUS to SBI read data timeout */ +#define x_UBASR_RDS 0x00000200 /* read data substitute */ +#define x_UBASR_CRD 0x00000100 /* corrected read data */ +#define x_UBASR_CXTER 0x00000080 /* command transmit error */ +#define x_UBASR_CXTMO 0x00000040 /* command transmit timeout */ +#define x_UBASR_DPPE 0x00000020 /* data path parity error */ +#define x_UBASR_IVMR 0x00000010 /* invalid map register */ +#define x_UBASR_MRPF 0x00000008 /* map register parity failure */ +#define x_UBASR_LEB 0x00000004 /* lost error */ +#define x_UBASR_UBSTO 0x00000002 /* UNIBUS select timeout */ +#define x_UBASR_UBSSYNTO 0x00000001 /* UNIBUS slave sync timeout */ + +#define x_UBASR_BITS \ +"\20\13RDTO\12RDS\11CRD\10CXTER\7CXTMO\6DPPE\5IVMR\4MRPF\3LEB\2UBSTO\1UBSSYNTO" + +/* uba_brrvr[] */ +#define x_UBABRRVR_AIRI 0x80000000 /* adapter interrupt request */ +#define x_UBABRRVR_DIV 0x0000ffff /* device interrupt vector field */ +#endif + +/* uba_dpr */ +#if defined(x_VAX780) || defined(x_VAX8600) +#define x_UBADPR_BNE 0x80000000 /* buffer not empty - purge */ +#define x_UBADPR_BTE 0x40000000 /* buffer transfer error */ +#define x_UBADPR_DPF 0x20000000 /* DP function (RO) */ +#define x_UBADPR_BS 0x007f0000 /* buffer state field */ +#define x_UBADPR_BUBA 0x0000ffff /* buffered UNIBUS address */ +#define x_UBA_PURGE780(x_uba, x_bdp) \ + ((x_uba)->x_uba_dpr[x_bdp] |= x_UBADPR_BNE) +#else +#define x_UBA_PURGE780(x_uba, x_bdp) +#endif +#if x_VAX750 +#define x_UBADPR_ERROR 0x80000000 /* error occurred */ +#define x_UBADPR_NXM 0x40000000 /* nxm from memory */ +#define x_UBADPR_UCE 0x20000000 /* uncorrectable error */ +#define x_UBADPR_PURGE 0x00000001 /* purge bdp */ +/* the DELAY is for a hardware problem */ +#define x_UBA_PURGE750(x_uba, x_bdp) { \ + ((x_uba)->x_uba_dpr[x_bdp] |= (x_UBADPR_PURGE|x_UBADPR_NXM|x_UBADPR_UCE)); \ + x_DELAY(8); \ +} +#else +#define x_UBA_PURGE750(x_uba, x_bdp) +#endif + +/* + * Macros for fast buffered data path purging in time-critical routines. + * + * Too bad C pre-processor doesn't have the power of LISP in macro + * expansion... + */ + +#if defined(x_VAX8600) || defined(x_VAX780) || defined(x_VAX750) +#define x_UBAPURGE(x_uba, x_bdp) { \ + switch (x_cpu) { \ + case x_VAX_8600: case x_VAX_780: x_UBA_PURGE780((x_uba), (x_bdp)); break; \ + case x_VAX_750: x_UBA_PURGE750((x_uba), (x_bdp)); break; \ + } \ +} +#endif +#if !defined(x_VAX8600) && !defined(x_VAX780) && !defined(x_VAX750) +#define x_UBAPURGE(x_uba, x_bdp) +#endif + +/* uba_mr[] */ +#define x_UBAMR_MRV 0x80000000 /* map register valid */ +#define x_UBAMR_BO 0x02000000 /* byte offset bit */ +#define x_UBAMR_DPDB 0x01e00000 /* data path designator field */ +#define x_UBAMR_SBIPFN 0x000fffff /* SBI page address field */ + +#define x_UBAMR_DPSHIFT 21 /* shift to data path designator */ + +/* + * Number of unibus buffered data paths and possible uba's per cpu type. + */ +#define x_NBDP8600 15 +#define x_NBDP780 15 +#define x_NBDP750 3 +#define x_NBDP730 0 +#define x_NBDP630 0 +#define x_MAXNBDP 15 + +/* + * Symbolic BUS addresses for UBAs. + */ + +#if x_VAX630 +#define x_UMEM630 ((x_u_short *)(0x1ffc2000)) +#endif + +#if x_VAX730 +#define x_UMEM730 ((x_u_short *)(0xfc0000)) +#endif + +#if x_VAX750 +#define x_UMEM750(x_i) ((x_u_short *)(0xfc0000-(x_i)*0x40000)) +#endif + +#if x_VAX780 +#define x_UMEM780(x_i) ((x_u_short *)(0x20100000+(x_i)*0x40000)) +#endif + +#if x_VAX8600 +#define x_UMEMA8600(x_i) ((x_u_short *)(0x20100000+(x_i)*0x40000)) +#define x_UMEMB8600(x_i) ((x_u_short *)(0x22100000+(x_i)*0x40000)) +#endif + +/* + * Macro to offset a UNIBUS device address, often expressed as + * something like 0172520 by forcing it into the last 8K of UNIBUS memory + * space. + */ +#define x_ubdevreg(x_addr) (0760000|((x_addr)&017777)) + +#endif diff --git a/x_include/vaxuba/x_ubavar.h b/x_include/vaxuba/x_ubavar.h new file mode 100644 index 0000000..8451ffe --- /dev/null +++ b/x_include/vaxuba/x_ubavar.h @@ -0,0 +1,218 @@ +#include "x_.h" + +#ifndef x__VAXUBA_UBAVAR_H_ +#define x__VAXUBA_UBAVAR_H_ + +#include +#include +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ubavar.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * This file contains definitions related to the kernel structures + * for dealing with the unibus adapters. + * + * Each uba has a uba_hd structure. + * Each unibus controller which is not a device has a uba_ctlr structure. + * Each unibus device has a uba_device structure. + */ + +#ifndef x_LOCORE +/* + * Per-uba structure. + * + * This structure holds the interrupt vector for the uba, + * and its address in physical and virtual space. At boot time + * we determine the devices attached to the uba's and their + * interrupt vectors, filling in uh_vec. We free the map + * register and bdp resources of the uba into the structures + * defined here. + * + * During normal operation, resources are allocated and returned + * to the structures here. We watch the number of passive releases + * on each uba, and if the number is excessive may reset the uba. + * + * When uba resources are needed and not available, or if a device + * which can tolerate no other uba activity (rk07) gets on the bus, + * then device drivers may have to wait to get to the bus and are + * queued here. It is also possible for processes to block in + * the unibus driver in resource wait (mrwant, bdpwant); these + * wait states are also recorded here. + */ +struct x_uba_hd { + struct x_uba_regs *x_uh_uba; /* virt addr of uba */ + struct x_uba_regs *x_uh_physuba; /* phys addr of uba */ + x_int (**x_uh_vec)(); /* interrupt vector */ + struct x_uba_device *x_uh_actf; /* head of queue to transfer */ + struct x_uba_device *x_uh_actl; /* tail of queue to transfer */ + x_short x_uh_mrwant; /* someone is waiting for map reg */ + x_short x_uh_bdpwant; /* someone awaits bdp's */ + x_int x_uh_bdpfree; /* free bdp's */ + x_int x_uh_hangcnt; /* number of ticks hung */ + x_int x_uh_zvcnt; /* number of recent 0 vectors */ + x_long x_uh_zvtime; /* time over which zvcnt accumulated */ + x_int x_uh_zvtotal; /* total number of 0 vectors */ + x_int x_uh_errcnt; /* number of errors */ + x_int x_uh_lastiv; /* last free interrupt vector */ + x_short x_uh_users; /* transient bdp use count */ + x_short x_uh_xclu; /* an rk07 is using this uba! */ + x_int x_uh_lastmem; /* limit of any unibus memory */ +#define x_UAMSIZ 100 + struct x_map *x_uh_map; /* buffered data path regs free */ +}; + +#ifndef x_LOCORE +/* + * Per-controller structure. + * (E.g. one for each disk and tape controller, and other things + * which use and release buffered data paths.) + * + * If a controller has devices attached, then there are + * cross-referenced uba_drive structures. + * This structure is the one which is queued in unibus resource wait, + * and saves the information about unibus resources which are used. + * The queue of devices waiting to transfer is also attached here. + */ +struct x_uba_ctlr { + struct x_uba_driver *x_um_driver; + x_short x_um_ctlr; /* controller index in driver */ + x_short x_um_ubanum; /* the uba it is on */ + x_short x_um_alive; /* controller exists */ + x_int (**x_um_intr)(); /* interrupt handler(s) */ + x_caddr_t x_um_addr; /* address of device in i/o space */ + struct x_uba_hd *x_um_hd; +/* the driver saves the prototype command here for use in its go routine */ + x_int x_um_cmd; /* communication to dgo() */ + x_int x_um_ubinfo; /* save unibus registers, etc */ + struct x_buf x_um_tab; /* queue of devices for this controller */ +}; + +/* + * Per ``device'' structure. + * (A controller has devices or uses and releases buffered data paths). + * (Everything else is a ``device''.) + * + * If a controller has many drives attached, then there will + * be several uba_device structures associated with a single uba_ctlr + * structure. + * + * This structure contains all the information necessary to run + * a unibus device such as a dz or a dh. It also contains information + * for slaves of unibus controllers as to which device on the slave + * this is. A flags field here can also be given in the system specification + * and is used to tell which dz lines are hard wired or other device + * specific parameters. + */ +struct x_uba_device { + struct x_uba_driver *x_ui_driver; + x_short x_ui_unit; /* unit number on the system */ + x_short x_ui_ctlr; /* mass ctlr number; -1 if none */ + x_short x_ui_ubanum; /* the uba it is on */ + x_short x_ui_slave; /* slave on controller */ + x_int (**x_ui_intr)(); /* interrupt handler(s) */ + x_caddr_t x_ui_addr; /* address of device in i/o space */ + x_short x_ui_dk; /* if init 1 set to number for iostat */ + x_int x_ui_flags; /* parameter from system specification */ + x_short x_ui_alive; /* device exists */ + x_short x_ui_type; /* driver specific type information */ + x_caddr_t x_ui_physaddr; /* phys addr, for standalone (dump) code */ +/* this is the forward link in a list of devices on a controller */ + struct x_uba_device *x_ui_forw; +/* if the device is connected to a controller, this is the controller */ + struct x_uba_ctlr *x_ui_mi; + struct x_uba_hd *x_ui_hd; +}; +#endif + +/* + * Per-driver structure. + * + * Each unibus driver defines entries for a set of routines + * as well as an array of types which are acceptable to it. + * These are used at boot time by the configuration program. + */ +struct x_uba_driver { + x_int (*x_ud_probe)(); /* see if a driver is really there */ + x_int (*x_ud_slave)(); /* see if a slave is there */ + x_int (*x_ud_attach)(); /* setup driver for a slave */ + x_int (*x_ud_dgo)(); /* fill csr/ba to start transfer */ + x_u_short *x_ud_addr; /* device csr addresses */ + char *x_ud_dname; /* name of a device */ + struct x_uba_device **x_ud_dinfo; /* backpointers to ubdinit structs */ + char *x_ud_mname; /* name of a controller */ + struct x_uba_ctlr **x_ud_minfo; /* backpointers to ubminit structs */ + x_short x_ud_xclu; /* want exclusive use of bdp's */ + x_int (*x_ud_ubamem)(); /* see if dedicated memory is present */ +}; +#endif + +/* + * Flags to UBA map/bdp allocation routines + */ +#define x_UBA_NEEDBDP 0x01 /* transfer needs a bdp */ +#define x_UBA_CANTWAIT 0x02 /* don't block me */ +#define x_UBA_NEED16 0x04 /* need 16 bit addresses only */ +#define x_UBA_HAVEBDP 0x08 /* use bdp specified in high bits */ + +/* + * Macros to bust return word from map allocation routines. + */ +#define x_UBAI_BDP(x_i) ((x_int)(((unsigned)(x_i))>>28)) +#define x_UBAI_NMR(x_i) ((x_int)((x_i)>>18)&0x3ff) +#define x_UBAI_MR(x_i) ((x_int)((x_i)>>9)&0x1ff) +#define x_UBAI_BOFF(x_i) ((x_int)((x_i)&0x1ff)) +#define x_UBAI_ADDR(x_i) ((x_int)((x_i)&0x3ffff)) /* uba addr (boff+mr) */ + +#ifndef x_LOCORE +#ifdef x_KERNEL +/* + * UBA related kernel variables + */ +x_int x_numuba; /* number of uba's */ +struct x_uba_hd x_uba_hd[]; + +/* + * Ubminit and ubdinit initialize the mass storage controller and + * device tables specifying possible devices. + */ +extern struct x_uba_ctlr x_ubminit[]; +extern struct x_uba_device x_ubdinit[]; + +/* + * UNIbus device address space is mapped by UMEMmap + * into virtual address umem[][]. + */ +extern struct x_pte x_UMEMmap[][512]; /* uba device addr pte's */ +extern char x_umem[][512*x_NBPG]; /* uba device addr space */ + +/* + * Since some VAXen vector their unibus interrupts + * just adjacent to the system control block, we must + * allocate space there when running on ``any'' cpu. This space is + * used for the vectors for uba0 and uba1 on all cpu's. + */ +extern x_int (*x_UNIvec[])(); /* unibus vec for uba0 */ +#if x_NUBA > 1 +extern x_int (*x_UNI1vec[])(); /* unibus vec for uba1 */ +#endif + +#if defined(x_VAX780) || defined(x_VAX8600) +/* + * On 780's, we must set the scb vectors for the nexus of the + * UNIbus adaptors to vector to locore unibus adaptor interrupt dispatchers + * which make 780's look like the other VAXen. + */ +/*extern Xua0int(), Xua1int(), Xua2int(), Xua3int();*/ +#endif +#endif +#endif + +#endif diff --git a/x_include/vaxuba/x_udareg.h b/x_include/vaxuba/x_udareg.h new file mode 100644 index 0000000..fcc56f1 --- /dev/null +++ b/x_include/vaxuba/x_udareg.h @@ -0,0 +1,63 @@ +#include "x_.h" + +#ifndef x__VAXUBA_UDAREG_H_ +#define x__VAXUBA_UDAREG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)udareg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * UDA-50 registers and structures + */ + +struct x_udadevice { + x_short x_udaip; /* initialization and polling */ + x_short x_udasa; /* status and address */ +}; + +#define x_UDA_ERR 0100000 /* error bit */ +#define x_UDA_STEP4 0040000 /* step 4 has started */ +#define x_UDA_STEP3 0020000 /* step 3 has started */ +#define x_UDA_STEP2 0010000 /* step 2 has started */ +#define x_UDA_STEP1 0004000 /* step 1 has started */ +#define x_UDA_NV 0002000 /* no host settable interrupt vector */ +#define x_UDA_QB 0001000 /* controller supports Q22 bus */ +#define x_UDA_DI 0000400 /* controller implements diagnostics */ +#define x_UDA_IE 0000200 /* interrupt enable */ +#define x_UDA_PI 0000001 /* host requests adapter purge interrupts */ +#define x_UDA_GO 0000001 /* start operation, after init */ + +/* + * UDA Communications Area + */ + +struct x_udaca { + x_short x_ca_xxx1; /* unused */ + char x_ca_xxx2; /* unused */ + char x_ca_bdp; /* BDP to purge */ + x_short x_ca_cmdint; /* command queue transition interrupt flag */ + x_short x_ca_rspint; /* response queue transition interrupt flag */ + x_long x_ca_rspdsc[x_NRSP];/* response descriptors */ + x_long x_ca_cmddsc[x_NCMD];/* command descriptors */ +}; + +#define x_ca_ringbase x_ca_rspdsc[0] + +#define x_UDA_OWN 0x80000000 /* UDA owns this descriptor */ +#define x_UDA_INT 0x40000000 /* allow interrupt on ring transition */ + +/* + * MSCP packet info + */ +struct x_mscp_header { + x_short x_uda_msglen; /* length of MSCP packet */ + char x_uda_credits; /* low 4 bits: credits, high 4 bits: msgtype */ + char x_uda_vcid; /* virtual circuit id */ +}; + +#endif diff --git a/x_include/vaxuba/x_upreg.h b/x_include/vaxuba/x_upreg.h new file mode 100644 index 0000000..dffee53 --- /dev/null +++ b/x_include/vaxuba/x_upreg.h @@ -0,0 +1,174 @@ +#include "x_.h" + +#ifndef x__VAXUBA_UPREG_H_ +#define x__VAXUBA_UPREG_H_ + +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)upreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * Unibus rm emulation via sc21: + * registers and bits. + */ + +struct x_updevice { + x_u_short x_upcs1; /* control and status register 1 */ + x_short x_upwc; /* word count register */ + x_u_short x_upba; /* UNIBUS address register */ + x_u_short x_upda; /* desired address register */ + x_u_short x_upcs2; /* control and status register 2 */ + x_u_short x_upds; /* drive Status */ + x_u_short x_uper1; /* error register 1 */ + x_u_short x_upas; /* attention summary */ + x_u_short x_upla; /* look ahead */ + x_u_short x_updb; /* data buffer */ + x_u_short x_upmr; /* maintenance */ + x_u_short x_updt; /* drive type */ + x_u_short x_upsn; /* serial number */ + x_u_short x_upof; /* offset register */ + x_u_short x_updc; /* desired cylinder address register */ + x_u_short x_uphr; /* holding register */ + x_u_short x_upmr2; /* maintenance register 2 */ + x_u_short x_uper2; /* error register 2 */ + x_u_short x_upec1; /* burst error bit position */ + x_u_short x_upec2; /* burst error bit pattern */ +}; + +/* Other bits of upcs1 */ +#define x_UP_SC 0100000 /* special condition */ +#define x_UP_TRE 0040000 /* transfer error */ +#define x_UP_PSEL 0010000 /* port select */ +#define x_UP_DVA 0004000 /* drive available */ +/* bits 8 and 9 are the extended address bits */ +#define x_UP_RDY 0000200 /* controller ready */ +#define x_UP_IE 0000100 /* interrupt enable */ +/* bits 5-1 are the command */ +#define x_UP_GO 0000001 + +/* commands */ +#define x_UP_NOP 000 +#define x_UP_SEEK 004 /* seek */ +#define x_UP_RECAL 006 /* recalibrate */ +#define x_UP_DCLR 010 /* drive clear */ +#define x_UP_RELEASE 012 /* release */ +#define x_UP_OFFSET 014 /* offset */ +#define x_UP_RTC 016 /* return to center-line */ +#define x_UP_PRESET 020 /* read-in preset */ +#define x_UP_PACK 022 /* pack acknowledge */ +#define x_UP_DMABAND 024 /* dma bandwidth set */ +#define x_UP_SEARCH 030 /* search */ +#define x_UP_WCDATA 050 /* write check data */ +#define x_UP_WCHDR 052 /* write check header and data */ +#define x_UP_WCOM 060 /* write */ +#define x_UP_WHDR 062 /* write header and data */ +#define x_UP_RCOM 070 /* read data */ +#define x_UP_RHDR 072 /* read header and data */ +#define x_UP_BOOT 074 /* boot */ +#define x_UP_FORMAT 076 /* format */ + +/* upcs2 */ +#define x_UPCS2_DLT 0100000 /* data late */ +#define x_UPCS2_WCE 0040000 /* write check error */ +#define x_UPCS2_UPE 0020000 /* UNIBUS parity error */ +#define x_UPCS2_NED 0010000 /* nonexistent drive */ +#define x_UPCS2_NEM 0004000 /* nonexistent memory */ +#define x_UPCS2_PGE 0002000 /* programming error */ +#define x_UPCS2_MXF 0001000 /* missed transfer */ +#define x_UPCS2_MDPE 0000400 /* massbus data parity error (0) */ +#define x_UPCS2_OR 0000200 /* output ready */ +#define x_UPCS2_IR 0000100 /* input ready */ +#define x_UPCS2_CLR 0000040 /* controller clear */ +#define x_UPCS2_PAT 0000020 /* parity test */ +#define x_UPCS2_BAI 0000010 /* address increment inhibit */ +/* bits 0-2 are drive select */ + +#define x_UPCS2_BITS \ +"\10\20DLT\17WCE\16UPE\15NED\14NEM\13PGE\12MXF\11MDPE\ +\10x_OR\7x_IR\6x_CLR\5x_PAT\4x_BAI" + +/* upds */ +#define x_UPDS_ATA 0100000 /* attention active */ +#define x_UPDS_ERR 0040000 /* composite drive error */ +#define x_UPDS_PIP 0020000 /* positioning in progress */ +#define x_UPDS_MOL 0010000 /* medium on line */ +#define x_UPDS_WRL 0004000 /* write locked */ +#define x_UPDS_LST 0002000 /* last sector transferred */ +#define x_UPDS_PGM 0001000 /* programmable */ +#define x_UPDS_DPR 0000400 /* drive present */ +#define x_UPDS_DRY 0000200 /* drive ready */ +#define x_UPDS_VV 0000100 /* volume valid */ +/* bits 1-5 are spare */ +#define x_UPDS_OM 0000001 /* offset mode */ + +#define x_UPDS_DREADY (x_UPDS_DPR|x_UPDS_DRY|x_UPDS_MOL|x_UPDS_VV) + +#define x_UPDS_BITS \ +"\10\20ATA\17ERR\16PIP\15MOL\14WRL\13LST\12PGM\11DPR\10DRY\7VV\1OM" + +/* uper1 */ +#define x_UPER1_DCK 0100000 /* data check */ +#define x_UPER1_UNS 0040000 /* drive unsafe */ +#define x_UPER1_OPI 0020000 /* operation incomplete */ +#define x_UPER1_DTE 0010000 /* drive timing error */ +#define x_UPER1_WLE 0004000 /* write lock error */ +#define x_UPER1_IAE 0002000 /* invalid address error */ +#define x_UPER1_AOE 0001000 /* address overflow error */ +#define x_UPER1_HCRC 0000400 /* header crc error */ +#define x_UPER1_HCE 0000200 /* header compare error */ +#define x_UPER1_ECH 0000100 /* ecc hard error */ +#define x_UPER1_WCF 0000040 /* write clock fail (0) */ +#define x_UPER1_FER 0000020 /* format error */ +#define x_UPER1_PAR 0000010 /* parity error */ +#define x_UPER1_RMR 0000004 /* register modification refused */ +#define x_UPER1_ILR 0000002 /* illegal register */ +#define x_UPER1_ILF 0000001 /* illegal function */ + +#define x_UPER1_BITS \ +"\10\20DCK\17UNS\16OPI\15DTE\14WLE\13IAE\12AOE\11HCRC\10HCE\ +\7Ex_CH\6x_WCF\5x_FER\4x_PAR\3x_RMR\2x_ILR\1x_ILF" + +/* uphr */ +/* write these int uphr and then read back values */ +#define x_UPHR_MAXCYL 0100027 /* max cyl address */ +#define x_UPHR_MAXTRAK 0100030 /* max track address */ +#define x_UPHR_MAXSECT 0100031 /* max sector address */ + +/* uper2 */ +#define x_UPER2_BSE 0100000 /* bad sector error */ +#define x_UPER2_SKI 0040000 /* seek incomplete */ +#define x_UPER2_OPE 0020000 /* operator plug error */ +#define x_UPER2_IVC 0010000 /* invalid command */ +#define x_UPER2_LSC 0004000 /* loss of sector clock */ +#define x_UPER2_LBC 0002000 /* loss of bit clock */ +#define x_UPER2_MDS 0001000 /* multiple drive select */ +#define x_UPER2_DCU 0000400 /* dc power unsafe */ +#define x_UPER2_DVC 0000200 /* device check */ +#define x_UPER2_ACU 0000100 /* ac power unsafe */ +/* bits 5 and 4 are spare */ +#define x_UPER2_DPE 0000010 /* data parity error (0) */ +/* bits 2-0 are spare */ + +#define x_UPER2_BITS \ +"\10\20BSE\17SKI\16OPE\15IVC\14LSC\13LBC\12MDS\11DCU\10DVC\7ACU\4DPE" + +/* upof */ +#define x_UPOF_FMT22 0010000 /* 16 bit format */ +#define x_UPOF_ECI 0004000 /* ecc inhibit */ +#define x_UPOF_HCI 0002000 /* header compare inhibit */ + +/* THE SC21 ACTUALLY JUST IMPLEMENTS ADVANCE/RETARD... */ +#define x_UPOF_P400 0020 /* +400 uinches */ +#define x_UPOF_M400 0220 /* -400 uinches */ +#define x_UPOF_P800 0040 /* +800 uinches */ +#define x_UPOF_M800 0240 /* -800 uinches */ +#define x_UPOF_P1200 0060 /* +1200 uinches */ +#define x_UPOF_M1200 0260 /* -1200 uinches */ + +#endif diff --git a/x_include/vaxuba/x_utreg.h b/x_include/vaxuba/x_utreg.h new file mode 100644 index 0000000..fb073f2 --- /dev/null +++ b/x_include/vaxuba/x_utreg.h @@ -0,0 +1,185 @@ +#include "x_.h" + +#ifndef x__VAXUBA_UTREG_H_ +#define x__VAXUBA_UTREG_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)utreg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * System Industries Model 9700 Tape Drive + * emulates TU45 on the UNIBUS + */ + +struct x_utdevice { + x_u_short x_utcs1; /* control status register 1 */ + x_short x_utwc; /* word count register */ + x_u_short x_utba; /* low 16-bits of bus address */ + x_short x_utfc; /* frame counter */ + x_u_short x_utcs2; /* control status register 2 */ + x_u_short x_utds; /* drive status register */ + x_u_short x_uter; /* error register */ + x_u_short x_utas; /* attention status register */ + x_u_short x_utcc; /* NRZI CRC character for validation */ + x_u_short x_utdb; /* data buffer reg (not emulated) */ + x_u_short x_utmr; /* maintenance reg (not emulated) */ + x_u_short x_utdt; /* drive type register (not emulated) */ + x_u_short x_utsn; /* serial number reg (not emulated) */ + x_u_short x_uttc; /* tape control register */ + x_u_short x_utbae; /* buffer address extension register */ + x_u_short x_utcs3; /* control and status register 3 */ +}; + +/* + * utcs1 -- + * cmds, interrupt enable, extended address bits, and status + */ +#define x_UT_GO 0x0001 /* go bit */ +/* function codes reside in bits 5-1 */ +#define x_UT_NOP 0x0000 /* no operation */ +#define x_UT_REWOFFL 0x0002 /* rewind offline */ +#define x_UT_LOOP 0x0004 /* loop read/write */ +#define x_UT_REW 0x0006 /* rewind */ +#define x_UT_CLEAR 0x0008 /* drive clear */ +#define x_UT_SENSE 0x000a /* drive sense */ +#define x_UT_PRESET 0x0010 /* read in preset */ +#define x_UT_DIAGN 0x0012 /* diagnostic mode set */ +#define x_UT_ERASE 0x0014 /* erase */ +#define x_UT_WEOF 0x0016 /* write tape mark */ +#define x_UT_SFORW 0x0018 /* forward space block */ +#define x_UT_SREV 0x001a /* reverse space block */ +#define x_UT_SFORWF 0x001c /* forward space file */ +#define x_UT_SREVF 0x001e /* reverse space file */ +#define x_UT_WCHFORW 0x0028 /* write check forward */ +#define x_UT_WCHREV 0x002e /* write check reverse */ +#define x_UT_WCOM 0x0030 /* write forward */ +#define x_UT_RCOM 0x0038 /* read forward */ +#define x_UT_RREV 0x003e /* read reverse */ +/* the remainder are control and status bits */ +#define x_UT_IE 0x0040 /* interrupt-enable */ +#define x_UT_RDY 0x0080 /* controller ready */ +#define x_UT_EADDR 0x0300 /* extended address bits */ +/* bit 10 unused */ +#define x_UT_DVA 0x0800 /* drive available */ +/* bit 12 unused */ +/* bit 13 - massbus control parity error not emulated */ +#define x_UT_TRE 0x4000 /* transfer error */ +#define x_UT_SC 0x8000 /* special condition */ + +#define x_UT_BITS \ +"\10\20SC\17TRE\14DVA\10RDY\7IE\1GO" + +/* + * utcs2 -- + * controller clear, error flags, and unit select + */ +/* bits 0-2 are unit select */ +#define x_UTCS2_BAI 0x0008 /* UNIBUS address increment inhibit */ +#define x_UTCS2_PAT 0x0010 /* parity test */ +#define x_UTCS2_CLR 0x0020 /* controller clear */ +#define x_UTCS2_IR 0x0040 /* input ready (not emulated) */ +#define x_UTCS2_OR 0x0080 /* output ready (not emulated) */ +#define x_UTCS2_RPE 0x0100 /* rom parity error */ +#define x_UTCS2_MXF 0x0200 /* missed transfer */ +#define x_UTCS2_NEM 0x0400 /* non existant memory */ +#define x_UTCS2_PGE 0x0800 /* program error */ +#define x_UTCS2_NED 0x1000 /* non existent drive */ +#define x_UTCS2_PE 0x2000 /* parity error */ +#define x_UTCS2_WCE 0x4000 /* write check error */ +#define x_UTCS2_DLT 0x8000 /* data late */ + +#define x_UTCS2_BITS \ +"\10\20DLT\17WCE\16PE\15NED\14\NEM\13\PGE\12\MXF\11RPE\10OR\7IR\6CLR\5PAT\4\BAI" + +/* + * utds -- + * beginning of tape, end of tape, error summary bit, plus lots more + */ +#define x_UTDS_SLA 0x0001 /* slave attention */ +#define x_UTDS_BOT 0x0002 /* beginning of tape */ +#define x_UTDS_TM 0x0004 /* tape mark */ +#define x_UTDS_IDB 0x0008 /* identification burst */ +#define x_UTDS_SDWN 0x0010 /* slowing down */ +#define x_UTDS_PES 0x0020 /* phase encode status */ +#define x_UTDS_SSC 0x0040 /* slave status change */ +#define x_UTDS_DRY 0x0080 /* drive ready */ +#define x_UTDS_DPR 0x0100 /* drive present (always 1) */ +#define x_UTDS_GCR 0x0200 /* GCR status */ +#define x_UTDS_EOT 0x0400 /* end of tape */ +#define x_UTDS_WRL 0x0800 /* write lock */ +#define x_UTDS_MOL 0x1000 /* medium on line */ +#define x_UTDS_PIP 0x2000 /* positioning in progress */ +#define x_UTDS_ERR 0x4000 /* composite error */ +#define x_UTDS_ATA 0x8000 /* attention active */ + +#define x_UTDS_BITS \ +"\10\20ATA\17ERR\16PIP\15MOL\14WRL\13EOT\12GCR\11DPR\10DRY\ +\7x_SSC\6x_PES\5x_SDWN\4x_IDB\3x_TM\2x_BOT\1x_SLA" + +/* + * uter -- + * detailed breakdown of error summary bit from cs2 + */ +#define x_UTER_ILF 0x0001 /* illegal function */ +#define x_UTER_ILR 0x0002 /* illegal register (always 0) */ +#define x_UTER_RMR 0x0004 /* register modification refused */ +#define x_UTER_RPE 0x0008 /* read data parity error */ +#define x_UTER_FMT 0x0010 /* format error */ +#define x_UTER_DPAR 0x0020 /* data bus parity error */ +#define x_UTER_INC 0x0040 /* incorrectable data */ +#define x_UTER_PEF 0x0080 /* PE format error */ +#define x_UTER_NSG 0x0100 /* non standard gap */ +#define x_UTER_FCE 0x0200 /* frame count error */ +#define x_UTER_CS 0x0400 /* correctable skew */ +#define x_UTER_NEF 0x0800 /* non executable function */ +#define x_UTER_DTE 0x1000 /* drive timing error */ +#define x_UTER_OPI 0x2000 /* operation incomplete */ +#define x_UTER_UNS 0x4000 /* unsafe */ +#define x_UTER_COR 0x8000 /* correctible data error */ + +/* + * These errors we consider "hard"; UTER_OPI and UTER_RPE + * are considered "soft", at least for the moment. + */ +#define x_UTER_HARD (x_UTER_UNS|x_UTER_NEF|x_UTER_DPAR|x_UTER_FMT|x_UTER_RMR|\ + x_UTER_ILR|x_UTER_ILF) + +#define x_UTER_BITS \ +"\10\20COR\17UNS\16OPI\15DTE\14NEF\13CS\12FCE\11NSG\10PEF\ +\7x_INC\6Dx_PAR\5x_FMT\4x_RPE\3x_RMR\2x_ILR\1x_ILF" + +/* + * uttc -- + * tape format and density + */ +/* bits 0-2 are slave select */ +#define x_UTTC_EVPAR 0x0008 /* even parity */ +#define x_UTTC_FMT 0x00f0 /* format select (see below) */ +#define x_UTTC_DEN 0x0700 /* density select (see below) */ +/* bit 11 not used */ +#define x_UTTC_EAODTE 0x1000 /* (not emulated) */ +#define x_UTTC_TCW 0x2000 /* tape control write */ +#define x_UTTC_FCS 0x4000 /* frame count status */ +#define x_UTTC_ACCL 0x8000 /* acceleration */ + +/* the bits to stuff in UTTC_DEN */ +#define x_UT_NRZI 0x0000 /* 800 bpi code */ +#define x_UT_PE 0x0400 /* 1600 bpi code */ +#define x_UT_GCR 0x0500 /* 6250 bpi code */ + +/* tape formats - only PDP-11 standard is supported */ +#define x_PDP11FMT 0x00c0 /* PDP-11 standard */ + +#define x_b_repcnt x_b_bcount +#define x_b_command x_b_resid +#define x_b_state x_b_active + +#endif diff --git a/x_include/vaxuba/x_uureg.h b/x_include/vaxuba/x_uureg.h new file mode 100644 index 0000000..1de7b3a --- /dev/null +++ b/x_include/vaxuba/x_uureg.h @@ -0,0 +1,42 @@ +#include "x_.h" + +#ifndef x__VAXUBA_UUREG_H_ +#define x__VAXUBA_UUREG_H_ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)uureg.h 7.1 (Berkeley) 6/5/86 + */ + +/* + * DL11-E/DL11-W UNIBUS (for TU58) controller registers + */ +struct x_uudevice { + x_short x_rcs; /* receiver status register */ + x_short x_rdb; /* receiver data buffer register */ + x_short x_tcs; /* transmitter status register */ + x_short x_tdb; /* transmitter data buffer register */ +}; + +/* + * Receiver/transmitter status register status/command bits + */ +#define x_UUCS_DONE 0x80 /* done/ready */ +#define x_UUCS_READY 0x80 +#define x_UUCS_INTR 0x40 /* interrupt enable */ +#define x_UUCS_MAINT 0x02 /* maintenance check (xmitter only) */ +#define x_UUCS_BREAK 0x01 /* send break (xmitter only) */ + +/* + * Receiver data buffer register status bits + */ +#define x_UURDB_ERROR 0x8000 /* Error (overrun or break) */ +#define x_UURDB_ORUN 0x4000 /* Data overrun error */ +#define x_UURDB_BREAK 0x2000 /* TU58 break */ + +#define x_UUDB_DMASK 0x00ff /* data mask (send and receive data) */ + +#endif diff --git a/x_include/vaxuba/x_vpreg.h b/x_include/vaxuba/x_vpreg.h new file mode 100644 index 0000000..650b274 --- /dev/null +++ b/x_include/vaxuba/x_vpreg.h @@ -0,0 +1,42 @@ +#include "x_.h" + +#ifndef x__VAXUBA_VPREG_H_ +#define x__VAXUBA_VPREG_H_ + +#include +#include + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)vpreg.h 7.1 (Berkeley) 6/5/86 + */ + +#define x_VPPRI (x_PZERO-1) + +struct x_vpdevice { + x_short x_plbcr; + x_short x_pbxaddr; + x_short x_prbcr; + x_u_short x_pbaddr; + x_short x_plcsr; + x_short x_plbuf; + x_short x_prcsr; + x_u_short x_prbuf; +}; + +#define x_VP_ERROR 0100000 +#define x_VP_DTCINTR 0040000 +#define x_VP_DMAACT 0020000 +#define x_VP_READY 0000200 +#define x_VP_IENABLE 0000100 +#define x_VP_TERMCOM 0000040 +#define x_VP_FFCOM 0000020 +#define x_VP_EOTCOM 0000010 +#define x_VP_CLRCOM 0000004 +#define x_VP_RESET 0000002 +#define x_VP_SPP 0000001 + +#endif diff --git a/x_include/vaxuba/x_vsreg.h b/x_include/vaxuba/x_vsreg.h new file mode 100644 index 0000000..c7898c8 --- /dev/null +++ b/x_include/vaxuba/x_vsreg.h @@ -0,0 +1,242 @@ +#include "x_.h" + +#ifndef x__VAXUBA_VSREG_H_ +#define x__VAXUBA_VSREG_H_ + +#include + +/* @(#)vsreg.h 7.1 (MIT) 6/5/86 */ + /**************************************************************************** + * * + * Copyright (c) 1983, 1984 by * + * DIGITAL EQUIPMENT CORPORATION, Maynard, Massachusetts. * + * All rights reserved. * + * * + * This software is furnished on an as-is basis and may be used and copied * + * only with inclusion of the above copyright notice. This software or any * + * other copies thereof may be provided or otherwise made available to * + * others only for non-commercial purposes. No title to or ownership of * + * the software is hereby transferred. * + * * + * The information in this software is subject to change without notice * + * and should not be construed as a commitment by DIGITAL EQUIPMENT * + * CORPORATION. * + * * + * DIGITAL assumes no responsibility for the use or reliability of its * + * software on equipment which is not supplied by DIGITAL. * + * * + * * + ****************************************************************************/ + +/* + * vsreg.h - VS100 Registers and Bits + * + * Author: Christopher A. Kent + * Digital Equipment Corporation + * Western Research Lab + * Date: Tue Jun 14 1983 + */ + +struct x_vsdevice{ + x_u_short x_vs_csr0; /* Control and Status */ + x_u_short x_vs_csr1; /* Interrupt Reason */ + x_u_short x_vs_csr2; /* Keyboard Receive */ + x_u_short x_vs_csr3; /* Function Parameter Low */ + x_u_short x_vs_csr4; /* Function Parameter High */ + x_u_short x_vs_csr5; /* Cursor Position X */ + x_u_short x_vs_csr6; /* Cursor Position Y */ + x_u_short x_vs_csr7; /* Interrupt Vector */ + x_u_short x_vs_csr8; /* Spare 1 */ + x_u_short x_vs_csr9; /* Spare 2 */ + x_u_short x_vs_csra; /* Spare 3 */ + x_u_short x_vs_csrb; /* Spare 4 */ + x_u_short x_vs_csrc; /* Spare 5 */ + x_u_short x_vs_csrd; /* Spare 6 */ + x_u_short x_vs_csre; /* Spare 7 */ + x_u_short x_vs_csrf; /* Interrupt Vector (2Bs) */ +}; + +/* + * CSR0 - Control and Status + */ + +#define x_VS_LNK_TRNS 0100000 /* Link Transition */ +#define x_VS_LNK_AVL 0040000 /* Link Available */ +#define x_VS_LNK_ERR 0020000 /* Link Error */ +#define x_VS_XMIT_ON 0010000 /* Transmitter On */ +#define x_VS_MNT_MODE 0004000 /* Maintenance Mode */ +#define x_VS_CRC_DIS 0002000 /* CRC Disable */ +#define x_VS_MNT_DONE 0001000 /* Maintenance Done */ +#define x_VS_SPARE 0000400 /* Spare */ +#define x_VS_OWN 0000200 /* Owner */ +#define x_VS_IE 0000100 /* Interrupt Enable */ +#define x_VS_FCN 0000076 /* Function Code */ +#define x_VS_GO 0000001 /* GO! */ + +struct x_vs_csr{ + union{ + x_u_short x__register; + struct{ + unsigned x__go : 1; + unsigned x__function : 5; + unsigned x__ie : 1; + unsigned x__own : 1; + unsigned x__spare : 1; + unsigned x__mainDone : 1; + unsigned x__CRCdisable : 1; + unsigned x__mainMode : 1; + unsigned x__xmitOn : 1; + unsigned x__linkErr : 1; + unsigned x__linkAvail : 1; + unsigned x__linkTran : 1; + }x__bits; + }x__X; +}; + +#define x_csr_reg x__X.x__register +#define x_csr_go x__X.x__bits.x__go +#define x_csr_ie x__X.x__bits.x__ie +#define x_csr_own x__X.x__bits.x__own +#define x_csr_mainDone x__X.x__bits.x__mainDone +#define x_csr_CRCdisable x__X.x__bits.x__CRCdisable +#define x_csr_mainMode x__X.x__bits.x__mainMode +#define x_csr_xmitOn x__X.x__bits.x__xmitOn +#define x_csr_linkErr x__X.x__bits.x__linkErr +#define x_csr_linkAvail x__X.x__bits.x__linkAvail +#define x_csr_linkTran x__X.x__bits.x__linkTran + +/* Function Codes */ + +#define x_VS_INIT 01 /* Initialize Display */ +#define x_VS_SEND 02 /* Send Packet */ +#define x_VS_START 03 /* Start Microcode */ +#define x_VS_ABORT 04 /* Abort Command Chain */ +#define x_VS_PWRUP 05 /* Power Up Reset */ +/**/ +#define x_VS_ENABBA 020 /* Enable BBA */ +#define x_VS_DISBBA 021 /* Disable BBA */ +#define x_VS_INFINITE 022 /* Inifinite Retries */ +#define x_VS_FINITE 023 /* Finite Retries */ + +/* amount to shift to get function code into right place */ + +#define x_VS_FCSHIFT 01 + +/* + * CSR1 - Interrupt Reason + */ + +#define x_vs_irr x_vs_csr1 + +#define x_VS_ERROR 0100000 /* Any error */ +#define x_VS_REASON 0077777 /* Reason Mask */ +#define x_VSIRR_BITS \ +"\20\20ERROR\10PWRUP\6TABLET\5MOUSE\4BUTTON\3START\2DONE\1INIT" + +#define x_VS_INT_US 0 +#define x_VS_INT_ID 01 +#define x_VS_INT_CD 02 +#define x_VS_INT_SE 04 +#define x_VS_INT_BE 010 +#define x_VS_INT_MM 020 +#define x_VS_INT_TM 040 +#define x_VS_INT_PWR 0200 + +struct x_vs_intr{ + union{ + x_u_short x__register; /* whole register */ + struct{ + unsigned x__reason : 14; /* Reason bits */ + unsigned x__diagnostic : 1; /* Diagnostic Error bit */ + unsigned x__error : 1; /* Error bit */ + }x__bits; + }x__X; +}; + +#define x_intr_reg x__X.x__register +#define x_intr_reason x__X.x__bits.x__reason +#define x_intr_diagnostic x__X.x__bits.x__diagnostic /* not in rev 2b */ +#define x_intr_error x__X.x__bits.x__error + +/* + * CSR2 - Keyboard Receive + */ + +#define x_vs_krr x_vs_csr2 + +#define x_VS_KBDEV 0007000 /* Device mask */ +#define x_VS_KBT 0000400 /* Transition direction */ +#define x_VS_KBKEY 0000377 /* Key mask */ + +struct x_vs_kbd{ + union{ + x_u_short x__register; /* whole register */ + struct{ + unsigned x__key : 8; /* Key number */ + unsigned x__transition : 1; /* Transition direction */ + unsigned x__device : 3; /* Device */ + unsigned x__x : 4; /* Unused */ + }x__bits; + }x__X; +}; + +#define x_kbd_reg x__X.x__register +#define x_kbd_key x__X.x__bits.x__key +#define x_kbd_transition x__X.x__bits.x__transition +#define x_kbd_device x__X.x__bits.x__device + +#define x_VS_KBTUP 0 /* up */ +#define x_VS_KBTDOWN 1 /* down */ + +/* + * CSR3/4 Function Parameter Address + */ + +#define x_vs_pr1 x_vs_csr3 +#define x_vs_pr2 x_vs_csr4 + +struct x_vs_fparm{ + union{ + struct{ + x_u_short x__plow; /* low 16 bits of address */ + x_u_short x__phigh; /* high 16 bits of address */ + }x__parts; + x_caddr_t x__pall; + }x__X; +}; +#define x_fparm_low x__X.x__parts.x__plow +#define x_fparm_high x__X.x__parts.x__phigh +#define x_fparm_all x__X.x__pall + +/* + * CSR5/6 - Cursor position + */ + +#define x_vs_cxr x_vs_csr5 +#define x_vs_cyr x_vs_csr6 + +/* + * CSR 7 - Interrupt vector in fiber cable machines + */ + +#define x_vs_ivr x_vs_csr7 + +/* + * CSR 8 through 14 Spare + */ + +#define x_vs_spr2 x_vs_csr8 +#define x_vs_spr3 x_vs_csr9 +#define x_vs_spr4 x_vs_csra +#define x_vs_spr5 x_vs_csrb +#define x_vs_spr6 x_vs_csrc +#define x_vs_spr7 x_vs_csrd +#define x_vs_spr8 x_vs_csre + +/* + * CSR 15 - Interrupt vector in rev 2B + */ + +#define x_vs_ivr2 x_vs_csrf + +#endif diff --git a/x_include/x_.h b/x_include/x_.h new file mode 100644 index 0000000..b3e7c20 --- /dev/null +++ b/x_include/x_.h @@ -0,0 +1,7 @@ +#define X_ +typedef short x_short; +typedef int x_int; +typedef int x_long; +typedef unsigned short x_unsigned_short; +typedef unsigned int x_unsigned_int; +typedef unsigned int x_unsigned_long; diff --git a/x_include/x_a.out.h b/x_include/x_a.out.h new file mode 100644 index 0000000..8bd91fc --- /dev/null +++ b/x_include/x_a.out.h @@ -0,0 +1,51 @@ +#include "x_.h" + +#ifndef x__A_OUT_H_ +#define x__A_OUT_H_ + +#include + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)a.out.h 5.1 (Berkeley) 5/30/85 + */ + +/* + * Definitions of the a.out header + * and magic numbers are shared with + * the kernel. + */ +/*#include */ + +/* + * Macros which take exec structures as arguments and tell whether + * the file has a reasonable magic number or offsets to text|symbols|strings. + */ +#define x_N_BADMAG(x_x) \ + (((x_x).x_a_magic)!=x_OMAGIC && ((x_x).x_a_magic)!=x_NMAGIC && ((x_x).x_a_magic)!=x_ZMAGIC) + +#define x_N_TXTOFF(x_x) \ + ((x_x).x_a_magic==x_ZMAGIC ? 1024 : sizeof (struct x_exec)) +#define x_N_SYMOFF(x_x) \ + (x_N_TXTOFF(x_x) + (x_x).x_a_text+(x_x).x_a_data + (x_x).x_a_trsize+(x_x).x_a_drsize) +#define x_N_STROFF(x_x) \ + (x_N_SYMOFF(x_x) + (x_x).x_a_syms) + +/* + * Format of a relocation datum. + */ +struct x_relocation_info { + x_int x_r_address; /* address which is relocated */ +x_unsigned_int x_r_symbolnum:24, /* local symbol ordinal */ + x_r_pcrel:1, /* was relocated pc relative already */ + x_r_length:2, /* 0=byte, 1=word, 2=long */ + x_r_extern:1, /* does not include value of sym referenced */ + :4; /* nothing, yet */ +}; + +#include + +#endif diff --git a/x_include/x_ar.h b/x_include/x_ar.h new file mode 100644 index 0000000..42dd03e --- /dev/null +++ b/x_include/x_ar.h @@ -0,0 +1,29 @@ +#include "x_.h" + +#ifndef x__AR_H_ +#define x__AR_H_ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ar.h 5.1 (Berkeley) 5/30/85 + */ + +#define x_ARMAG "!\n" +#define x_SARMAG 8 + +#define x_ARFMAG "`\n" + +struct x_ar_hdr { + char x_ar_name[16]; + char x_ar_date[12]; + char x_ar_uid[6]; + char x_ar_gid[6]; + char x_ar_mode[8]; + char x_ar_size[10]; + char x_ar_fmag[2]; +}; + +#endif diff --git a/x_include/x_assert.h b/x_include/x_assert.h new file mode 100644 index 0000000..7f57832 --- /dev/null +++ b/x_include/x_assert.h @@ -0,0 +1,19 @@ +#include "x_.h" + +#ifndef x__ASSERT_H_ +#define x__ASSERT_H_ + +#include +#include + +/* assert.h 4.2 85/01/21 */ + +/*# ifndef NDEBUG*/ +# define x__assert(x_ex) {if (!(x_ex)){x_fprintf(x_stderr,"Assertion failed: file \"%s\", line %d\n", __FILE__, __LINE__);x_exit(1);}} +# define x_assert(x_ex) x__assert(x_ex) +# else +# define x__assert(x_ex) +# define x_assert(x_ex) +/*# endif*/ + +#endif diff --git a/x_include/x_compat-4.1.h b/x_include/x_compat-4.1.h new file mode 100644 index 0000000..571f379 --- /dev/null +++ b/x_include/x_compat-4.1.h @@ -0,0 +1,37 @@ +#include "x_.h" + +#ifndef x__COMPAT_4_1_H_ +#define x__COMPAT_4_1_H_ + +#include +#include +#include +#include +#include +#include +#include + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* compat-4.1/getpw.c */ +x_int x_getpw __P((x_int x_uid, char x_buf[])); + +/* compat-4.1/pause.c */ +x_int x_pause __P((void)); + +/* compat-4.1/rand.c */ +x_int x_srand __P((x_unsigned_int x_x)); +x_int x_rand __P((void)); + +/* compat-4.1/tell.c */ +x_long x_tell __P((x_int x_f)); +#endif + +#endif diff --git a/x_include/x_compat-sys5.h b/x_include/x_compat-sys5.h new file mode 100644 index 0000000..c4b49cb --- /dev/null +++ b/x_include/x_compat-sys5.h @@ -0,0 +1,25 @@ +#include "x_.h" + +#ifndef x__COMPAT_SYS5_H_ +#define x__COMPAT_SYS5_H_ + +#include +#include + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* compat-sys5/getopt.c */ +x_int x_getopt __P((x_int x_nargc, char **x_nargv, char *x_ostr)); + +/* compat-sys5/tmpnam.c */ +char *x_tmpnam __P((char *x_s)); +#endif + +#endif diff --git a/x_include/x_csu.h b/x_include/x_csu.h new file mode 100644 index 0000000..b2bb791 --- /dev/null +++ b/x_include/x_csu.h @@ -0,0 +1,34 @@ +#include "x_.h" + +#ifndef x__CSU_H_ +#define x__CSU_H_ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* csu/crt0.c */ +x_int x_start __P((void)); +x_int x_exit __P((register x_int x_code)); +x_int x_moncontrol __P((x_int x_val)); + +/* csu/gmon.c */ +x_int x_monstartup __P((char *x_lowpc, char *x_highpc)); +x_int x__mcleanup __P((void)); +x_int x_mcount __P((void)); +x_int x_monitor __P((char *x_lowpc, char *x_highpc, char *x_buf, x_int x_bufsiz, x_int x_nfunc)); +x_int x_moncontrol __P((x_int x_mode)); + +/* csu/mon.c */ +x_int x_monstartup __P((char *x_lowpc, char *x_highpc)); +x_int x_mcount __P((void)); +x_int x_monitor __P((char *x_lowpc, char *x_highpc, char *x_buf, x_int x_bufsiz, x_int x_cntsiz)); +x_int x_moncontrol __P((x_int x_mode)); +#endif + +#endif diff --git a/x_include/x_ctype.h b/x_include/x_ctype.h new file mode 100644 index 0000000..bbb07fd --- /dev/null +++ b/x_include/x_ctype.h @@ -0,0 +1,35 @@ +#include "x_.h" + +#ifndef x__CTYPE_H_ +#define x__CTYPE_H_ + +/* ctype.h 4.2 85/09/04 */ + +#define x__U 01 +#define x__L 02 +#define x__N 04 +#define x__S 010 +#define x__P 020 +#define x__C 040 +#define x__X 0100 +#define x__B 0200 + +extern char x__ctype_[]; + +#define x_isalpha(x_c) ((x__ctype_+1)[x_c]&(x__U|x__L)) +#define x_isupper(x_c) ((x__ctype_+1)[x_c]&x__U) +#define x_islower(x_c) ((x__ctype_+1)[x_c]&x__L) +#define x_isdigit(x_c) ((x__ctype_+1)[x_c]&x__N) +#define x_isxdigit(x_c) ((x__ctype_+1)[x_c]&(x__N|x__X)) +#define x_isspace(x_c) ((x__ctype_+1)[x_c]&x__S) +#define x_ispunct(x_c) ((x__ctype_+1)[x_c]&x__P) +#define x_isalnum(x_c) ((x__ctype_+1)[x_c]&(x__U|x__L|x__N)) +#define x_isprint(x_c) ((x__ctype_+1)[x_c]&(x__P|x__U|x__L|x__N|x__B)) +#define x_isgraph(x_c) ((x__ctype_+1)[x_c]&(x__P|x__U|x__L|x__N)) +#define x_iscntrl(x_c) ((x__ctype_+1)[x_c]&x__C) +#define x_isascii(x_c) ((unsigned)(x_c)<=0177) +#define x_toupper(x_c) ((x_c)-'a'+'A') +#define x_tolower(x_c) ((x_c)-'A'+'a') +#define x_toascii(x_c) ((x_c)&0177) + +#endif diff --git a/x_include/x_disktab.h b/x_include/x_disktab.h new file mode 100644 index 0000000..7001991 --- /dev/null +++ b/x_include/x_disktab.h @@ -0,0 +1,51 @@ +#include "x_.h" + +#ifndef x__DISKTAB_H_ +#define x__DISKTAB_H_ + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)disktab.h 5.2 (Berkeley) 10/1/85 + */ + +/* + * Disk description table, see disktab(5) + */ +#define x_DISKTAB "/etc/disktab" + +struct x_disktab { + char *x_d_name; /* drive name */ + char *x_d_type; /* drive type */ + x_int x_d_secsize; /* sector size in bytes */ + x_int x_d_ntracks; /* # tracks/cylinder */ + x_int x_d_nsectors; /* # sectors/track */ + x_int x_d_ncylinders; /* # cylinders */ + x_int x_d_rpm; /* revolutions/minute */ + x_int x_d_badsectforw; /* supports DEC bad144 std */ + x_int x_d_sectoffset; /* use sect rather than cyl offsets */ + struct x_partition { + x_int x_p_size; /* #sectors in partition */ + x_short x_p_bsize; /* block size in bytes */ + x_short x_p_fsize; /* frag size in bytes */ + } x_d_partitions[8]; +}; + +/*struct disktab *getdiskbyname();*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/disktab.c */ +struct x_disktab *x_getdiskbyname __P((char *x_name)); +#endif + +#endif diff --git a/x_include/x_errno.h b/x_include/x_errno.h new file mode 120000 index 0000000..62f52c9 --- /dev/null +++ b/x_include/x_errno.h @@ -0,0 +1 @@ +sys/x_errno.h \ No newline at end of file diff --git a/x_include/x_fcntl.h b/x_include/x_fcntl.h new file mode 120000 index 0000000..ef83d6a --- /dev/null +++ b/x_include/x_fcntl.h @@ -0,0 +1 @@ +sys/x_file.h \ No newline at end of file diff --git a/x_include/x_frame.h b/x_include/x_frame.h new file mode 120000 index 0000000..61da53b --- /dev/null +++ b/x_include/x_frame.h @@ -0,0 +1 @@ +machine/x_frame.h \ No newline at end of file diff --git a/x_include/x_fstab.h b/x_include/x_fstab.h new file mode 100644 index 0000000..5928ebc --- /dev/null +++ b/x_include/x_fstab.h @@ -0,0 +1,67 @@ +#include "x_.h" + +#ifndef x__FSTAB_H_ +#define x__FSTAB_H_ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)fstab.h 5.1 (Berkeley) 5/30/85 + */ + +/* + * File system table, see fstab (5) + * + * Used by dump, mount, umount, swapon, fsck, df, ... + * + * The fs_spec field is the block special name. Programs + * that want to use the character special name must create + * that name by prepending a 'r' after the right most slash. + * Quota files are always named "quotas", so if type is "rq", + * then use concatenation of fs_file and "quotas" to locate + * quota file. + */ +#define x_FSTAB "/etc/fstab" + +#define x_FSTAB_RW "rw" /* read/write device */ +#define x_FSTAB_RQ "rq" /* read/write with quotas */ +#define x_FSTAB_RO "ro" /* read-only device */ +#define x_FSTAB_SW "sw" /* swap device */ +#define x_FSTAB_XX "xx" /* ignore totally */ + +struct x_fstab{ + char *x_fs_spec; /* block special device name */ + char *x_fs_file; /* file system path prefix */ + char *x_fs_type; /* FSTAB_* */ + x_int x_fs_freq; /* dump frequency, in days */ + x_int x_fs_passno; /* pass number on parallel dump */ +}; + +/*struct fstab *getfsent();*/ +/*struct fstab *getfsspec();*/ +/*struct fstab *getfsfile();*/ +/*struct fstab *getfstype();*/ +/*int setfsent();*/ +/*int endfsent();*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/fstab.c */ +x_int x_setfsent __P((void)); +x_int x_endfsent __P((void)); +struct x_fstab *x_getfsent __P((void)); +struct x_fstab *x_getfsspec __P((char *x_name)); +struct x_fstab *x_getfsfile __P((char *x_name)); +struct x_fstab *x_getfstype __P((char *x_type)); +#endif + +#endif diff --git a/x_include/x_gen.h b/x_include/x_gen.h new file mode 100644 index 0000000..f1876ca --- /dev/null +++ b/x_include/x_gen.h @@ -0,0 +1,141 @@ +#include "x_.h" + +#ifndef x__GEN_H_ +#define x__GEN_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* formerly duplicated in gen/insque.c and gen/remque.c */ +struct x_vaxque { /* queue format expected by VAX queue instructions */ + struct x_vaxque *x_vq_next; + struct x_vaxque *x_vq_prev; +}; + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/abort.c */ +x_int x_abort __P((void)); + +/* gen/abs.c */ +x_int x_abs __P((x_int x_i)); + +/* gen/atoi.c */ +x_int x_atoi __P((register char *x_p)); + +/* gen/atol.c */ +x_long x_atol __P((register char *x_p)); + +/* gen/bcmp.c */ +x_int x_bcmp __P((register char *x_b1, register char *x_b2, register x_int x_length)); + +/* gen/bcopy.c */ +x_int x_bcopy __P((register char *x_src, register char *x_dst, register x_int x_length)); + +/* gen/bzero.c */ +x_int x_bzero __P((register char *x_b, register x_int x_length)); + +/* gen/calloc.c */ +char *x_calloc __P((register x_unsigned_int x_num, register x_unsigned_int x_size)); +x_int x_cfree __P((char *x_p, x_unsigned_int x_num, x_unsigned_int x_size)); + +/* gen/crypt.c */ +x_int x_setkey __P((char *x_key)); +x_int x_encrypt __P((char *x_block, x_int x_edflag)); +char *x_crypt __P((char *x_pw, char *x_salt)); + +/* gen/ecvt.c */ +char *x_ecvt __P((double x_arg, x_int x_ndigits, x_int *x_decpt, x_int *x_sign)); +char *x_fcvt __P((double x_arg, x_int x_ndigits, x_int *x_decpt, x_int *x_sign)); + +/* gen/fakcu.c */ +x_int x__cleanup __P((void)); + +/* gen/ffs.c */ +x_int x_ffs __P((register x_long x_mask)); + +/* gen/gcvt.c */ +char *x_gcvt __P((double x_number, x_int x_ndigit, char *x_buf)); + +/* gen/getenv.c */ +char *x_getenv __P((register char *x_name)); + +/* gen/getpass.c */ +char *x_getpass __P((char *x_prompt)); + +/* gen/getusershell.c */ +char *x_getusershell __P((void)); +x_int x_endusershell __P((void)); +x_int x_setusershell __P((void)); + +/* gen/insque.c */ +x_int x_insque __P((register struct x_vaxque *x_e, register struct x_vaxque *x_prev)); + +/* gen/malloc.c */ +char *x_malloc __P((x_unsigned_int x_nbytes)); +x_int x_morecore __P((x_int x_bucket)); +x_int x_free __P((char *x_cp)); +char *x_realloc __P((char *x_cp, x_unsigned_int x_nbytes)); +x_int x_mstats __P((char *x_s)); + +/* gen/mkstemp.c */ +x_int x_mkstemp __P((char *x_as)); + +/* gen/mktemp.c */ +char *x_mktemp __P((char *x_as)); + +/* gen/qsort.c */ +x_int x_qsort __P((char *x_base, x_int x_n, x_int x_size, x_int (*x_compar)(void))); + +/* gen/random.c */ +x_int x_srandom __P((x_unsigned_int x_x)); +char *x_initstate __P((x_unsigned_int x_seed, char *x_arg_state, x_int x_n)); +char *x_setstate __P((char *x_arg_state)); +x_long x_random __P((void)); + +/* gen/regex.c */ +char *x_re_comp __P((register char *x_sp)); +x_int x_re_exec __P((register char *x_p1)); +x_int x_backref __P((register x_int x_i, register char *x_lp)); +x_int x_cclass __P((register char *x_set, x_int x_c, x_int x_af)); + +/* gen/remque.c */ +x_int x_remque __P((register struct x_vaxque *x_e)); + +/* gen/swab.c */ +x_int x_swab __P((register char *x_from, register char *x_to, register x_int x_n)); + +/* gen/timezone.c */ +char *x_timezone __P((x_int x_zone, x_int x_dst)); + +/* gen/valloc.c */ +char *x_valloc __P((x_int x_i)); +#endif + +#endif diff --git a/x_include/x_grp.h b/x_include/x_grp.h new file mode 100644 index 0000000..3b7b129 --- /dev/null +++ b/x_include/x_grp.h @@ -0,0 +1,41 @@ +#include "x_.h" + +#ifndef x__GRP_H_ +#define x__GRP_H_ + +/* grp.h 4.1 83/05/03 */ + +struct x_group { /* see getgrent(3) */ + char *x_gr_name; + char *x_gr_passwd; + x_int x_gr_gid; + char **x_gr_mem; +}; + +/*struct group *getgrent(), *getgrgid(), *getgrnam();*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/getgrent.c */ +x_int x_setgrent __P((void)); +x_int x_endgrent __P((void)); +struct x_group *x_getgrent __P((void)); + +/* gen/getgrgid.c */ +struct x_group *x_getgrgid __P((register x_int x_gid)); + +/* gen/getgrnam.c */ +struct x_group *x_getgrnam __P((register char *x_name)); + +/* gen/initgroups.c */ +x_int x_initgroups __P((char *x_uname, x_int x_agroup)); +#endif + +#endif diff --git a/x_include/x_inet.h b/x_include/x_inet.h new file mode 100644 index 0000000..9e87bbe --- /dev/null +++ b/x_include/x_inet.h @@ -0,0 +1,8 @@ +#include "x_.h" + +#ifndef x__INET_H_ +#define x__INET_H_ + +#include + +#endif diff --git a/x_include/x_lastlog.h b/x_include/x_lastlog.h new file mode 100644 index 0000000..a2e3de6 --- /dev/null +++ b/x_include/x_lastlog.h @@ -0,0 +1,22 @@ +#include "x_.h" + +#ifndef x__LASTLOG_H_ +#define x__LASTLOG_H_ + +#include + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)lastlog.h 5.1 (Berkeley) 5/30/85 + */ + +struct x_lastlog { + x_time_t x_ll_time; + char x_ll_line[8]; + char x_ll_host[16]; /* same as in utmp */ +}; + +#endif diff --git a/x_include/x_math.h b/x_include/x_math.h new file mode 100644 index 0000000..ffe00ed --- /dev/null +++ b/x_include/x_math.h @@ -0,0 +1,49 @@ +#include "x_.h" + +#ifndef x__MATH_H_ +#define x__MATH_H_ + +/* math.h 4.6 9/11/85 */ + +/*extern double asinh(), acosh(), atanh();*/ +/*extern double erf(), erfc();*/ +/*extern double exp(), expm1(), log(), log10(), log1p(), pow();*/ +/*extern double fabs(), floor(), ceil(), rint();*/ +/*extern double lgamma();*/ +/*extern double hypot(), cabs();*/ +/*extern double copysign(), drem(), logb(), scalb();*/ +/*extern int finite();*/ +#ifdef x_vax +/*extern double infnan();*/ +#endif +/*extern double j0(), j1(), jn(), y0(), y1(), yn();*/ +/*extern double sin(), cos(), tan(), asin(), acos(), atan(), atan2();*/ +/*extern double sinh(), cosh(), tanh();*/ +/*extern double cbrt(), sqrt();*/ +/*extern double modf(), ldexp(), frexp(), atof();*/ + +#define x_HUGE 1.701411733192644270e38 + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/atof.c */ +double x_atof __P((char *x_s)); + +/* gen/frexp.c */ +double x_frexp __P((double x_x, x_int *x_i)); + +/* gen/ldexp.c */ +double x_ldexp __P((double x_v, x_int x_e)); + +/* gen/modf.c */ +double x_modf __P((double x_v, double *x_p)); +#endif + +#endif diff --git a/x_include/x_memory.h b/x_include/x_memory.h new file mode 100644 index 0000000..af54819 --- /dev/null +++ b/x_include/x_memory.h @@ -0,0 +1,49 @@ +#include "x_.h" + +#ifndef x__MEMORY_H_ +#define x__MEMORY_H_ + +/* + * Copyright (c) 1985 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)memory.h 5.1 (Berkeley) 85/08/05 + */ + +/* + * Definitions of the Sys5 compat memory manipulation routines + */ + +/*extern char *memccpy();*/ +/*extern char *memchr();*/ +/*extern int memcmp();*/ +/*extern char *memcpy();*/ +/*extern char *memset();*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* compat-sys5/memccpy.c */ +char *x_memccpy __P((register char *x_t, register char *x_f, register x_int x_c, register x_int x_n)); + +/* compat-sys5/memchr.c */ +char *x_memchr __P((register char *x_s, register x_int x_c, register x_int x_n)); + +/* compat-sys5/memcmp.c */ +x_int x_memcmp __P((register char *x_s1, register char *x_s2, register x_int x_n)); + +/* compat-sys5/memcpy.c */ +char *x_memcpy __P((register char *x_t, register char *x_f, register x_int x_n)); + +/* compat-sys5/memset.c */ +char *x_memset __P((register char *x_s, register x_int x_c, register x_int x_n)); +#endif + +#endif diff --git a/x_include/x_mp.h b/x_include/x_mp.h new file mode 100644 index 0000000..555ecd3 --- /dev/null +++ b/x_include/x_mp.h @@ -0,0 +1,51 @@ +#include "x_.h" + +#ifndef x__MP_H_ +#define x__MP_H_ + +#include +#include + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)mp.h 5.1 (Berkeley) 5/30/85 + */ + +#define x_MINT struct x_mint +x_MINT +{ x_int x_len; + x_short *x_val; +}; +#define x_FREE(x_x) {if(x_x.x_len!=0) {x_free((char *)x_x.x_val); x_x.x_len=0;}} +#ifndef x_DBG +#define x_shfree(x_u) x_free((char *)x_u) +#else +#include +#define x_shfree(x_u) { if(x_dbg) x_fprintf(x_stderr, "free %o\n", x_u); x_free((char *)x_u);} +extern x_int x_dbg; +#endif +#ifndef x_vax +struct x_half +{ x_short x_high; + x_short x_low; +}; +#else +struct x_half +{ x_short x_low; + x_short x_high; +}; +#endif +/*extern MINT *itom();*/ +/*extern short *xalloc();*/ + +#ifdef x_lint +extern x_xv_oid; +#define x_VOID x_xv_oid = +#else +#define x_VOID +#endif + +#endif diff --git a/x_include/x_mtab.h b/x_include/x_mtab.h new file mode 100644 index 0000000..7a1d5fe --- /dev/null +++ b/x_include/x_mtab.h @@ -0,0 +1,23 @@ +#include "x_.h" + +#ifndef x__MTAB_H_ +#define x__MTAB_H_ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)mtab.h 5.1 (Berkeley) 5/30/85 + */ + +/* + * Mounted device accounting file. + */ +struct x_mtab { + char x_m_path[32]; /* mounted on pathname */ + char x_m_dname[32]; /* block device pathname */ + char x_m_type[4]; /* read-only, quotas */ +}; + +#endif diff --git a/x_include/x_ndbm.h b/x_include/x_ndbm.h new file mode 100644 index 0000000..05f030e --- /dev/null +++ b/x_include/x_ndbm.h @@ -0,0 +1,89 @@ +#include "x_.h" + +#ifndef x__NDBM_H_ +#define x__NDBM_H_ + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ndbm.h 5.1 (Berkeley) 5/30/85 + */ + +/* + * Hashed key data base library. + */ +#define x_PBLKSIZ 1024 +#define x_DBLKSIZ 4096 + +typedef struct { + x_int x_dbm_dirf; /* open directory file */ + x_int x_dbm_pagf; /* open page file */ + x_int x_dbm_flags; /* flags, see below */ + x_long x_dbm_maxbno; /* last ``bit'' in dir file */ + x_long x_dbm_bitno; /* current bit number */ + x_long x_dbm_hmask; /* hash mask */ + x_long x_dbm_blkptr; /* current block for dbm_nextkey */ + x_int x_dbm_keyptr; /* current key for dbm_nextkey */ + x_long x_dbm_blkno; /* current page to read/write */ + x_long x_dbm_pagbno; /* current page in pagbuf */ + char x_dbm_pagbuf[x_PBLKSIZ]; /* page file block buffer */ + x_long x_dbm_dirbno; /* current block in dirbuf */ + char x_dbm_dirbuf[x_DBLKSIZ]; /* directory file block buffer */ +} x_DBM; + +#define x__DBM_RDONLY 0x1 /* data base open read-only */ +#define x__DBM_IOERR 0x2 /* data base I/O error */ + +#define x_dbm_rdonly(x_db) ((x_db)->x_dbm_flags & x__DBM_RDONLY) + +#define x_dbm_error(x_db) ((x_db)->x_dbm_flags & x__DBM_IOERR) + /* use this one at your own risk! */ +#define x_dbm_clearerr(x_db) ((x_db)->x_dbm_flags &= ~x__DBM_IOERR) + +/* for flock(2) and fstat(2) */ +#define x_dbm_dirfno(x_db) ((x_db)->x_dbm_dirf) +#define x_dbm_pagfno(x_db) ((x_db)->x_dbm_pagf) + +typedef struct { + char *x_dptr; + x_int x_dsize; +} x_datum; + +/* + * flags to dbm_store() + */ +#define x_DBM_INSERT 0 +#define x_DBM_REPLACE 1 + +/*DBM *dbm_open();*/ +/*void dbm_close();*/ +/*datum dbm_fetch();*/ +/*datum dbm_firstkey();*/ +/*datum dbm_nextkey();*/ +/*long dbm_forder();*/ +/*int dbm_delete();*/ +/*int dbm_store();*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/ndbm.c */ +x_DBM *x_dbm_open __P((char *x_file, x_int x_flags, x_int x_mode)); +void x_dbm_close __P((x_DBM *x_db)); +x_long x_dbm_forder __P((register x_DBM *x_db, x_datum x_key)); +x_datum x_dbm_fetch __P((register x_DBM *x_db, x_datum x_key)); +x_int x_dbm_delete __P((register x_DBM *x_db, x_datum x_key)); +x_int x_dbm_store __P((register x_DBM *x_db, x_datum x_key, x_datum x_dat, x_int x_replace)); +x_datum x_dbm_firstkey __P((x_DBM *x_db)); +x_datum x_dbm_nextkey __P((register x_DBM *x_db)); +#endif + +#endif diff --git a/x_include/x_net.h b/x_include/x_net.h new file mode 100644 index 0000000..780e04a --- /dev/null +++ b/x_include/x_net.h @@ -0,0 +1,51 @@ +#include "x_.h" + +#ifndef x__NET_H_ +#define x__NET_H_ + +#include +#include +#include + +/* formerly duplicated in netinet/in.h and netns/ns.h */ +#if !defined(x_vax) && !defined(x_ntohl) && !defined(x_lint) +/* + * Macros for number representation conversion. + */ +#define x_ntohl(x_x) (x_x) +#define x_ntohs(x_x) (x_x) +#define x_htonl(x_x) (x_x) +#define x_htons(x_x) (x_x) +#endif + +#if !defined(x_ntohl) && (defined(x_vax) || defined(x_lint)) +/*u_short ntohs(), htons();*/ +/*u_long ntohl(), htonl();*/ +#endif + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* net/rcmd.c */ +x_int x_rcmd __P((char **x_ahost, x_int x_rport, char *x_locuser, char *x_remuser, char *x_cmd, x_int *x_fd2p)); +x_int x_rresvport __P((x_int *x_alport)); +x_int x_ruserok __P((char *x_rhost, x_int x_superuser, char *x_ruser, char *x_luser)); +x_int x__validuser __P((x_FILE *x_hostf, char *x_rhost, char *x_luser, char *x_ruser, x_int x_baselen)); +x_int x__checkhost __P((char *x_rhost, char *x_lhost, x_int x_len)); + +/* net/rexec.c */ +x_int x_rexec __P((char **x_ahost, x_int x_rport, char *x_name, char *x_pass, char *x_cmd, x_int *x_fd2p)); + +/* net/ruserpass.c */ +x_int x_ruserpass __P((char *x_host, char **x_aname, char **x_apass)); +x_int x_mkpwunclear __P((char *x_spasswd, x_int x_mch, char *x_sencpasswd)); +x_int x_mkpwclear __P((char *x_sencpasswd, x_int x_mch, char *x_spasswd)); +#endif + +#endif diff --git a/x_include/x_netdb.h b/x_include/x_netdb.h new file mode 100644 index 0000000..70b3862 --- /dev/null +++ b/x_include/x_netdb.h @@ -0,0 +1,137 @@ +#include "x_.h" + +#ifndef x__NETDB_H_ +#define x__NETDB_H_ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)netdb.h 5.7 (Berkeley) 5/12/86 + */ + +/* + * Structures returned by network + * data base library. All addresses + * are supplied in host order, and + * returned in network order (suitable + * for use in system calls). + */ +struct x_hostent { + char *x_h_name; /* official name of host */ + char **x_h_aliases; /* alias list */ + x_int x_h_addrtype; /* host address type */ + x_int x_h_length; /* length of address */ + char **x_h_addr_list; /* list of addresses from name server */ +#define x_h_addr x_h_addr_list[0] /* address, for backward compatiblity */ +}; + +/* + * Assumption here is that a network number + * fits in 32 bits -- probably a poor one. + */ +struct x_netent { + char *x_n_name; /* official name of net */ + char **x_n_aliases; /* alias list */ + x_int x_n_addrtype; /* net address type */ + x_unsigned_long x_n_net; /* network # */ +}; + +struct x_servent { + char *x_s_name; /* official service name */ + char **x_s_aliases; /* alias list */ + x_int x_s_port; /* port # */ + char *x_s_proto; /* protocol to use */ +}; + +struct x_protoent { + char *x_p_name; /* official protocol name */ + char **x_p_aliases; /* alias list */ + x_int x_p_proto; /* protocol # */ +}; + +/*struct hostent *gethostbyname(), *gethostbyaddr(), *gethostent();*/ +/*struct netent *getnetbyname(), *getnetbyaddr(), *getnetent();*/ +/*struct servent *getservbyname(), *getservbyport(), *getservent();*/ +/*struct protoent *getprotobyname(), *getprotobynumber(), *getprotoent();*/ + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + */ + +extern x_int x_h_errno; + +#define x_HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */ +#define x_TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define x_NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define x_NO_ADDRESS 4 /* Valid host name, no address, look for MX record */ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* net/getnetbyaddr.c */ +struct x_netent *x_getnetbyaddr __P((register x_int x_net, register x_int x_type)); + +/* net/getnetbyname.c */ +struct x_netent *x_getnetbyname __P((register char *x_name)); + +/* net/getnetent.c */ +x_int x_setnetent __P((x_int x_f)); +x_int x_endnetent __P((void)); +struct x_netent *x_getnetent __P((void)); + +/* net/getproto.c */ +struct x_protoent *x_getprotobynumber __P((register x_int x_proto)); + +/* net/getprotoent.c */ +x_int x_setprotoent __P((x_int x_f)); +x_int x_endprotoent __P((void)); +struct x_protoent *x_getprotoent __P((void)); + +/* net/getprotoname.c */ +struct x_protoent *x_getprotobyname __P((register char *x_name)); + +/* net/getservbyname.c */ +struct x_servent *x_getservbyname __P((char *x_name, char *x_proto)); + +/* net/getservbyport.c */ +struct x_servent *x_getservbyport __P((x_int x_port, char *x_proto)); + +/* net/getservent.c */ +x_int x_setservent __P((x_int x_f)); +x_int x_endservent __P((void)); +struct x_servent *x_getservent __P((void)); + +/* net/hosttable/gethostent.c */ +x_int x_sethostent __P((x_int x_f)); +x_int x_endhostent __P((void)); +struct x_hostent *x_gethostent __P((void)); +x_int x_sethostfile __P((char *x_file)); + +/* net/hosttable/gethostnamadr.c */ +struct x_hostent *x_gethostbyname __P((register char *x_nam)); +struct x_hostent *x_gethostbyaddr __P((char *x_addr, register x_int x_length, register x_int x_type)); + +/* net/named/gethostnamadr.c */ +struct x_hostent *x_gethostbyname __P((char *x_name)); +struct x_hostent *x_gethostbyaddr __P((char *x_addr, x_int x_len, x_int x_type)); +x_int x__sethtent __P((x_int x_f)); +x_int x__endhtent __P((void)); +struct x_hostent *x__gethtent __P((void)); +struct x_hostent *x__gethtbyname __P((char *x_name)); +struct x_hostent *x__gethtbyaddr __P((char *x_addr, x_int x_len, x_int x_type)); + +/* net/named/sethostent.c */ +x_int x_sethostent __P((x_int x_stayopen)); +x_int x_endhostent __P((void)); +x_int x_sethostfile __P((char *x_name)); +#endif + +#endif diff --git a/x_include/x_nlist.h b/x_include/x_nlist.h new file mode 100644 index 0000000..d49ae23 --- /dev/null +++ b/x_include/x_nlist.h @@ -0,0 +1,66 @@ +#include "x_.h" + +#ifndef x__NLIST_H_ +#define x__NLIST_H_ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)nlist.h 5.1 (Berkeley) 5/30/85 + */ + +/* + * Format of a symbol table entry; this file is included by + * and should be used if you aren't interested the a.out header + * or relocation information. + */ +struct x_nlist { + char *x_n_name; /* for use when in-core */ + unsigned char x_n_type; /* type flag, i.e. N_TEXT etc; see below */ + char x_n_other; /* unused */ + x_short x_n_desc; /* see */ + x_unsigned_long x_n_value; /* value of this symbol (or sdb offset) */ +}; +#define x_n_hash x_n_desc /* used internally by ld */ + +/* + * Simple values for n_type. + */ +#define x_N_UNDF 0x0 /* undefined */ +#define x_N_ABS 0x2 /* absolute */ +#define x_N_TEXT 0x4 /* text */ +#define x_N_DATA 0x6 /* data */ +#define x_N_BSS 0x8 /* bss */ +#define x_N_COMM 0x12 /* common (internal to ld) */ +#define x_N_FN 0x1f /* file name symbol */ + +#define x_N_EXT 01 /* external bit, or'ed in */ +#define x_N_TYPE 0x1e /* mask for all the type bits */ + +/* + * Sdb entries have some of the N_STAB bits set. + * These are given in + */ +#define x_N_STAB 0xe0 /* if any of these bits set, a SDB entry */ + +/* + * Format for namelist values. + */ +#define x_N_FORMAT "%08x" + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/nlist.c */ +x_int x_nlist __P((char *x_name, struct x_nlist *x_list)); +#endif + +#endif diff --git a/x_include/x_ns.h b/x_include/x_ns.h new file mode 100644 index 0000000..80d09cd --- /dev/null +++ b/x_include/x_ns.h @@ -0,0 +1,8 @@ +#include "x_.h" + +#ifndef x__NS_H_ +#define x__NS_H_ + +#include + +#endif diff --git a/x_include/x_pcc.h b/x_include/x_pcc.h new file mode 100644 index 0000000..0f51920 --- /dev/null +++ b/x_include/x_pcc.h @@ -0,0 +1,236 @@ +#include "x_.h" + +#ifndef x__PCC_H_ +#define x__PCC_H_ + +#include + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)pcc.h 5.1 (Berkeley) 5/30/85 + */ + +/* + * This file contains definitions for all the constants and structures + * needed to use the intermediate code files generated and read by + * the Portable C Compiler and related compilers. + * + * Rules for changing this code: + * 1) All op values must be integer constants -- this permits us to run + * a 'sed' script on this file to create %term declarations for yacc. + * 2) Because the PCC uses fancy ASG and UNARY macros, assignment + * operators must have values 1 greater than corresponding normal + * operators, and unary operators must have values 2 greater ditto. + * 3) Ops used only by f1 must have values >= 150 (PCCF_FORTOPS). + * 4) Other language-dependent ops must have values >= 200. + */ + +# ifndef x_PCC_TOKENS + +# define x_PCC_TOKENS 0 + +# define x_PCC_ERROR 1 /* an error node */ +# define x_PCC_FREE 2 /* an unused node */ + +/* + * Constants. + */ +# define x_PCC_STRING 3 /* a string constant */ +# define x_PCC_ICON 4 /* an integer constant */ +# define x_PCC_FCON 5 /* a floating point constant */ +# define x_PCC_DCON 6 /* a double precision f.p. constant */ + +/* + * Leaf types. + */ +# define x_PCC_NAME 7 /* an identifier */ +# define x_PCC_REG 8 /* a register */ +# define x_PCC_OREG 9 /* register and offset */ +# define x_PCC_CCODES 10 /* condition codes */ +# define x_PCC_FLD 11 /* a bit field */ + +/* + * Arithmetic operators. + */ +# define x_PCC_PLUS 12 /* + */ +# define x_PCC_PLUSEQ 13 /* += */ +# define x_PCC_UPLUS 14 /* unary + (for completeness) */ +# define x_PCC_MINUS 15 /* - */ +# define x_PCC_MINUSEQ 16 /* -= */ +# define x_PCC_UMINUS 17 /* unary - */ +# define x_PCC_MUL 18 /* * */ +# define x_PCC_MULEQ 19 /* *= */ +/* Reserve a slot for 'unary *', which is PCC jargon for PCC_DEREF (yech) */ +# define x_PCC_DIV 21 /* / */ +# define x_PCC_DIVEQ 22 /* /= */ +# define x_PCC_MOD 23 /* % */ +# define x_PCC_MODEQ 24 /* %= */ +# define x_PCC_INCR 25 /* ++ */ +# define x_PCC_DECR 26 /* -- */ +# define x_PCC_ASSIGN 27 /* = (these last 3 are stretching it) */ + +/* + * Bit operators. + */ +# define x_PCC_AND 28 /* & */ +# define x_PCC_ANDEQ 29 /* &= */ +/* Reserve a slot for 'unary &', jargon for PCC_ADDROF */ +# define x_PCC_OR 31 /* | */ +# define x_PCC_OREQ 32 /* |= */ +# define x_PCC_ER 33 /* ^ */ +# define x_PCC_EREQ 34 /* ^= */ +# define x_PCC_LS 35 /* << */ +# define x_PCC_LSEQ 36 /* <<= */ +# define x_PCC_RS 37 /* >> */ +# define x_PCC_RSEQ 38 /* >>= */ +# define x_PCC_COMPL 39 /* ~ */ + +/* + * Booleans. + */ +# define x_PCC_EQ 40 /* == */ +# define x_PCC_NE 41 /* != */ +# define x_PCC_LE 42 /* <= */ +# define x_PCC_LT 43 /* < */ +# define x_PCC_GE 44 /* >= */ +# define x_PCC_GT 45 /* > */ +# define x_PCC_ULE 46 /* unsigned <= */ +# define x_PCC_ULT 47 /* unsigned < */ +# define x_PCC_UGE 48 /* unsigned >= */ +# define x_PCC_UGT 49 /* unsigned > */ +# define x_PCC_QUEST 50 /* ? (for conditional expressions) */ +# define x_PCC_COLON 51 /* : (for conditional expressions) */ +# define x_PCC_ANDAND 52 /* && */ +# define x_PCC_OROR 53 /* || */ +# define x_PCC_NOT 54 /* ! */ + +/* + * Function calls. + */ +# define x_PCC_CALL 55 /* call by value */ +/* no ASG */ +# define x_PCC_UCALL 57 /* call with no arguments */ +# define x_PCC_FORTCALL 58 /* call by reference? */ +/* no ASG */ +# define x_PCC_UFORTCALL 60 /* ??? */ +# ifdef x_INLINE +# define x_PCC_INLINE 61 /* inline function */ +/* no ASG */ +# define x_PCC_UINLINE 63 /* inline with no arguments */ +# endif + +/* + * Referencing and dereferencing. + */ +# define x_PCC_DEREF 20 /* * */ +# define x_PCC_ADDROF 30 /* & */ + +/* + * Special structure operators. + */ +# define x_PCC_DOT 64 /* . */ +# define x_PCC_STREF 65 /* -> */ +# define x_PCC_STASG 66 /* structure assignment */ +# define x_PCC_STARG 67 /* an argument of type structure */ +# define x_PCC_STCALL 68 /* a function of type structure */ +/* no ASG */ +# define x_PCC_USTCALL 70 /* unary structure function */ + +/* + * Conversions. + */ +# define x_PCC_SCONV 71 /* scalar conversion */ +# define x_PCC_PCONV 72 /* pointer conversion */ +# define x_PCC_PMCONV 73 /* pointer multiply conversion */ +# define x_PCC_PVCONV 74 /* pointer divide conversion */ +# define x_PCC_CAST 75 /* redundant? */ + +/* + * Bracket types. + */ +# define x_PCC_LB 76 /* [ */ +# define x_PCC_RB 77 /* ] */ + +/* + * Comma nodes. + */ +# define x_PCC_COMOP 78 /* , (in expressions) */ +# define x_PCC_CM 79 /* , (in argument lists) */ + +/* + * Miscellaneous. + */ +# define x_PCC_FORCE 80 /* result of last expression goes in r0 */ +# define x_PCC_GOTO 81 /* unconditional goto */ +# define x_PCC_CBRANCH 82 /* goto label if !test */ +# define x_PCC_RETURN 83 /* return from function */ +# define x_PCC_INIT 84 /* initialized data */ +# define x_PCC_TYPE 85 /* a type */ +# define x_PCC_CLASS 86 /* a storage class */ + +# define x_PCC_MAXOP 86 /* highest numbered PCC op */ + +/* + * Special codes for interfacing to /lib/f1. + */ +# define x_PCCF_FORTOPS 150 +# define x_PCCF_FTEXT 150 /* pass literal assembler text */ +# define x_PCCF_FEXPR 151 /* a statement */ +# define x_PCCF_FSWITCH 152 /* not implemented */ +# define x_PCCF_FLBRAC 153 /* beginning of subroutine */ +# define x_PCCF_FRBRAC 154 /* end of subroutine */ +# define x_PCCF_FEOF 155 /* end of file */ +# define x_PCCF_FARIF 156 /* not implemented */ +# define x_PCCF_FLABEL 157 /* an f77 label */ + +# endif + +/* + * Types, as encoded in intermediate file cookies. + */ +# define x_PCCT_UNDEF 0 +# define x_PCCT_FARG 1 /* function argument */ +# define x_PCCT_CHAR 2 +# define x_PCCT_SHORT 3 +# define x_PCCT_INT 4 +# define x_PCCT_LONG 5 +# define x_PCCT_FLOAT 6 +# define x_PCCT_DOUBLE 7 +# define x_PCCT_STRTY 8 +# define x_PCCT_UNIONTY 9 +# define x_PCCT_ENUMTY 10 +# define x_PCCT_MOETY 11 /* member of enum */ +# define x_PCCT_UCHAR 12 +# define x_PCCT_USHORT 13 +# define x_PCCT_UNSIGNED 14 +# define x_PCCT_ULONG 15 + +/* + * Type modifiers. + */ +# define x_PCCTM_PTR 020 +# define x_PCCTM_FTN 040 +# define x_PCCTM_ARY 060 +# define x_PCCTM_BASETYPE 017 +# define x_PCCTM_TYPESHIFT 2 + +/* + * Useful macros. 'PCCOM' macros apply to ops. + */ +# define x_PCCOM_ASG 1+ +# define x_PCCOM_UNARY 2+ +# define x_PCCOM_NOASG (-1)+ +# define x_PCCOM_NOUNARY (-2)+ + +# define x_PCCM_TRIPLE(x_op, x_var, x_type) \ + ((x_op) | ((x_var) << 8) | (x_long) (x_type) << 16) +# define x_PCCM_TEXT(x_s) \ + x_PCCM_TRIPLE(x_PCCF_FTEXT, (x_strlen(x_s) + 3) / 4, 0) +# define x_PCCM_ADDTYPE(x_t, x_m) \ + ((((x_t) &~ x_PCCTM_BASETYPE) << x_PCCTM_TYPESHIFT) | \ + (x_m) | ((x_t) & x_PCCTM_BASETYPE)) + +#endif diff --git a/x_include/x_pwd.h b/x_include/x_pwd.h new file mode 100644 index 0000000..594642b --- /dev/null +++ b/x_include/x_pwd.h @@ -0,0 +1,42 @@ +#include "x_.h" + +#ifndef x__PWD_H_ +#define x__PWD_H_ + +/* pwd.h 4.1 83/05/03 */ + +struct x_passwd { /* see getpwent(3) */ + char *x_pw_name; + char *x_pw_passwd; + x_int x_pw_uid; + x_int x_pw_gid; + x_int x_pw_quota; + char *x_pw_comment; + char *x_pw_gecos; + char *x_pw_dir; + char *x_pw_shell; +}; + +/*struct passwd *getpwent(), *getpwuid(), *getpwnam();*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/getpwent.c */ +x_int x_setpwent __P((void)); +x_int x_endpwent __P((void)); +struct x_passwd *x_getpwent __P((void)); +x_int x_setpwfile __P((char *x_file)); + +/* gen/getpwnamuid.c */ +struct x_passwd *x_getpwnam __P((char *x_nam)); +struct x_passwd *x_getpwuid __P((x_int x_uid)); +#endif + +#endif diff --git a/x_include/x_ranlib.h b/x_include/x_ranlib.h new file mode 100644 index 0000000..30bac0d --- /dev/null +++ b/x_include/x_ranlib.h @@ -0,0 +1,26 @@ +#include "x_.h" + +#ifndef x__RANLIB_H_ +#define x__RANLIB_H_ + +#include + +/* ranlib.h 4.1 83/05/03 */ + +/* + * Structure of the __.SYMDEF table of contents for an archive. + * __.SYMDEF begins with a word giving the number of ranlib structures + * which immediately follow, and then continues with a string + * table consisting of a word giving the number of bytes of strings + * which follow and then the strings themselves. + * The ran_strx fields index the string table whose first byte is numbered 0. + */ +struct x_ranlib { + union { + x_off_t x_ran_strx; /* string table index of */ + char *x_ran_name; /* symbol defined by */ + } x_ran_un; + x_off_t x_ran_off; /* library member at this offset */ +}; + +#endif diff --git a/x_include/x_resolv.h b/x_include/x_resolv.h new file mode 100644 index 0000000..40d47c4 --- /dev/null +++ b/x_include/x_resolv.h @@ -0,0 +1,51 @@ +#include "x_.h" + +#ifndef x__RESOLV_H_ +#define x__RESOLV_H_ + +#include +#include +#include + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)resolv.h 5.4 (Berkeley) 2/22/86 + */ + +/* + * Global defines and variables for resolver stub. + */ + +#define x_MAXNS 3 /* max # name servers we'll track */ + +struct x_state { + x_int x_retrans; /* retransmition time interval */ + x_int x_retry; /* number of times to retransmit */ + x_long x_options; /* option flags - see below. */ + x_int x_nscount; /* number of name servers */ + struct x_sockaddr_in x_nsaddr_list[x_MAXNS]; /* address of name server */ +#define x_nsaddr x_nsaddr_list[0] /* for backward compatibility */ + x_u_short x_id; /* current packet id */ + char x_defdname[x_MAXDNAME]; /* default domain */ +}; + +/* + * Resolver options + */ +#define x_RES_INIT 0x0001 /* address initialized */ +#define x_RES_DEBUG 0x0002 /* print debug messages */ +#define x_RES_AAONLY 0x0004 /* authoritative answers only */ +#define x_RES_USEVC 0x0008 /* use virtual circuit */ +#define x_RES_PRIMARY 0x0010 /* query primary server only */ +#define x_RES_IGNTC 0x0020 /* ignore trucation errors */ +#define x_RES_RECURSE 0x0040 /* recursion desired */ +#define x_RES_DEFNAMES 0x0080 /* use default domain name */ +#define x_RES_STAYOPEN 0x0100 /* Keep TCP socket open */ + +extern struct x_state x__res; +/*extern char *p_cdname(), *p_rr(), *p_type(), *p_class();*/ + +#endif diff --git a/x_include/x_setjmp.h b/x_include/x_setjmp.h new file mode 100644 index 0000000..450fb3f --- /dev/null +++ b/x_include/x_setjmp.h @@ -0,0 +1,31 @@ +#include "x_.h" + +#ifndef x__SETJMP_H_ +#define x__SETJMP_H_ + +/* setjmp.h 4.1 83/05/03 */ + +typedef x_int x_jmp_buf[10]; + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/_setjmp.c */ +x_int x__setjmp __P((x_jmp_buf x_e)); +void x__longjmp __P((x_jmp_buf x_e, x_int x_v)); + +/* gen/setjmp.c */ +x_int x_setjmp __P((x_jmp_buf x_e)); +void x_longjmp __P((x_jmp_buf x_e, x_int x_v)); + +/* gen/setjmperr.c */ +x_int x_longjmperror __P((void)); +#endif + +#endif diff --git a/x_include/x_sgtty.h b/x_include/x_sgtty.h new file mode 100644 index 0000000..ed77b6c --- /dev/null +++ b/x_include/x_sgtty.h @@ -0,0 +1,14 @@ +#include "x_.h" + +#ifndef x__SGTTY_H_ +#define x__SGTTY_H_ + +#include + +/* sgtty.h 4.2 85/01/03 */ + +/*#ifndef _IOCTL_*/ +/*#include */ +/*#endif*/ + +#endif diff --git a/x_include/x_signal.h b/x_include/x_signal.h new file mode 120000 index 0000000..48e5c2a --- /dev/null +++ b/x_include/x_signal.h @@ -0,0 +1 @@ +sys/x_signal.h \ No newline at end of file diff --git a/x_include/x_stab.h b/x_include/x_stab.h new file mode 100644 index 0000000..fc82af0 --- /dev/null +++ b/x_include/x_stab.h @@ -0,0 +1,49 @@ +#include "x_.h" + +#ifndef x__STAB_H_ +#define x__STAB_H_ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)stab.h 5.1 (Berkeley) 5/30/85 + */ + +/* IF YOU ADD DEFINITIONS, ADD THEM TO nm.c as well */ +/* + * This file gives definitions supplementing + * for permanent symbol table entries. + * These must have one of the N_STAB bits on, + * and are subject to relocation according to the masks in . + */ +/* + * for symbolic debugger, sdb(1): + */ +#define x_N_GSYM 0x20 /* global symbol: name,,0,type,0 */ +#define x_N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */ +#define x_N_FUN 0x24 /* procedure: name,,0,linenumber,address */ +#define x_N_STSYM 0x26 /* static symbol: name,,0,type,address */ +#define x_N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,address */ +#define x_N_RSYM 0x40 /* register sym: name,,0,type,register */ +#define x_N_SLINE 0x44 /* src line: 0,,0,linenumber,address */ +#define x_N_SSYM 0x60 /* structure elt: name,,0,type,struct_offset */ +#define x_N_SO 0x64 /* source file name: name,,0,0,address */ +#define x_N_LSYM 0x80 /* local sym: name,,0,type,offset */ +#define x_N_SOL 0x84 /* #included file name: name,,0,0,address */ +#define x_N_PSYM 0xa0 /* parameter: name,,0,type,offset */ +#define x_N_ENTRY 0xa4 /* alternate entry: name,linenumber,address */ +#define x_N_LBRAC 0xc0 /* left bracket: 0,,0,nesting level,address */ +#define x_N_RBRAC 0xe0 /* right bracket: 0,,0,nesting level,address */ +#define x_N_BCOMM 0xe2 /* begin common: name,, */ +#define x_N_ECOMM 0xe4 /* end common: name,, */ +#define x_N_ECOML 0xe8 /* end common (local name): ,,address */ +#define x_N_LENG 0xfe /* second stab entry with length information */ + +/* + * for the berkeley pascal compiler, pc(1): + */ +#define x_N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */ + +#endif diff --git a/x_include/x_stdio.h b/x_include/x_stdio.h new file mode 100644 index 0000000..648c733 --- /dev/null +++ b/x_include/x_stdio.h @@ -0,0 +1,208 @@ +#include "x_.h" + +#ifndef x__STDIO_H_ +#define x__STDIO_H_ + +#include +#ifdef __STDC__ +#include +#endif + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)stdio.h 5.3 (Berkeley) 3/15/86 + */ + +/*# ifndef FILE*/ +#define x_BUFSIZ 1024 +extern struct x__iobuf { + x_int x__cnt; + char *x__ptr; /* should be unsigned char */ + char *x__base; /* ditto */ + x_int x__bufsiz; + x_short x__flag; + char x__file; /* should be short */ +} x__iob[]; + +#define x__IOREAD 01 +#define x__IOWRT 02 +#define x__IONBF 04 +#define x__IOMYBUF 010 +#define x__IOEOF 020 +#define x__IOERR 040 +#define x__IOSTRG 0100 +#define x__IOLBF 0200 +#define x__IORW 0400 +#define x_NULL 0 +#define x_FILE struct x__iobuf +#define x_EOF (-1) + +#define x_stdin (&x__iob[0]) +#define x_stdout (&x__iob[1]) +#define x_stderr (&x__iob[2]) +#ifndef x_lint +#define x_getc(x_p) (--(x_p)->x__cnt>=0? (x_int)(*(unsigned char *)(x_p)->x__ptr++):x__filbuf(x_p)) +#endif +#define x_getchar() x_getc(x_stdin) +#ifndef x_lint +#define x_putc(x_x, x_p) (--(x_p)->x__cnt >= 0 ?\ + (x_int)(*(unsigned char *)(x_p)->x__ptr++ = (x_x)) :\ + (((x_p)->x__flag & x__IOLBF) && -(x_p)->x__cnt < (x_p)->x__bufsiz ?\ + ((*(x_p)->x__ptr = (x_x)) != '\n' ?\ + (x_int)(*(unsigned char *)(x_p)->x__ptr++) :\ + x__flsbuf(*(unsigned char *)(x_p)->x__ptr, x_p)) :\ + x__flsbuf((unsigned char)(x_x), x_p))) +#endif +#define x_putchar(x_x) x_putc(x_x,x_stdout) +#define x_feof(x_p) (((x_p)->x__flag&x__IOEOF)!=0) +#define x_ferror(x_p) (((x_p)->x__flag&x__IOERR)!=0) +#define x_fileno(x_p) ((x_p)->x__file) +#define x_clearerr(x_p) ((x_p)->x__flag &= ~(x__IOERR|x__IOEOF)) + +/*FILE *fopen();*/ +/*FILE *fdopen();*/ +/*FILE *freopen();*/ +/*FILE *popen();*/ +/*long ftell();*/ +/*char *fgets();*/ +/*char *gets();*/ +#if 0 /*def vax*/ +/*char *sprintf();*/ /* too painful to do right */ +#endif +/*# endif*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* stdio/clrerr.c */ +x_int x_clearerr __P((register x_FILE *x_iop)); + +/* stdio/doprnt.c */ +x_int x__doprnt __P((x_u_char *x_fmt0, va_list x_argp, register x_FILE *x_fp)); + +/* stdio/doscan.c */ +x_int x__doscan __P((x_FILE *x_iop, register char *x_fmt, register va_list x_ap)); + +/* stdio/exit.c */ +x_int x_exit __P((x_int x_code)); + +/* stdio/fdopen.c */ +x_FILE *x_fdopen __P((x_int x_fd, register char *x_mode)); + +/* stdio/fgetc.c */ +x_int x_fgetc __P((x_FILE *x_fp)); + +/* stdio/fgets.c */ +char *x_fgets __P((char *x_s, x_int x_n, register x_FILE *x_iop)); + +/* stdio/filbuf.c */ +x_int x__filbuf __P((register x_FILE *x_iop)); + +/* stdio/findiop.c */ +x_FILE *x__findiop __P((void)); +x_int x__f_morefiles __P((void)); +x_int x_f_prealloc __P((void)); +x_int x__fwalk __P((register x_int (*x_function)(void))); +x_int x__cleanup __P((void)); + +/* stdio/flsbuf.c */ +x_int x__flsbuf __P((x_int x_c, register x_FILE *x_iop)); +x_int x_fflush __P((register x_FILE *x_iop)); +x_int x_fclose __P((register x_FILE *x_iop)); + +/* stdio/fopen.c */ +x_FILE *x_fopen __P((char *x_file, register char *x_mode)); + +/* stdio/fprintf.c */ +x_int x_fprintf __P((register x_FILE *x_iop, char *x_fmt, ...)); + +/* stdio/fputc.c */ +x_int x_fputc __P((x_int x_c, register x_FILE *x_fp)); + +/* stdio/fputs.c */ +x_int x_fputs __P((register char *x_s, register x_FILE *x_iop)); + +/* stdio/fread.c */ +x_int x_fread __P((register char *x_ptr, x_unsigned_int x_size, x_unsigned_int x_count, register x_FILE *x_iop)); + +/* stdio/freopen.c */ +x_FILE *x_freopen __P((char *x_file, register char *x_mode, register x_FILE *x_iop)); + +/* stdio/fseek.c */ +x_int x_fseek __P((register x_FILE *x_iop, x_long x_offset, x_int x_ptrname)); + +/* stdio/ftell.c */ +x_long x_ftell __P((register x_FILE *x_iop)); + +/* stdio/fwrite.c */ +x_int x_fwrite __P((register char *x_ptr, x_unsigned_int x_size, x_unsigned_int x_count, register x_FILE *x_iop)); + +/* stdio/getchar.c */ +x_int x_getchar __P((void)); + +/* stdio/gets.c */ +char *x_gets __P((char *x_s)); + +/* stdio/getw.c */ +x_int x_getw __P((register x_FILE *x_iop)); + +/* stdio/popen.c */ +x_FILE *x_popen __P((char *x_cmd, char *x_mode)); +x_int x_pclose __P((x_FILE *x_ptr)); + +/* stdio/printf.c */ +x_int x_printf __P((char *x_fmt, ...)); + +/* stdio/putchar.c */ +x_int x_putchar __P((register x_int x_c)); + +/* stdio/puts.c */ +x_int x_puts __P((register char *x_s)); + +/* stdio/putw.c */ +x_int x_putw __P((x_int x_w, register x_FILE *x_iop)); + +/* stdio/rew.c */ +x_int x_rewind __P((register x_FILE *x_iop)); + +/* stdio/scanf.c */ +x_int x_scanf __P((char *x_fmt, ...)); +x_int x_fscanf __P((x_FILE *x_iop, char *x_fmt, ...)); +x_int x_sscanf __P((register char *x_str, char *x_fmt, ...)); + +/* stdio/setbuf.c */ +x_int x_setbuf __P((register x_FILE *x_iop, char *x_buf)); + +/* stdio/setbuffer.c */ +x_int x_setbuffer __P((register x_FILE *x_iop, char *x_buf, x_int x_size)); +x_int x_setlinebuf __P((register x_FILE *x_iop)); + +/* stdio/sprintf.c */ +x_int x_sprintf __P((char *x_str, char *x_fmt, ...)); + +/* stdio/strout.c */ +x_int x__strout __P((register x_int x_count, register char *x_string, x_int x_adjust, register x_FILE *x_file, x_int x_fillch)); + +/* stdio/ungetc.c */ +x_int x_ungetc __P((x_int x_c, register x_FILE *x_iop)); + +/* stdio/vfprintf.c */ +x_int x_vfprintf __P((x_FILE *x_iop, char *x_fmt, va_list x_ap)); + +/* stdio/vprintf.c */ +x_int x_vprintf __P((char *x_fmt, va_list x_ap)); + +/* stdio/vsprintf.c */ +x_int x_vsprintf __P((char *x_str, char *x_fmt, va_list x_ap)); +#endif + +#endif diff --git a/x_include/x_string.h b/x_include/x_string.h new file mode 100644 index 0000000..19f7db3 --- /dev/null +++ b/x_include/x_string.h @@ -0,0 +1,73 @@ +#include "x_.h" + +#ifndef x__STRING_H_ +#define x__STRING_H_ + +/* + * Copyright (c) 1985 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)string.h 5.1 (Berkeley) 85/08/05 + */ + +/*#include */ + +/* + * these next few are obsolete trash + */ + +/*extern char *strcpyn();*/ +/*extern char *strcatn();*/ +/*extern int strcmpn();*/ + +/* + * and the rest are Sys5 functions supported just so + * Sys5 progs will compile easily. + */ + +/*extern char *strchr();*/ +/*extern char *strrchr();*/ +/*extern char *strpbrk();*/ +/*extern int strspn();*/ +/*extern int strcspn();*/ +/*extern char *strtok();*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* compat-sys5/strcatn.c */ +char *x_strcatn __P((register char *x_s1, register char *x_s2, register x_int x_n)); + +/* compat-sys5/strchr.c */ +char *x_strchr __P((register char *x_sp, x_int x_c)); + +/* compat-sys5/strcmpn.c */ +x_int x_strcmpn __P((register char *x_s1, register char *x_s2, register x_int x_n)); + +/* compat-sys5/strcpyn.c */ +char *x_strcpyn __P((register char *x_s1, register char *x_s2, x_int x_n)); + +/* compat-sys5/strcspn.c */ +x_int x_strcspn __P((register char *x_s, register char *x_set)); + +/* compat-sys5/strpbrk.c */ +char *x_strpbrk __P((register char *x_s, register char *x_brk)); + +/* compat-sys5/strrchr.c */ +char *x_strrchr __P((register char *x_sp, x_int x_c)); + +/* compat-sys5/strspn.c */ +x_int x_strspn __P((register char *x_s, register char *x_set)); + +/* compat-sys5/strtok.c */ +char *x_strtok __P((register char *x_s, register char *x_sep)); +#endif + +#endif diff --git a/x_include/x_strings.h b/x_include/x_strings.h new file mode 100644 index 0000000..6ff0ac3 --- /dev/null +++ b/x_include/x_strings.h @@ -0,0 +1,65 @@ +#include "x_.h" + +#ifndef x__STRINGS_H_ +#define x__STRINGS_H_ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)strings.h 5.1 (Berkeley) 5/30/85 + */ + +/* + * External function definitions + * for routines described in string(3). + */ +/*char *strcat();*/ +/*char *strncat();*/ +/*int strcmp();*/ +/*int strncmp();*/ +/*char *strcpy();*/ +/*char *strncpy();*/ +/*int strlen();*/ +/*char *index();*/ +/*char *rindex();*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/index.c */ +char *x_index __P((register char *x_sp, x_int x_c)); + +/* gen/rindex.c */ +char *x_rindex __P((register char *x_sp, x_int x_c)); + +/* gen/strcat.c */ +char *x_strcat __P((register char *x_s1, register char *x_s2)); + +/* gen/strcmp.c */ +x_int x_strcmp __P((register char *x_s1, register char *x_s2)); + +/* gen/strcpy.c */ +char *x_strcpy __P((register char *x_s1, register char *x_s2)); + +/* gen/strlen.c */ +x_int x_strlen __P((register char *x_s)); + +/* gen/strncat.c */ +char *x_strncat __P((register char *x_s1, register char *x_s2, register x_int x_n)); + +/* gen/strncmp.c */ +x_int x_strncmp __P((register char *x_s1, register char *x_s2, register x_int x_n)); + +/* gen/strncpy.c */ +char *x_strncpy __P((register char *x_s1, register char *x_s2, x_int x_n)); +#endif + +#endif diff --git a/x_include/x_struct.h b/x_include/x_struct.h new file mode 100644 index 0000000..2c9b2f1 --- /dev/null +++ b/x_include/x_struct.h @@ -0,0 +1,16 @@ +#include "x_.h" + +#ifndef x__STRUCT_H_ +#define x__STRUCT_H_ + +/* struct.h 4.1 83/05/03 */ + +/* + * access to information relating to the fields of a structure + */ + +#define x_fldoff(x_str, x_fld) ((x_int)&(((struct x_str *)0)->x_fld)) +#define x_fldsiz(x_str, x_fld) (sizeof(((struct x_str *)0)->x_fld)) +#define x_strbase(x_str, x_ptr, x_fld) ((struct x_str *)((char *)(x_ptr)-x_fldoff(x_str, x_fld))) + +#endif diff --git a/x_include/x_sys.h b/x_include/x_sys.h new file mode 100644 index 0000000..d0184c1 --- /dev/null +++ b/x_include/x_sys.h @@ -0,0 +1,64 @@ +#include "x_.h" + +#ifndef x__SYS_H_ +#define x__SYS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* sys/gethostid.c */ +x_long x_gethostid __P((void)); + +/* sys/gethostname.c */ +x_int x_gethostname __P((char *x_n, x_int x_l)); + +/* sys/getpagesize.c */ +x_int x_getpagesize __P((void)); + +/* sys/profil.c */ +void x_profil __P((char *x_b, x_int x_s, x_int x_o, x_int x_i)); + +/* sys/reboot.c */ +void x_reboot __P((x_int x_h)); + +/* sys/sethostid.c */ +x_int x_sethostid __P((x_long x_h)); + +/* sys/sethostname.c */ +x_int x_sethostname __P((char *x_n, x_int x_l)); + +/* sys/shutdown.c */ +x_int x_shutdown __P((x_int x_s, x_int x_h)); + +/* sys/swapon.c */ +x_int x_swapon __P((char *x_s)); + +/* sys/vhangup.c */ +void x_vhangup __P((void)); +#endif + +#endif diff --git a/x_include/x_syscall.h b/x_include/x_syscall.h new file mode 100644 index 0000000..d34d1a8 --- /dev/null +++ b/x_include/x_syscall.h @@ -0,0 +1,165 @@ +#include "x_.h" + +#ifndef x__SYSCALL_H_ +#define x__SYSCALL_H_ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)syscall.h 5.4 (Berkeley) 4/3/86 + */ + +#define x_SYS_exit 1 +#define x_SYS_fork 2 +#define x_SYS_read 3 +#define x_SYS_write 4 +#define x_SYS_open 5 +#define x_SYS_close 6 + /* 7 is old: wait */ +#define x_SYS_creat 8 +#define x_SYS_link 9 +#define x_SYS_unlink 10 +#define x_SYS_execv 11 +#define x_SYS_chdir 12 + /* 13 is old: time */ +#define x_SYS_mknod 14 +#define x_SYS_chmod 15 +#define x_SYS_chown 16 + /* 17 is old: sbreak */ + /* 18 is old: stat */ +#define x_SYS_lseek 19 +#define x_SYS_getpid 20 +#define x_SYS_mount 21 +#define x_SYS_umount 22 + /* 23 is old: setuid */ +#define x_SYS_getuid 24 + /* 25 is old: stime */ +#define x_SYS_ptrace 26 + /* 27 is old: alarm */ + /* 28 is old: fstat */ + /* 29 is old: pause */ + /* 30 is old: utime */ + /* 31 is old: stty */ + /* 32 is old: gtty */ +#define x_SYS_access 33 + /* 34 is old: nice */ + /* 35 is old: ftime */ +#define x_SYS_sync 36 +#define x_SYS_kill 37 +#define x_SYS_stat 38 + /* 39 is old: setpgrp */ +#define x_SYS_lstat 40 +#define x_SYS_dup 41 +#define x_SYS_pipe 42 + /* 43 is old: times */ +#define x_SYS_profil 44 + /* 45 is unused */ + /* 46 is old: setgid */ +#define x_SYS_getgid 47 + /* 48 is old: sigsys */ + /* 49 is unused */ + /* 50 is unused */ +#define x_SYS_acct 51 + /* 52 is old: phys */ + /* 53 is old: syslock */ +#define x_SYS_ioctl 54 +#define x_SYS_reboot 55 + /* 56 is old: mpxchan */ +#define x_SYS_symlink 57 +#define x_SYS_readlink 58 +#define x_SYS_execve 59 +#define x_SYS_umask 60 +#define x_SYS_chroot 61 +#define x_SYS_fstat 62 + /* 63 is unused */ +#define x_SYS_getpagesize 64 +#define x_SYS_mremap 65 + /* 66 is old: vfork */ + /* 67 is old: vread */ + /* 68 is old: vwrite */ +#define x_SYS_sbrk 69 +#define x_SYS_sstk 70 +#define x_SYS_mmap 71 + /* 72 is old: vadvise */ +#define x_SYS_munmap 73 +#define x_SYS_mprotect 74 +#define x_SYS_madvise 75 +#define x_SYS_vhangup 76 + /* 77 is old: vlimit */ +#define x_SYS_mincore 78 +#define x_SYS_getgroups 79 +#define x_SYS_setgroups 80 +#define x_SYS_getpgrp 81 +#define x_SYS_setpgrp 82 +#define x_SYS_setitimer 83 +#define x_SYS_wait 84 +#define x_SYS_swapon 85 +#define x_SYS_getitimer 86 +#define x_SYS_gethostname 87 +#define x_SYS_sethostname 88 +#define x_SYS_getdtablesize 89 +#define x_SYS_dup2 90 +#define x_SYS_getdopt 91 +#define x_SYS_fcntl 92 +#define x_SYS_select 93 +#define x_SYS_setdopt 94 +#define x_SYS_fsync 95 +#define x_SYS_setpriority 96 +#define x_SYS_socket 97 +#define x_SYS_connect 98 +#define x_SYS_accept 99 +#define x_SYS_getpriority 100 +#define x_SYS_send 101 +#define x_SYS_recv 102 +#define x_SYS_sigreturn 103 +#define x_SYS_bind 104 +#define x_SYS_setsockopt 105 +#define x_SYS_listen 106 + /* 107 was vtimes */ +#define x_SYS_sigvec 108 +#define x_SYS_sigblock 109 +#define x_SYS_sigsetmask 110 +#define x_SYS_sigpause 111 +#define x_SYS_sigstack 112 +#define x_SYS_recvmsg 113 +#define x_SYS_sendmsg 114 + /* 115 is old vtrace */ +#define x_SYS_gettimeofday 116 +#define x_SYS_getrusage 117 +#define x_SYS_getsockopt 118 + /* 119 is old resuba */ +#define x_SYS_readv 120 +#define x_SYS_writev 121 +#define x_SYS_settimeofday 122 +#define x_SYS_fchown 123 +#define x_SYS_fchmod 124 +#define x_SYS_recvfrom 125 +#define x_SYS_setreuid 126 +#define x_SYS_setregid 127 +#define x_SYS_rename 128 +#define x_SYS_truncate 129 +#define x_SYS_ftruncate 130 +#define x_SYS_flock 131 + /* 132 is unused */ +#define x_SYS_sendto 133 +#define x_SYS_shutdown 134 +#define x_SYS_socketpair 135 +#define x_SYS_mkdir 136 +#define x_SYS_rmdir 137 +#define x_SYS_utimes 138 + /* 139 is unused */ +#define x_SYS_adjtime 140 +#define x_SYS_getpeername 141 +#define x_SYS_gethostid 142 +#define x_SYS_sethostid 143 +#define x_SYS_getrlimit 144 +#define x_SYS_setrlimit 145 +#define x_SYS_killpg 146 + /* 147 is unused */ +#define x_SYS_setquota 148 +#define x_SYS_quota 149 +#define x_SYS_getsockname 150 + +#endif diff --git a/x_include/x_sysexits.h b/x_include/x_sysexits.h new file mode 100644 index 0000000..06bc93b --- /dev/null +++ b/x_include/x_sysexits.h @@ -0,0 +1,89 @@ +#include "x_.h" + +#ifndef x__SYSEXITS_H_ +#define x__SYSEXITS_H_ + +/* +** SYSEXITS.H -- Exit status codes for system programs. +** +** This include file attempts to categorize possible error +** exit statuses for system programs, notably delivermail +** and the Berkeley network. +** +** Error numbers begin at EX__BASE to reduce the possibility of +** clashing with other exit statuses that random programs may +** already return. The meaning of the codes is approximately +** as follows: +** +** EX_USAGE -- The command was used incorrectly, e.g., with +** the wrong number of arguments, a bad flag, a bad +** syntax in a parameter, or whatever. +** EX_DATAERR -- The input data was incorrect in some way. +** This should only be used for user's data & not +** system files. +** EX_NOINPUT -- An input file (not a system file) did not +** exist or was not readable. This could also include +** errors like "No message" to a mailer (if it cared +** to catch it). +** EX_NOUSER -- The user specified did not exist. This might +** be used for mail addresses or remote logins. +** EX_NOHOST -- The host specified did not exist. This is used +** in mail addresses or network requests. +** EX_UNAVAILABLE -- A service is unavailable. This can occur +** if a support program or file does not exist. This +** can also be used as a catchall message when something +** you wanted to do doesn't work, but you don't know +** why. +** EX_SOFTWARE -- An internal software error has been detected. +** This should be limited to non-operating system related +** errors as possible. +** EX_OSERR -- An operating system error has been detected. +** This is intended to be used for such things as "cannot +** fork", "cannot create pipe", or the like. It includes +** things like getuid returning a user that does not +** exist in the passwd file. +** EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp, +** etc.) does not exist, cannot be opened, or has some +** sort of error (e.g., syntax error). +** EX_CANTCREAT -- A (user specified) output file cannot be +** created. +** EX_IOERR -- An error occurred while doing I/O on some file. +** EX_TEMPFAIL -- temporary failure, indicating something that +** is not really an error. In sendmail, this means +** that a mailer (e.g.) could not create a connection, +** and the request should be reattempted later. +** EX_PROTOCOL -- the remote system returned something that +** was "not possible" during a protocol exchange. +** EX_NOPERM -- You did not have sufficient permission to +** perform the operation. This is not intended for +** file system problems, which should use NOINPUT or +** CANTCREAT, but rather for higher level permissions. +** For example, kre uses this to restrict who students +** can send mail to. +** +** Maintained by Eric Allman (eric@berkeley, ucbvax!eric) -- +** please mail changes to me. +** +** @(#)sysexits.h 4.2 7/31/83 +*/ + +# define x_EX_OK 0 /* successful termination */ + +# define x_EX__BASE 64 /* base value for error messages */ + +# define x_EX_USAGE 64 /* command line usage error */ +# define x_EX_DATAERR 65 /* data format error */ +# define x_EX_NOINPUT 66 /* cannot open input */ +# define x_EX_NOUSER 67 /* addressee unknown */ +# define x_EX_NOHOST 68 /* host name unknown */ +# define x_EX_UNAVAILABLE 69 /* service unavailable */ +# define x_EX_SOFTWARE 70 /* internal software error */ +# define x_EX_OSERR 71 /* system error (e.g., can't fork) */ +# define x_EX_OSFILE 72 /* critical OS file missing */ +# define x_EX_CANTCREAT 73 /* can't create (user) output file */ +# define x_EX_IOERR 74 /* input/output error */ +# define x_EX_TEMPFAIL 75 /* temp failure; user is invited to retry */ +# define x_EX_PROTOCOL 76 /* remote error in protocol */ +# define x_EX_NOPERM 77 /* permission denied */ + +#endif diff --git a/x_include/x_syslog.h b/x_include/x_syslog.h new file mode 120000 index 0000000..626f101 --- /dev/null +++ b/x_include/x_syslog.h @@ -0,0 +1 @@ +sys/x_syslog.h \ No newline at end of file diff --git a/x_include/x_time.h b/x_include/x_time.h new file mode 100644 index 0000000..d4fb3e3 --- /dev/null +++ b/x_include/x_time.h @@ -0,0 +1,45 @@ +#include "x_.h" + +#ifndef x__TIME_H_ +#define x__TIME_H_ + +#include + +/* time.h 1.1 85/03/13 */ + +/* + * Structure returned by gmtime and localtime calls (see ctime(3)). + */ +struct x_tm { + x_int x_tm_sec; + x_int x_tm_min; + x_int x_tm_hour; + x_int x_tm_mday; + x_int x_tm_mon; + x_int x_tm_year; + x_int x_tm_wday; + x_int x_tm_yday; + x_int x_tm_isdst; +}; + +/*extern struct tm *gmtime(), *localtime();*/ +/*extern char *asctime(), *ctime();*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/ctime.c */ +char *x_ctime __P((x_time_t *x_t)); +struct x_tm *x_localtime __P((x_time_t *x_tim)); +struct x_tm *x_gmtime __P((x_time_t *x_tim)); +char *x_asctime __P((struct x_tm *x_t)); +x_int x_dysize __P((x_int x_y)); +#endif + +#endif diff --git a/x_include/x_ttyent.h b/x_include/x_ttyent.h new file mode 100644 index 0000000..7d93991 --- /dev/null +++ b/x_include/x_ttyent.h @@ -0,0 +1,47 @@ +#include "x_.h" + +#ifndef x__TTYENT_H_ +#define x__TTYENT_H_ + +/* + * Copyright (c) 1983 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)ttyent.h 5.1 (Berkeley) 5/30/85 + */ + +struct x_ttyent { /* see getttyent(3) */ + char *x_ty_name; /* terminal device name */ + char *x_ty_getty; /* command to execute, usually getty */ + char *x_ty_type; /* terminal type for termcap (3X) */ + x_int x_ty_status; /* status flags (see below for defines) */ + char *x_ty_window; /* command to start up window manager */ + char *x_ty_comment; /* usually the location of the terminal */ +}; + +#define x_TTY_ON 0x1 /* enable logins (startup getty) */ +#define x_TTY_SECURE 0x2 /* allow root to login */ + +/*extern struct ttyent *getttyent();*/ +/*extern struct ttyent *getttynam();*/ + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/getttyent.c */ +x_int x_setttyent __P((void)); +x_int x_endttyent __P((void)); +struct x_ttyent *x_getttyent __P((void)); + +/* gen/getttynam.c */ +struct x_ttyent *x_getttynam __P((char *x_tty)); +#endif + +#endif diff --git a/x_include/x_utmp.h b/x_include/x_utmp.h new file mode 100644 index 0000000..97104e3 --- /dev/null +++ b/x_include/x_utmp.h @@ -0,0 +1,45 @@ +#include "x_.h" + +#ifndef x__UTMP_H_ +#define x__UTMP_H_ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)utmp.h 5.1 (Berkeley) 5/30/85 + */ + +/* + * Structure of utmp and wtmp files. + * + * Assuming the number 8 is unwise. + */ +struct x_utmp { + char x_ut_line[8]; /* tty name */ + char x_ut_name[8]; /* user id */ + char x_ut_host[16]; /* host name, if remote */ + x_long x_ut_time; /* time on */ +}; + +#ifndef x_KERNEL +#ifndef __P +#ifdef __STDC__ +#define __P(x_args) x_args +#else +#define __P(x_args) () +#endif +#endif + +/* gen/getlogin.c */ +char *x_getlogin __P((void)); + +/* gen/ttyname.c */ +char *x_ttyname __P((x_int x_f)); + +/* gen/ttyslot.c */ +x_int x_ttyslot __P((void)); +#endif + +#endif diff --git a/x_include/x_varargs.h b/x_include/x_varargs.h new file mode 100644 index 0000000..bd1643c --- /dev/null +++ b/x_include/x_varargs.h @@ -0,0 +1,14 @@ +#include "x_.h" + +#ifndef x__VARARGS_H_ +#define x__VARARGS_H_ + +/* varargs.h 4.1 83/05/03 */ + +typedef char *va_list; +# define va_dcl x_int va_alist; +# define va_start(x_list) x_list = (char *) &va_alist +# define va_end(x_list) +# define va_arg(x_list,x_mode) ((x_mode *)(x_list += sizeof(x_mode)))[-1] + +#endif diff --git a/x_include/x_vfont.h b/x_include/x_vfont.h new file mode 100644 index 0000000..edd1f52 --- /dev/null +++ b/x_include/x_vfont.h @@ -0,0 +1,34 @@ +#include "x_.h" + +#ifndef x__VFONT_H_ +#define x__VFONT_H_ + +/* + * Copyright (c) 1980 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * @(#)vfont.h 5.1 (Berkeley) 5/30/85 + */ + +/* + * The structures header and dispatch define the format of a font file. + * + * See vfont(5) for more details. + */ +struct x_header { + x_short x_magic; + x_unsigned_short x_size; + x_short x_maxx; + x_short x_maxy; + x_short x_xtend; +}; + +struct x_dispatch { + x_unsigned_short x_addr; + x_short x_nbytes; + char x_up,x_down,x_left,x_right; + x_short x_width; +}; + +#endif diff --git a/xify/stdarg.h b/xify/stdarg.h new file mode 100644 index 0000000..e5b1559 --- /dev/null +++ b/xify/stdarg.h @@ -0,0 +1,9 @@ +#ifndef _STDARG_H_ +#define _STDARG_H_ + +typedef __builtin_va_list va_list; +#define va_start(v, l) __builtin_va_start(v, l) +#define va_end(v) __builtin_va_end(v) +#define va_arg(v, l) __builtin_va_arg(v, l) + +#endif diff --git a/xify/x_.h b/xify/x_.h new file mode 100644 index 0000000..8a34ede --- /dev/null +++ b/xify/x_.h @@ -0,0 +1,9 @@ +#ifndef X_ +#define X_ +typedef short x_short; +typedef int x_int; +typedef int x_long; +typedef unsigned short x_unsigned_short; +typedef unsigned int x_unsigned_int; +typedef unsigned int x_unsigned_long; +#endif diff --git a/xify/xify.c b/xify/xify.c index b375798..7ebb309 100644 --- a/xify/xify.c +++ b/xify/xify.c @@ -51,8 +51,8 @@ int main() { l -= 4; } else if ( - (l != 8 || memcmp(p, "stdarg.h", 8) != 0) && - (l != 9 || memcmp(p, "varargs.h", 9) != 0) + (l != 8 || memcmp(p, "stdarg.h", 8) != 0) /*&& + (l != 9 || memcmp(p, "varargs.h", 9) != 0)*/ ) fwrite("x_", 2, 1, stdout); break; @@ -191,7 +191,7 @@ int main() { (l != 4 || memcmp(p, "case", 4) != 0) && (l != 4 || memcmp(p, "char", 4) != 0) && (l != 8 || memcmp(p, "continue", 8) != 0) && - (l != 7 || memcmp(p, "defined", 7) != 0 || buf[0] != '#') && + (l != 7 || memcmp(p, "defined", 7) != 0 /*|| buf[0] != '#'*/) && (l != 2 || memcmp(p, "do", 2) != 0) && (l != 6 || memcmp(p, "double", 6) != 0) && (l != 4 || memcmp(p, "else", 4) != 0) && @@ -218,6 +218,7 @@ int main() { (l != 8 || memcmp(p, "va_start", 8) != 0) && (l != 4 || memcmp(p, "void", 4) != 0) && (l != 5 || memcmp(p, "while", 5) != 0) && + (l < 10 || memcmp(p, "__builtin_", 10) != 0) && (l != 3 || memcmp(p, "__P", 3) != 0) && (l != 8 || memcmp(p, "__FILE__", 8) != 0) && (l != 8 || memcmp(p, "__LINE__", 8) != 0) && -- 2.34.1