0707070000020021651006440001460001440000010274100353460731400000500000000005Size1100 0707070000020021731006660001460001440000010274110352172540700001100000004100Makefile# Convergent Technologies - System V - Apr 1984 # "@(#)Makefile 1.0" include $(MAKEINC)/Makepre.h SHELL=/bin/sh INCRT= . LCFLAGS=-UKERNEL -DP2 -DDIAGNOSTIC -UDEBUG -DDVER=$(VER)\ -UMANUFACTURE -UVID -I$(INCRT) ASFLAGS= CPP=/lib/cpp X= VER = 1 LLDFLAGS= -n ifile.0410 -x #delete R 06/2/84 NM=nm CSRC=main.c init.c error.c trap.c msg.c \ mem.c page.c prot.c parity.c clk.c \ input.c printf.c i8274.c i8274sub.c atoi.c sprintf.c gdtest.c\ kbd.c disktst.c disk.c lp.c vid.c mouse.c\ modem.c dialer.c font.c odump.c \ newtest1.c \ version.c exp.c gtape.c showdate.c #Add your source files here!!! ASSRC=main1.s mch.s math.s OBJ=main1.o mch.o math.o main.o init.o error.o trap.o msg.o \ mem.o page.o prot.o parity.o clk.o \ input.o printf.o i8274.o i8274sub.o atoi.o sprintf.o gdtest.o\ kbd.o disk.o disktst.o \ lp.o vid.o mouse.o \ modem.o dialer.o rastop.o font.o odump.o\ newtest1.o \ exp.o gtape.o showdate.o version.o #Add your object files here!!! all: newversion $(OBJ) $(LD) -o s4diag $(LLDFLAGS) $(OBJ) $(NM) -xe s4diag | grep -v static > s4diag.nm install: all newversion: rm -f version.o showdate.o kbd.c: kpic.h rastop.o: rastop.m4 m4 < rastop.m4 > ..tmp.i $(CPP) ..tmp.i > ..tmp.s $(CC) $(LCFLAGS) -c ..tmp.s mv ..tmp.o rastop.o rm -f ..tmp.s ..tmp.i showdate.o: $(CC) -I$(INCRT) $(LCFLAGS) -DDATE="\"`date`\"" -DPWD="\"`pwd`\"" -c $< .SUFFIXES: .o .c.o: $(CC) $(LCFLAGS) -c $< includes: includes -I$(INCRT) $(LCFLAGS) $(CSRC) $(ASSRC) | sort -u > tMakeinc sh -c "cmp -s tMakeinc Makeincludes || mv tMakeinc Makeincludes" rm -f tMakeinc include Makeincludes clean: rm -f *.o clobber: clean rm -f s4diag lint: lint -I$(INCRT) $(LCFLAGS) $(CSRC) >lint$(VER).out print: lp Makefile Makeincludes *.h $(CSRC) rastop.m4 $(ASSRC) justnm: $(NM) -h s4diag |cut -c1-30|pr -l56 -4 -h "alphabetic s4diag.nm" -w120 >s4diag.nm $(NM) -hn s4diag |cut -c1-30|pr -l56 -4 -h "numeric s4diag.nm" -w120 >>s4diag.nm include $(MAKEINC)/Makepost.h .s.o: $(CPP) -I$(INCRT) $(LCFLAGS) $< > ..tmp.s $(CC) $(ASFLAGS) -c ..tmp.s mv ..tmp.o $@; rm ..tmp.s 0707070000020021741006660001460001440000010000000352172541000001500000000000Makeincludes0707070000020022071006660001460001440000010274410352172541000000700000000571atoi.c/* Convergent Technologies - System V - Jul 1983 */ /*static char atoi_c[] = "@(#)atoi.c 1.1";*/ atoi(p) register char *p; { register int n; register int f; n = 0; f = 0; for(;;p++) { switch(*p) { case ' ': case '\t': continue; case '-': f++; case '+': p++; } break; } while(*p >= '0' && *p <= '9') n = n*10 + *p++ - '0'; return(f? -n: n); } 0707070000020022130407550001460001440000020274420353675172000000400000000000sys0707070000020022231006660001460001440000010273270352172555500001300000002114sys/acct.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)acct.h 1.2" */ #ifndef acct_h #define acct_h #include /* * Accounting structures */ typedef ushort comp_t; /* "floating point" */ /* 13-bit fraction, 3-bit exponent */ struct acct { char ac_flag; /* Accounting flag */ char ac_stat; /* Exit status */ ushort ac_uid; /* Accounting user ID */ ushort ac_gid; /* Accounting group ID */ dev_t ac_tty; /* control typewriter */ time_t ac_btime; /* Beginning time */ comp_t ac_utime; /* acctng user time in clock ticks */ comp_t ac_stime; /* acctng system time in clock ticks */ comp_t ac_etime; /* acctng elapsed time in clock ticks */ comp_t ac_mem; /* memory usage */ comp_t ac_io; /* chars transferred */ comp_t ac_rw; /* blocks read or written */ char ac_comm[8]; /* command name */ }; extern struct acct acctbuf; extern struct inode *acctp; /* inode of accounting file */ #define AFORK 01 /* has executed fork, but no exec */ #define ASU 02 /* used super-user privileges */ #define ACCTF 0300 /* record type: 00 = acct */ #endif 0707070000020022421006660001460001440000010273330352172555600001200000012215sys/buf.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)buf.h 1.2" */ #ifndef buf_h #define buf_h #include #include #include #include #include /* * This structure describes the current transfer, * where it starts in memory, on the disk and how much will be done * in this dma operation and how much remains to be done. */ struct xfrinfo { ushort count; /* total operation: physical sector count for read/write, byte count for a format */ ushort thiscnt; /* physical sector count for this portion */ union { /* 16 bit word adress used in transfer */ int b_addr; /* to be loaded to the DMA */ struct { ushort high; ushort low; } addr; } a_un; ushort cyl; /* disk cylinder number for current part */ ushort sec; /* physical sector within track for this part */ ushort trk; /* disk head number for current part */ char mode; /* current operation */ }; /* * Each buffer in the pool is usually doubly linked into 2 lists: * the device with which it is currently associated (always) * and also on a list of blocks available for allocation * for other use (usually). * A buffer is on the available list, and is liable * to be reassigned to another disk block, if and only * if it is not marked BUSY. When a buffer is busy, the * available-list pointers can be used for other purposes. * Most drivers use the forward ptr as a link in their I/O active queue. * A buffer header contains all the information required to perform I/O. * Most of the routines which manipulate these things are in bio.c. */ struct buf { int b_flags; /* see defines below */ struct buf *b_forw; /* headed by d_tab of conf.c */ struct buf *b_back; /* " */ struct buf *av_forw; /* position on free list, */ struct buf *av_back; /* if not BUSY*/ #define b_actf av_forw /* alternate names for driver queue */ #define b_actl av_back /* head - isn't history wonderful */ dev_t b_dev; /* major+minor device name */ unsigned b_bcount; /* transfer count */ #define b_active b_bcount /* driver queue head: drive active */ union { caddr_t b_addr; /* low order core address */ int *b_words; /* words for clearing */ struct filsys *b_filsys; /* superblocks */ struct dinode *b_dino; /* ilist */ daddr_t *b_daddr; /* indirect block */ } b_un; #define paddr(X) (paddr_t)(X->b_un.b_addr) daddr_t b_blkno; /* block # on device */ char b_error; /* returned after I/O */ unsigned int b_resid; /* words not transferred after error */ #define b_errcnt b_resid /* while i/o in progress: # retries */ #define b_pfcent b_resid /* garbage: don't ask */ time_t b_start; /* request start time */ struct proc *b_proc; /* process doing physical or swap I/O */ ushort b_paddr[2]; /* ONLY valid if B_UAREA is set - contains page frame #s for upage */ struct xfrinfo x; /* information prepared by gdstrategy to allow transfer to be split into multiple parts if necessary */ }; extern struct buf bfreelist; /* head of available list */ extern struct buf pbuf[]; /* Physio header pool */ struct pfree { int b_flags; struct buf *av_forw; }; extern struct pfree pfreelist; /* head of physio pool */ extern struct buf swbuf[]; /* swap I/O headers */ extern int nswbuf; extern short swsize[]; extern int swpf[]; extern struct buf bswlist; /* head of free swap header list */ extern struct buf *bclnlist; /* head of cleaned page list */ /* * These flags are kept in b_flags. */ #define B_WRITE 0 /* non-read pseudo-flag */ #define B_READ 01 /* read when I/O occurs */ #define B_DONE 02 /* transaction finished */ #define B_ERROR 04 /* transaction aborted */ #define B_BUSY 010 /* not on av_forw/back list */ #define B_PHYS 020 /* Physical IO potentially using memory map */ #define B_MAP 040 /* This block has the memory map allocated */ #define B_WANTED 0100 /* issue wakeup when BUSY goes off */ #define B_AGE 0200 /* delayed write for correct aging */ #define B_ASYNC 0400 /* don't wait for I/O completion */ #define B_DELWRI 01000 /* don't write till block leaves available list */ #define B_OPEN 02000 /* open routine called */ #define B_STALE 04000 #define B_UNMAP 0x001000 /* page in/out of page table space */ #define B_DIRTY 0x002000 /* dirty page to be pushed out async */ #define B_PGIN 0x004000 /* pagein op, so swap() can count it */ #define B_CACHE 0x008000 /* did bread find us in the cache ? */ #define B_INVAL 0x010000 /* does not contain valid info */ #define B_LOCKED 0x020000 /* locked in core (not reusable) */ #define B_HEAD 0x040000 /* a buffer header, not a buffer */ #define B_BAD 0x100000 /* bad block revectoring in progress */ #define B_UAREA 0x200000 /* add u-area to a swap operation */ #define B_HOLE 0x400000 /* read a hole, sync block alloc */ #define B_FORMAT 0x800000 /* perform a format operation with the data associated with this hdr */ #define B_START 0x01000000 /* operation has been started */ /* * Fast access to buffers in cache by hashing. */ #define bhash(d,b) ((struct buf *)&hbuf[((int)d+(int)b)&v.v_hmask]) struct hbuf { int b_flags; struct buf *b_forw; struct buf *b_back; }; extern struct hbuf hbuf[]; #endif 0707070000020022471006660001460001440000010273540352172555700001400000001067sys/callo.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)callo.h 1.2" */ #ifndef callout_h #define callout_h #include /* * 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 callo { int c_time; /* incremental time */ caddr_t c_arg; /* argument to routine */ int (*c_func)(); /* routine */ }; #ifdef KERNEL extern struct callo callout[]; #endif #endif callout_h 0707070000020022641006660001460001440000010274240352172555700001300000003735sys/cmap.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)cmap.h 1.1" */ #ifndef cmap_h #define cmap_h /* * core map entry */ struct cmap { unsigned int c_next:12, /* index of next free list entry */ c_prev:12, /* index of previous free list entry */ c_lock:1, /* locked for raw i/o or pagein */ c_want:1, /* wanted */ c_intrans:1, /* intransit bit */ c_free:1, /* on the free list */ c_gone:1, /* associated page has been released */ c_type:3, /* type CSYS,CTEXT,CSTACK,CDATA,CKVMEM */ c_page:12, /* virtual page number in segment */ c_hlink:12, /* hash link for */ c_mdev:8, /* which dev this is from(minor device no) */ c_pgacc:2, /* access status of the physical page */ c_valino:1, /* valid disk ino in either proc or text */ c_reserve:3, /* reserved */ c_ndx:10, /* when valid, contains index of owner proc */ /* or text. The file inode no is in either */ /* proc or text. */ /* when invalid, contains file inode no */ c_blkno:16; /* disk block this is a copy of */ }; #define CMHEAD 0 #ifdef MHASH /* * 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 CMHSIZ 512 /* SHOULD BE DYNAMIC */ #define CMHASH(bn) ((bn)&(CMHSIZ-1)) #endif MHASH #ifdef KERNEL struct cmap *cmap; struct cmap *ecmap; int ncmap; int firstfree, maxfree; int ecmx; /* cmap index of ecmap */ #ifdef MHASH extern struct cmap *mfind(); short cmhash[CMHSIZ]; #endif MHASH #endif KERNEL /* bits defined in c_type */ #define CSYS 0 /* none of below */ #define CTEXT 1 /* belongs to shared text segment */ #define CDATA 2 /* belongs to data segment */ #define CSTACK 3 /* belongs to stack segment */ #define CKVMEM 4 /* kernel virtual memory */ #define pgtocm(x) ((short)((x) - firstfree + 1)) #define cmtopg(x) ((x) -1 + firstfree) #endif cmap_h 0707070000020022701006660001460001440000010273700352172555700001300000002363sys/conf.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)conf.h 1.2" */ #ifndef conf_h #define conf_h #include #include /* * 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 bdevsw { int (*d_open)(); int (*d_close)(); int (*d_strategy)(); int (*d_print)(); }; extern struct bdevsw bdevsw[]; /* * Character device switch. */ struct cdevsw { int (*d_open)(); int (*d_close)(); int (*d_read)(); int (*d_write)(); int (*d_ioctl)(); struct tty *d_ttys; }; extern struct cdevsw cdevsw[]; extern int bdevcnt; extern int cdevcnt; /* * Line discipline switch. */ struct linesw { int (*l_open)(); int (*l_close)(); int (*l_read)(); int (*l_write)(); int (*l_ioctl)(); int (*l_input)(); int (*l_output)(); int (*l_mdmint)(); }; extern struct linesw linesw[]; extern int linecnt; /* * Terminal switch */ struct termsw { int (*t_input)(); int (*t_output)(); int (*t_ioctl)(); }; extern struct termsw termsw[]; extern int termcnt; /* * Swap device information (from BSD 4.1) */ struct swdevt { dev_t sw_dev; int sw_freed; }; extern struct swdevt swdevt[]; #endif 0707070000020023131006660001460001440000010274050352172555700001500000005201sys/dialer.h/* ----------------------------------------------------------------- | The following declarations are used for forming the control | | word for the dialer chip. The low byte is used for tone | | generation, high byte for the path and output control. | ----------------------------------------------------------------- */ /* DTMF tone values */ #define kDIGIT1 0x0000 #define kDIGIT2 0x0008 #define kDIGIT3 0x0004 #define kDIGIT4 0x0001 #define kDIGIT5 0x0009 #define kDIGIT6 0x0005 #define kDIGIT7 0x0002 #define kDIGIT8 0x000A #define kDIGIT9 0x0006 #define kDIGIT0 0x000B #define kDIGAST 0x0003 #define kDIGPND 0x0007 /* Touch tone volume control */ /* If kNoFeedback is used touch tone is not heard by the user */ #define kTouchToneOff 0x0000 /* Dialing not possible! */ #define kNoTTFeedback 0x0030 #define kLoudTTVolume 0x0080 /* Feedback volume control */ #define kNormalTTVolume 0x0040 #define kSoftTTVolume 0x00C0 /* Ringer volume control */ #define kLoudRinging 0x00B0 #define kNormalRinging 0x0070 #define kSoftRinging 0x00F0 /* Speaker phone control */ #define kSpeakerPhone 0x0B30 #define kListenToLine 0x0A00 #define kNoSpeakerPhone 0x1700 #define kHandset 0x2900 #define kNoHandset 0x0900 #define kOpenCircuit 0x4000 #define kCloseCircuit (~kOpenCircuit) #define OPENRELAY 0x4000 #define CLOSERELAY (~OPENRELAY) #define ENB_HNDSET OPENRELAY #define DIS_HNDSET (~ENB_HNDSET) /* Telephony relay addresses */ #define TEL_STATUSREG ((unsigned short*) 0x450000) #define DIALER_LOWER ((unsigned char*) 0x4B0400) /* dialer address */ #define DIALER_HIGHER ((unsigned char*) 0x4B0800) /* dialer address */ #define HNDSET_RELAY ((unsigned short*) 0x490000) /* Handset relay */ #define LINE_SELECT ((unsigned short*) 0x491000) /* 0 */ #define HOOK1_RELAY ((unsigned short*) 0x492000) /* line 1 hook relay */ #define HOOK2_RELAY ((unsigned short*) 0x493000) /* line 2 hook relay */ #define LINE1_ACTIVE ((unsigned short*) 0x494000) /* line 1 on hold */ #define LINE2_ACTIVE ((unsigned short*) 0x495000) /* line 2 on hold */ #define A_LEAD1_RELAY ((unsigned short*) 0x496000) /* line 1 A-lead */ #define A_LEAD2_RELAY ((unsigned short*) 0x497000) /* line 2 A-lead */ /* These values are used to enabled the detection of external event */ /* They are used to mask the word variable EventMaskReg. */ #define ENB_FAST_CLK 0x100 #define ENB_DSR_DETEC 0x080 #define ENB_RS232_RING 0x040 #define ENB_LPR_INT 0x020 #define ENB_MSG_WAIT 0x010 #define ENB_HOOK_DETEC 0x008 #define ENB_LN1_RING 0x004 #define ENB_LN2_RING 0x001 #define ON_HOOK 0x1 #define LINE1_RING 0x2 #define LINE2_RING 0x4 #define MSG_WAITING 0x8 0707070000020023211006660001460001440000010273770352172556000001200000000346sys/dir.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)dir.h 1.2" */ #ifndef dir_h #define dir_h #include #ifndef DIRSIZ #define DIRSIZ 14 #endif struct direct { ino_t d_ino; char d_name[DIRSIZ]; }; #endif 0707070000020023221006660001460001440000010274650352172556000001300000001635sys/dmap.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)dmap.h 1.2" */ #ifndef dmap_h #define dmap_h #include /* * Definitions for the mapping of vitual swap * space to the physical swap area - the disk map. */ #define NDMAP 16 /* size of the swap area map */ #define DMMIN 4 /* the initial block size in clicks */ #define DMMAX 128 /* max block size alloc on drum = .5M byte */ #define DMTEXT 128 /* size of blocks of pure text = .5M byte */ struct dmap { swblk_t dm_size; /* current size used by process */ swblk_t dm_alloc; /* amount of physical swap space allocated */ swblk_t dm_map[NDMAP]; /* first disk block number in each chunk */ }; #ifdef KERNEL struct dmap zdmap; #endif /* * The following structure is that ``returned'' * from a call to vstodb(). */ struct dblock { swblk_t db_base; /* base of physical contig drum block */ swblk_t db_size; /* size of block */ }; #endif 0707070000020023371006660001460001440000010274670352172556000001300000001633sys/elog.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)elog.h 1.2" */ #ifndef elog_h #define elog_h #include /* * "True" major device numbers. These correspond * to standard positions in the configuration * table, but are used for error logging * purposes only. */ #define GD0 0 /* * IO statistics are kept for each physical unit of each * block device (within the driver). Primary purpose is * to establish a guesstimate of error rates during * error logging. */ struct iostat { long io_ops; /* number of read/writes */ long io_misc; /* number of "other" operations */ ushort io_unlog; /* number of unlogged errors */ }; /* * structure for system accounting */ struct iotime { struct iostat ios; long io_bcnt; /* total blocks transferred */ time_t io_act; /* total controller active time */ time_t io_resp; /* total block response time */ }; #define io_cnt ios.io_ops #endif 0707070000020023401006660001460001440000010274700352172556000001300000005701sys/erec.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)erec.h 1.2" */ #ifndef erec_h #define erec_h #include #include /* * Every error record has a header as follows. */ struct errhdr { short e_type; /* record type */ short e_len; /* bytes in record (with header) */ time_t e_time; /* time of day */ }; /* * Error record types */ #define E_GOTS 010 /* Start for UNIX/TS */ #define E_GORT 011 /* Start for UNIX/RT */ #define E_STOP 012 /* Stop */ #define E_TCHG 013 /* Time change */ #define E_CCHG 014 /* Configuration change */ #define E_BLK 020 /* Block device error */ #define E_STRAY 030 /* Stray interrupt */ #define E_PRTY 031 /* Memory parity */ /* * Error logging startup record. One of these is * sent to the logging daemon when logging is * first activated. */ struct estart { short e_cpu; /* cpu type */ struct utsname e_name; /* system names */ short e_mmr3; /* contents of mem mgmt reg 3 (11/70 and 11/45) */ long e_syssize; /* system memory size (11/70 only) */ short e_bconf; /* block device configuration */ }; /* * Error logging termination record that is sent to the daemon * when it stops error logging. */ #define eend errhdr /* * A time change record is sent to the daemon whenever * the system's time of day is changed. */ struct etimchg { time_t e_ntime; /* new time */ }; /* * A configuration change message is sent to * the error logging daemon whenever a block device driver * is attached or detached (MERT only). */ struct econfchg { char e_trudev; /* "true" major device number */ char e_cflag; /* driver attached or detached */ }; #define E_ATCH 1 #define E_DTCH 0 /* * Template for the error record that is logged by block devices. */ struct eblock { dev_t e_dev; /* "true" major + minor dev number */ physadr e_regloc; /* controller address */ short e_bacty; /* other block I/O activity */ struct iostat e_stats; /* unit I/O statistics */ short e_bflags; /* read/write, error, etc */ short e_cyloff; /* logical dev start cyl */ daddr_t e_bnum; /* logical block number */ ushort e_bytes; /* number of bytes to transfer */ paddr_t e_memadd; /* buffer memory address */ ushort e_rtry; /* number of retries */ short e_nreg; /* number of device registers */ #ifdef vax struct mba_regs e_mba; /* mass bus adaptor registers */ #endif }; /* * Flags (selected subset of flags in buffer header) */ #define E_WRITE 0 #define E_READ 1 #define E_NOIO 02 #define E_PHYS 04 #define E_MAP 010 #define E_ERROR 020 /* * Template for the stray interrupt record that is logged * every time an unexpected interrupt occurs. */ struct estray { physadr e_saddr; /* stray loc or device addr */ short e_sbacty; /* active block devices */ }; /* * Memory parity error record that is logged whenever one * of those things occurs (11/70s only). */ struct eparity { short e_parreg[4]; /* memory subsystem registers */ }; struct ememory { int e_sbier; int e_memcad; }; #endif 0707070000020023411006660001460001440000010275000352172556000001200000001260sys/err.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)err.h 1.2" */ #ifndef err_h #define err_h /* * structure of the err buffer area */ #define NESLOT 20 #define E_LOG 01 #define E_SLP 02 struct err { int e_nslot; /* number of errslots */ int e_flag; /* state flags */ struct errhdr **e_org; /* origin of buffer pool */ struct errhdr **e_nxt; /* next slot to allocate */ struct errslot { int slot[8]; } e_slot[NESLOT]; /* storage area */ struct map e_map[(NESLOT+3)/2]; /* free space in map */ struct errhdr *e_ptrs[NESLOT]; /* pointer to logged errors */ }; extern struct err err; extern struct errhdr *geteslot(); extern struct errhdr *geterec(); #endif 0707070000020023441006660001460001440000010275060352172556100001400000004612sys/errno.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)errno.h 1.2" */ /* * Error codes */ #define EPERM 1 /* Not super-user */ #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 */ #define EDOM 33 /* Math arg out of domain of func */ #define ERANGE 34 /* Math result not representable */ #define ENOMSG 35 /* No message of desired type */ #define EIDRM 36 /* Identifier removed */ #define ECHRNG 37 /* Channel number out of range */ #define EL2NSYNC 38 /* Level 2 not synchronized */ #define EL3HLT 39 /* Level 3 halted */ #define EL3RST 40 /* Level 3 reset */ #define ELNRNG 41 /* Link number out of range */ #define EUNATCH 42 /* Protocol driver not attached */ #define ENOCSI 43 /* No CSI structure available */ #define EL2HLT 44 /* Level 2 halted */ /* Convergent Error Returns */ #define EBADE 50 /* invalid exchange */ #define EBADR 51 /* invalid request descriptor */ #define EXFULL 52 /* exchange full */ #define ENOANO 53 /* no anode */ #define EBADRQC 54 /* invalid request code */ #define EBADSLT 55 /* invalid slot */ #define EDEADLOCK 56 /* file locking deadlock error */ #define EBFONT 57 /* bad font file fmt */ 0707070000020023461006660001460001440000010275200352172556100001300000000207sys/fblk.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)fblk.h 1.2" */ struct fblk { int df_nfree; daddr_t df_free[NICFREE]; }; 0707070000020023471006660001460001440000010275210352172556100001300000002436sys/file.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)file.h 1.2" */ #ifndef file_h #define file_h #include #include /* * One file structure is allocated for each open/creat/pipe call. * Main use is to hold the read/write pointer associated with * each open file. */ struct file { char f_flag; cnt_t f_count; /* reference count */ union { struct inode *f_uinode; /* pointer to inode structure */ struct file *f_unext; /* next entry in freelist */ } f_up; off_t f_offset; /* read/write character pointer */ }; #define f_inode f_up.f_uinode #define f_next f_up.f_unext extern struct file file[]; /* The file table itself */ extern struct file *ffreelist; /* Head of freelist pool */ /* flags */ #define FOPEN (-1) #define FREAD 00001 /* open for read */ #define FWRITE 00002 /* open for write */ #define FNDELAY 00004 /* delay bit */ #define FAPPEND 00010 /* append mode */ #define FSYNC 00020 #define FMASK 00377 /* mask */ /* open only modes */ #define FCREAT 00400 #define FTRUNC 01000 #define FEXCL 02000 #ifdef mega #define FNONAM 04000 /* no name given (pipes) - Kernel only */ #define FEXEC 010000 /* Exec open - Kernel only */ #define FMKNOD 020000 /* For mknod system call */ #endif mega #define FINODE 040000 /* Inode open */ #endif 0707070000020023501006660001460001440000010275250352172556100001500000002453sys/filsys.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)filsys.h 1.3" */ #ifndef filsys_h #define filsys_h #include /* * Structure of the super-block */ struct filsys { ushort s_isize; /* size in blocks of i-list */ daddr_t s_fsize; /* size in blocks of entire volume */ short s_nfree; /* number of addresses in s_free */ daddr_t s_free[NICFREE]; /* free block list */ short s_ninode; /* number of i-nodes in s_inode */ ino_t s_inode[NICINOD]; /* free i-node list */ char s_flock; /* lock during free list manipulation */ char s_ilock; /* lock during i-list manipulation */ char s_fmod; /* super block modified flag */ char s_ronly; /* mounted read-only flag */ time_t s_time; /* last super block update */ short s_dinfo[4]; /* device information */ daddr_t s_tfree; /* total free blocks*/ ino_t s_tinode; /* total free inodes */ char s_fname[6]; /* file system name */ char s_fpack[6]; /* file system pack name */ long s_fill[13]; /* ADJUST to make sizeof filsys be 512 */ long s_magic; /* magic number to indicate new file system */ long s_type; /* type of new file system */ long s_fill2[2]; /* final ADJUSTMENT so sizeof filsys is 512 */ }; #define FsMAGIC 0xfd187e20 /* s_magic number */ #define Fs1b 1 /* 512 byte block */ #define Fs2b 2 /* 1024 byte block */ #endif 0707070000020023511006660001460001440000010275300352172556200001300000003064sys/font.h/* Unix Window System Font/Icon Defintions */ #ifndef FONT_H #define FONT_H #define FMAGIC 0616 /* font file magic number */ #define FNTSIZE 96 /* size of a font */ #define FNTBASE 32 /* first character */ #define FNSIZE 60 /* maximum font name size */ #define ICONSIZE 64 /* shorts in icon raster area */ #ifdef KERNEL /***** BEWARE: */ /***** the fntdef and fcdef structures should not be changed */ /***** without changing the raster text function (io/rastex.s) */ #endif struct fcdef /* font character definition */ { char fc_hs; /* horizontal size in bits */ char fc_vs; /* vertical size */ char fc_ha; /* horizontal adjust (signed) */ char fc_va; /* vertical adjust (signed) */ char fc_hi; /* horizontal increment */ char fc_dummy; /* force it to be 8 bytes/entry */ short fc_mr; /* relative mini-raster pointer */ }; struct fntdef { long ff_magic; /* magic number */ unsigned char ff_flags; /* flags */ char ff_hs; /* nominal horizontal spacing */ char ff_vs; /* nominal vertical spacing */ char ff_baseline; /* pixel offset to baseline */ char ff_dummy[24]; /* round to 32 bytes */ struct fcdef ff_fc[FNTSIZE]; /* font control */ unsigned short ff_raster; /* raster data begins here */ }; struct ufdata /* user font data */ { short uf_slot; /* slot number */ char uf_name[FNSIZE];/* font name (file name) */ }; struct icon /* an icon */ { char ic_flags; /* flags */ struct fcdef ic_fc; /* font def */ unsigned short ic_raster[ICONSIZE]; /* raster data */ }; #endif FONT_H 0707070000020023521006660001460001440000010275330352172556200001600000002224sys/gdioctl.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)gdioctl.h 1.3" */ #ifndef gdioctl_h #define gdioctl_h #include "sys/gdisk.h" /* * Ioctl control packet */ struct gdctl { unsigned short status; /* status */ struct gdswprt params; /* description of the disk */ short dsktyp; /* the type of disk */ }; #define GDIOCTYPE 0xff00 /* same as TTY IOCTYPE - identifies type as disk, returns GDIOC */ #define GDIOC ('G'<<8) #define GDGETA (GDIOC|1) /* get gdisk structure */ #define GDSETA (GDIOC|2) /* set gdisk structure */ #define GDFORMAT (GDIOC|3) /* format track command */ #define GDDISMNT (GDIOC|4) /* flush buffers ready for removing */ #define GDNOTIFY (GDIOC|5) /* notify this proc via SIGUSR1 when disk comes on line */ #define GDUNNOTIFY (GDIOC|6) /* clear notification needed */ /* * Disk types */ #define GD_WIN HD /* Winchester */ #define GD_SYQ SY /* Syquest */ #define GD_FLP FP /* Floppy */ /* * Status bits */ #define VALID_VHB F_CT_FMT /* valid vhb has been read */ #define DRV_READY F_READY /* the disk is on line */ #define PULLED F_PULLED /* the disk was removed without permission last time */ #endif gdioctl_h 0707070000020023531006660001460001440000010275400352172556300001400000040326sys/gdisk.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)gdisk.h 1.8" */ #ifndef gdisk_h #define gdisk_h #include "sys/buf.h" #include "sys/iobuf.h" #include "sys/elog.h" #define SURF_PATTRN 0x6db6db6d #define DISKS 3 /* the number of disks on MiniFrame */ #define MINIDENSITY 2 /* MiniFrame floppy disks are double density */ #define GDRETRIES 10 /* 10 retries to recover operation */ #define GAPSZ 36 /* size of gap1 and gap3 for format */ /* defines for manipulating the minor node number */ #define DRVSHIFT 4 /* slice number occupies the ls 4 bits */ #define DRVMSK 3 /* drive number is 2 bits */ #define SLCMSK 0xF /* slice number is 4 bits */ #define MAXSLICE 16 /* maximum number of slices */ /* bit ops to isolate fields in minor number */ #define gddrive(X) ((X>>DRVSHIFT)&DRVMSK) #define gdslice(X) (X&SLCMSK) /* * data describing disk specific information held in the VHB and then * loaded into the gdsw table */ struct gdswprt { char name[6]; /* printf name */ ushort cyls; /* the number of cylinders for this disk */ ushort heads; /* number of heads per cylinder */ ushort psectrk; /* number of physical sectors per track */ ushort pseccyl; /* number of physical sectors per cylinder */ char flags; /* floppy density and high tech drive flags */ char step; /* stepper motor rate to controller */ ushort sectorsz; /* physical sector size in bytes */ }; /* flags in gdswprt */ #define FPDENSITY 0x01 /* 0=single 1=double density */ #define FPMIXDENS 0x02 /* 0=all tracks are the same density 1= cylinder zero is single density */ #define HITECH 0x04 /* 0= reduced write current is valid, 1= head select bit 3 is valid */ #define NEWPARTTAB 0x08 /* 0= old style partition table, 1= new style partition table */ /* disk slice table */ struct partit{ /* partition table */ union { uint strk; /* start track number (new style) */ struct { ushort strk; /* start track # */ ushort nsecs; /* # logical blocks available to user */ } old; } sz; }; /* disk slice table in memory */ struct mpartit{ /* partition table */ uint strk; /* start track # */ uint nsecs; /* # of logical sectors available to user */ }; /* bad block cell on disk */ struct bbcell { ushort cyl; /* the cylinder of the bad block */ ushort badblk; /* the physical sector address of the bad block within the cylinder cyl */ ushort altblk; /* track number of alternate */ ushort nxtind; /* index into the cell array for next bad block cell for this cylinder */ }; struct hd_iv { int cyls; int trks; int psecs; int blks; int pn1; int pn2; int pn3; }; /* bad block cell in memory */ struct bbmcell { ushort badblk; /* the physical sector address of the bad block within the cylinder cyl */ ushort altblk; /* track number of alternate */ char nxtind; /* index into the cell array for next bad block cell for this cylinder */ }; /* internal switch for various disk parameters and device specific routines */ /* table initialization is in gdtab.c */ /* indexed into by gddtab[n].btype */ struct gdsw { uint v_flags; /* flags for this drive/disk */ struct gdswprt dsk; /* disk specific information */ ushort curcyl; /* current cylinder number */ ushort reqcyl; /* cylinder number required for this transfer */ ushort sectrk; /* actual number of physical data sectors in the logical map per track. i.e omitting the alternate sectors located in the 17th sector of each track */ ushort seccyl; /* actual number of physical data sectors in the logical map per cylinder. i.e omitting the alternate sectors located in the 17th sector of each track */ ushort DMAto; /* max duration of a disk operation (1/4 sec units) */ int (*intr)(); int (*start)(); /* more volume home block information */ ushort szbbq; /* size of bad block cylinder index */ ushort szbb; /* size of bad block table */ char *bbq; /* bad block cylinder index */ struct bbmcell *bb; /* bad block table */ struct mpartit partab[MAXSLICE]; /* partition table */ }; #define MNAMSZ 40 /* max length of name including null terminator */ struct mntnam { char name[MNAMSZ]; /* full path name of mount point */ }; /* volume home block on disk */ struct vhbd { uint magic; /* miniframe disk format code */ int chksum; /* adjustment so that the 32 bit sum starting from magic for 512 bytes sums to -1 */ struct gdswprt dsk; /* specific description of this disk */ struct partit partab[MAXSLICE]; /* partition table */ struct resdes{ /* reserved area special files */ daddr_t blkstart; /* start logical block # */ ushort nblocks; /* length in logical blocks (zero implies not present) */ } resmap[8]; /* resmap consists of the following entries: * loader area * bad block table * dump area * down load image file * Bootable program, size determined by a.out format. nblocks=1. */ char fpulled; /* dismounted last time? */ struct mntnam mntname[MAXSLICE]; /* names for auto mounting. null string means no auto mount */ long time; /* time last came on line */ }; #define VHBMAGIC 0x55515651 /* magic number in disk vhb */ /* indexes into resmap */ #define INDLOADER 0 #define INDBBTBL 1 #define INDDUMP 2 #define INDDOWNLOAD 3 #define INDBOOT 4 /* values for hwtype */ #define HD 0 /* Winchester */ #define SY 1 /* Syquest */ #define FD 2 /* floppy */ /* values of flag bits in v_flags */ #define F_OPENED 0x0001 /* set when the first open is performed for any slice on this disk, cleared when the drive goes off line - indicates an attempt has been made to read the vhb */ #define F_CT_FMT 0x0002 /* a valid vhb has been read for this disk, this implies logical block=1024 bytes and bad block handling */ #define F_READY 0x0004 /* ready from controller */ #define F_PULLED 0x0008 /* disk was removed without permission last time, produces warning on open */ #define PHYS_ADDR 0x0010 /* alien disk. gdswprt supplied via ioctl. the flag is set by ioctl for reading non standard floppies. cleared by close. slice 0 is the only valid one */ /* in this mode the offset number is the physical sector number <<10, whether sector size is 1024, 512, 256 or 128. count is still the number of bytes. */ #define F_MAYREMOVE 0x0020 /* the drive may go off line */ #define WR_PROT 0x0040 /* set after each transfer. 1=write protected disk. 0=not protected */ /* bad block table */ /* * On the disk the bad block table consists of an array of cells, one per * used alternate physical sector. * cyl is the cylinder containing the bad block badblk. * badblk is the physical sector address (within the cylinder cyl) * of a bad block. * altblk is the location of the alternate physical sector. It is * specified as the track number since the alternate sector is * always the last sector of a track. * nxtind is a chain of bad blocks on the same cylinder. The number is * the index into this array of bad block cells. A value of zero * means the end of the chain for this cylinder. The zero'th * entry is not used, other than to hold the count of used cells). * * * In memory a similar array will be held in the appropriate gdbtab * together with an array containing an entry for each cylinder which * holds the index into the above array of cells for the head for that * cylinder. * This means that a zero entry indicates no bad blocks on that cylinder. * * This mechanism implies a maximum of 255 bad blocks per disk which is * adequate for disks upto the 250 Mbyte range. * The bad block table is held as a chained set of logical blocks on * track zero. Each block can hold 256 entries. * The first bad block cell in each logical block of the bad block table * contains a chksum (in cyl and badblk) for the 1024 byte block, it is * a 32 bit sum which sums to -1. altblk contains the logical block * number of the next block in the bad block table, zero=end. * On a disk with an odd number of sectors per track, the last sector * is removed from the logical mapping and is used as an alternate area. * * Bad block handling is disabled on floppies. */ #define HDMAXBADBLK 256 /* only support maximum of 256 bad blocks */ #define HDMAXCYL 1024 /* support a maximum of 1024 cylinders */ #define SYMAXBADBLK 40 /* only support maximum of 40 bad blocks */ #define SYMAXCYL 1024 /* support a maximum of 1024 cylinders */ #define FPMAXBADBLK 0 /* no bad block support on floppies */ #define FPMAXCYL 0 /* no bad block support on floppies */ /* this structure contains the relevant information about the transfer * currently in progress. */ struct driver { /* ******* d_flags + ctl are accessed by assembly code in trap.s ******* */ /* ******* do not change their sizes, locations or contents without **** */ /* ******* checking their use in trap.s. ***** */ ushort d_flags; /* driver flags */ char ctl; /* controller number */ char retries; /* number of retries remaining for this operation before we give up */ int fd_timer; /* fd motor on timer */ ushort timer; /* timer for operation completion */ struct xfrinfo x; /* details of the current required transfer */ struct xfrinfo rpt; /* details of the current real transfer */ /* information for repeating a transfer (needed because of bad blocks) */ ushort rptcyl; ushort rpttrk; ushort rptsec; ushort rpttcnt; dev_t disk; /* current device for transfer */ int xfrcnt; /* count of characters transferred so far */ union { /* holds virtual address in Kernel address */ caddr_t b_addr; /* space that is mapped to correspond with */ struct { /* the address in bp->a_un */ ushort high; ushort low; } addr; } c_un; struct proc *notify; /* proc pointer to inform when drive comes online */ /* information for error logging */ ushort erstatus; /* controller status */ ushort erdmacnt; /* count in dma */ ushort ertrklreg; /* track register from controller */ ushort ertrkhreg; /* high bits of cylinder */ ushort ersecreg; /* sector register from controller */ ushort ererrflg; /* extra error information from controller */ ushort erseccnt; /* sector count register */ ushort ersdhreg; /* sdh register */ ushort rpts; /* total transfers for complete request */ }; /* values in d_flags */ #define F_ACTIVE (ushort)0x0001 /* driver operation in progress */ #define F_DMAON (ushort)0x0002 /* DMA operation in progress */ #define F_SEEKING (ushort)0x0004 /* seek operation in progress */ #define FDMTRON (ushort)0x0008 /* floppy motor is on + up to speed */ #define FDMTRSTRT (ushort)0x0010 /* the floppy motor has been started but is not up to speed yet */ #define FDCHECKED (ushort)0x0020 /* set when floppy has been verified as still being the same one that was on line before the motor was turned off */ #define MAYGETFDINT (ushort)0x0040 /* on reseting the floppy the 2797 may or may not choose to give an interrupt, so be prepared to discard it */ #define FDSPECIALRD (ushort)0x0080 /* a read of the vhb from dismount caused a special read to be be performed in the disk driver while checking if the floppy had been changed */ #define FDNEWQ (ushort)0x0100 /* new disk maybe so use recal to establish head position */ #define FD_TIMEOUT (ushort)0x0200 /* a timeout occurred on a floppy transfer, floppy not in or in backwards - so terminate with error*/ /* values in ctl (supplied from assembly interrupt code) */ #define WD2797 1 #define WD1010 0 #define BIU 2 extern struct driver gdreal; extern struct gdsw gdsw[]; extern struct iotime gdstat[]; extern struct iobuf gdtab, gdutab[]; extern char gdourunflg; /* flag indicating disk over/under run */ #define GDPRI (PZERO + 3) /* * Internal commands */ #define CMD_READ ((char)0) #define CMD_WRITE ((char)1) #define CMD_FORMAT ((char)2) /* * Command information for WD1010. */ #define H_ERRFLAGS 0x01 #define H_PRECOMP 0x01 #define H_SECCNT 0x02 #define H_SECNUM 0x03 #define H_CYLLOW 0x04 #define H_CYLHIGH 0x05 #define H_SDH 0x06 #define H_COMMANDREG 0x07 #define H_STATUSREG 0x07 #define HDMASK 0x0007 /* 3 bits for head size */ #define W_RESTORE 0x0010 /* restore command */ #define W_SEEK 0x0070 /* seek command */ #define W_READ 0x0020 /* read sector command */ #define W_WRITE 0x0030 /* write sector command */ #define W_SCANID 0x0040 /* scan id command */ #define W_WR_FORMAT 0x0050 /* write format command */ #define W_RATEMSK 0x000F /* LS 4 bits of restore/seek command = rate */ #define W_MULT 0x0004 /* multi sector transfer flag for read/write */ #define W_INTEOC 0x0008 /* interrupt at end of command (read only) */ /* * Status information for WD1010. */ #define W_ERR 0x0001 /* logical or of bits in the error register */ #define W_CIP 0x0002 /* 1= command in progress */ #define W_DRQ 0x0008 /* 1= data request outstanding */ #define W_SEKCMP 0x0010 /* 1= seek complete */ #define W_WRFLT 0x0020 /* 1= write fault */ #define W_RDY 0x0040 /* 1= ready,frozen on error until status read */ #define W_BUSY 0x0080 /* 1= WD1010 is accessing the disk */ /* * Error status information for the WD1010. */ #define W_BBD 0x0080 /* bad block detected (not used) */ #define W_CRC 0x0040 /* 1= CRC error */ #define W_ID 0x0010 /* 1= id not found */ #define W_ABC 0x0004 /* 1= aborted command */ #define W_TK 0x0002 /* 1= restore command did not find track zero */ /* * Command information for the WD2797. */ #define F_COMMANDREG 0x00 #define F_STATUSREG 0x00 #define F_TRACKREG 0x01 #define F_SECTORREG 0x02 #define F_DATAREG 0x03 #define F_RESTORE 0x0000 /* restore command */ #define F_SEEK 0x0010 /* seek command */ #define F_STEP 0x0020 /* step command */ #define F_STEPIN 0x0040 /* step-in command */ #define F_STEPOUT 0x0060 /* step-out command */ #define F_READ 0x0080 /* read sector command */ #define F_WRITE 0x00a0 /* write sector command */ #define F_READADR 0x00c0 /* read address command */ #define F_READTRK 0x00e0 /* read track command */ #define F_WRITETRK 0x00f0 /* write track command */ #define F_FORCEINT 0x00d0 /* force interrupt command */ #define LOADHEAD 0x0008 /* 1= load head at beginning (restore,seek,step, step-in, step-out) */ #define VERIFYTRK 0x0004 /* 1= verify on destination track (restore,seek, step, step-in, step-out) */ #define STEPMSK 0x0003 /* stepping motor rate (restore,seek, step, step-in, step-out) */ #define F_UPDTRKRG 0x0010 /* 1= update track register (step, step-in, step-out) */ #define F_MULT 0x0010 /* 1= multiple record flag(read/write sector) */ #define F_LENGTH 0x0008 /* 1= lsb sector length in sector id field means 00=128 01=256 10=512 11=1024 (read/write sector) */ #define F_15MSDLY 0x0004 /* 1= 15MS delay(30 MS for 1MHZ) (read/write sector, read/write track and read address) */ #define F_UPDATESSO 0x0002 /* 1= update SSO to 1 (read/write sector, read/write track and read address) */ #define F_D_A_MRK 0x0001 /* data address mark (write sector) */ #define F_INT0 0x0001 /* force interrupt on not ready to ready transition. (force interrupt) */ #define F_INT1 0x0002 /* force interrupt on ready to not ready transition. (force interrupt) */ #define F_INT2 0x0004 /* force interrupt on index pulse. (force interrupt) */ #define F_INT3 0x0008 /* force interrupt immediately (requires reset). (force interrupt) */ #define F_INT_NO 0x0000 /* terminate with no interrupt.(force interrupt) /* * Status information for the WD2797. */ #define F_BUSY 0x0001 /* 1= command under execution */ #define F_DRQ 0x0002 /* 1= data request line */ #define F_LOSTDATA 0x0004 /* 1= CPU didn't respond to DRQ */ #define F_CRCERR 0x0008 /* 1= error in one or more id fields or an error in the data field */ #define F_RECNF 0x0010 /* 1= requested side,track, sector not found */ #define F_SEEKERR 0x0010 /* 1= seek error */ #define F_RECTYP 0x0020 /* 1= deleted data mark else data mark, on read. forced to zero on write. */ #define F_WRPROT 0x0040 /* 1= indicates a protected disk on write, not used on read */ #define F_NOTRDY 0x0080 /* 1= drive not ready */ #define F_TRK0 0x0004 /* 1= heads on track zero */ /* * down load file index. */ #define DLDSZ 256 struct dldent { short d_strt; /* block displacement from down load index */ short d_sz; /* # of blocks for this entry */ }; struct dldind { struct dldent dldent[DLDSZ]; }; #endif gdisk_h 0707070000020023541006660001460001440000010276060352172556400001400000023606sys/gdisk.m| Convergent Technologies - System V - May 1983 | "@(#)gdisk.m 1.5" #ifndef gdisk_m #define gdisk_m DISKS = 3 | the number of disks on MiniFrame GDRETRIES = 10 | the number of retries for an operation GAPSZ = 36 | size of gap1 and gap3 for format | defines for manipulating the minor node number DRVSHIFT = 4 | slice number occupies the ls 4 bits DRVMSK = 3 | drive number is 2 bits SLCMSK = 0xF | slice number is 4 bits MAXSLICE = 16 | maximum number of slices | volume home block on disk Vmagic = 0x00 | miniframe disk format code Vchksum =Vmagic+4 | adjustment so that the 32 bit sum starting | from magic for 512 bytes sums to -1 Vname =Vchksum+4 | printf name Vcyls =Vname+6 | the number of cylinders for this disk Vheads =Vcyls+2 | number of heads per cylinder Vpsectrk =Vheads+2 | number of physical sectors per track Vpseccyl =Vpsectrk+2 | number of physical sectors per cylinder Vflags =Vpseccyl+2 | floppy density and high tech drive flags Vstep =Vflags+1 | stepper motor rate to controller Vsectorsz =Vstep+1 | physical sector size Vpartab =Vsectorsz+2 | partition table Vresmap =Vpartab+64 | 8 reserved area special files (resmap) | start logical block # | length in logical blocks | (zero implies not present) | resmap consists of the following entries: | loader area | bad block table | dump area | down load image file | Bootable program, size determined by a.out format. nblocks=1. Vfpulled =Vresmap+48 | dismounted last time? VHBend =Vfpulled+1 | end of VHB | flags in gdswprt FPDENSITY =0x01 | 0=single 1=double density FPMIXDENS =0x02 | 0=all tracks are the same density | 1= cylinder zero is single density HITECH =0x04 | 0= reduced write current is valid, | 1= head select bit 3 is valid NEWPARTTAB =0x08 | 0= old style partition table, | 1= new style partition table VHBMAGIC = 0x55515651 | magic number in disk vhb | indexes into resmap INDLOADER = 0 INDBBTBL = 1 INDDUMP = 2 INDDOWNLOAD = 3 INDBOOT = 4 | displacements from the start of resmap DLOADER = 00 DBBTBL = 06 DDUMP = 12 DDOWNLOAD = 18 DBOOT = 24 | values for hwtype HD = 0 | Winchester SY = 1 | Syquest FD = 2 | floppy | values of flag bits in v_flags F_OPENED = 0x0001 | set when the first open is performed for | any slice on this disk, cleared when the | drive goes off line - indicates an | attempt has been made to read the vhb F_CT_FMT = 0x0002 | a valid vhb has been read for this disk, | this implies logical block=1024 bytes | and bad block handling F_READY = 0x0004 | ready from controller F_PULLED = 0x0008 | disk was removed without permission last | time, produces warning on open PHYS_ADDR = 0x0010 | alien disk. gdswprt supplied via ioctl. | the flag is set by ioctl for reading non | standard floppies. cleared by close. | slice 0 is the only valid one | in this mode the offset number is the | physical sector number <<10, whether sector | size is 1024, 512, 256 or 128. count is | still the number of bytes. F_MAYREMOVE = 0x0020 | The drive may be taken off line. WR_PROT = 0x0040 | set after each transfer. 1=write protected | disk. 0=not protected | bad block table | | On the disk the bad block table consists of an array of cells, one per | used alternate physical sector. | cyl is the cylinder containing the bad block badblk. | badblk is the physical sector address (within the cylinder cyl) | of a bad block. | altblk is the location of the alternate physical sector. It is | specified as the track number since the alternate sector is | always the last sector of a track. | nxtind is a chain of bad blocks on the same cylinder. The number is | the index into this array of bad block cells. A value of zero | means the end of the chain for this cylinder. The zero'th | entry is not used, other than to hold the count of used cells). | | | In memory a similar array will be held in the appropriate gdbtab | together with an array containing an entry for each cylinder which | holds the index into the above array of cells for the head for that | cylinder. | This means that a zero entry indicates no bad blocks on that cylinder. | | This mechanism implies a maximum of 255 bad blocks per disk which is | adequate for disks upto the 250 Mbyte range. | The bad block table is held as a chained set of logical blocks on | track zero. Each block can hold 256 entries. | The first bad block cell in each logical block of the bad block table | contains a chksum (in cyl and badblk) for the 1024 byte block, it is | a 32 bit sum which sums to -1. altblk contains the logical block | number of the next block in the bad block table, zero=end. | On a disk with an odd number of sectors per track, the last sector | is removed from the logical mapping and is used as an alternate area. | | Bad block handling is disabled on floppies. HDMAXBADBLK = 256 | only support maximum of 256 bad blocks HDMAXCYL = 1024 | support a maximum of 1024 cylinders SYMAXBADBLK = 40 | only support maximum of 40 bad blocks SYMAXCYL = 1024 | support a maximum of 1024 cylinders FPMAXBADBLK = 0 | no bad block support on floppies FPMAXCYL = 0 | no bad block support on floppies | displacements in a bad block cell on disk BBC_cyl = 0x00 | the cylinder of the bad block BBC_badblk = 0x02 | the physical sector address of the bad block | within the cylinder cyl BBC_altblk = 0x04 | track number of alternate BBC_nxtind = 0x06 | index into the cell array for next bad block | cell for this cylinder | values in d_flags F_ACTIVE = 0x0001 | driver operation in progress F_DMAON = 0x0002 | DMA operation in progress F_SEEKING = 0x0004 | seek in progress FDMTRON = 0x0008 | floppy motor is on + up to speed FDMTRSTRT = 0x0010 | the floppy motor has been started but | is not up to speed yet FDCHECKED = 0x0020 | set when floppy has been verified as still | being the same one that was on line | before motor turned off MAYGETFDINT = 0x0040 | on reseting the floppy the 2797 may | or may not choose to give an | interrupt, so be prepared to | discard it FDSPECIALRD = 0x0080 | a read of the vhb from dismount | caused a special read to be be | performed in the disk driver | while checking if the floppy had | been changed FDNEWQ = 0x0100 | new disk maybe so use recal to | establish head position FD_TIMEOUT = 0x0200 | a timeout occurred on a floppy | transfer, floppy not in or in | backwards - so terminate with error | values in ctl (supplied from assembly interrupt code) WD2797 = 1 WD1010 = 0 BIU = 2 | | Internal commands CMD_READ = 0 CMD_WRITE = 1 CMD_FORMAT = 2 | | Command information for WD1010. HDMASK = 0x0007 | 3 bits for head size W_RESTORE = 0x0010 | restore command W_SEEK = 0x0070 | seek command W_READ = 0x0020 | read sector command W_WRITE = 0x0030 | write sector command W_SCANID = 0x0040 | scan id command W_WR_FORMAT = 0x0050 | write format command W_RATEMSK = 0x000F | LS 4 bits of restore/seek command = rate W_MULT = 0x0004 | multi sector transfer flag for read/write W_INTEOC = 0x0008 | interrupt at end of command (read only) | | Status information for WD1010. W_ERR = 0x0001 | logical or of bits in the error register W_CIP = 0x0002 | 1= command in progress W_DRQ = 0x0008 | 1= data request outstanding W_SEKCMP = 0x0010 | 1= seek complete W_WRFLT = 0x0020 | 1= write fault W_RDY = 0x0040 | 1= ready,frozen on error until status read W_BUSY = 0x0080 | 1= WD1010 is accessing the disk | | Error status information for the WD1010. W_BBD = 0x0080 | bad block detected (not used) W_CRC = 0x0040 | 1= CRC error W_ID = 0x0010 | 1= id not found W_ABC = 0x0004 | 1= aborted command W_TK = 0x0002 | 1= restore command did not find track zero | | Command information for the WD2797. F_RESTORE = 0x0000 | restore command F_SEEK = 0x0010 | seek command F_STEP = 0x0020 | step command F_STEPIN = 0x0040 | step-in command F_STEPOUT = 0x0060 | step-out command F_READ = 0x0080 | read sector command F_WRITE = 0x00a0 | write sector command F_READADR = 0x00c0 | read address command F_READTRK = 0x00e0 | read track command F_WRITETRK = 0x00f0 | write track command F_FORCEINT = 0x00d0 | force interrupt command LOADHEAD = 0x0008 | 1= load head at beginning (restore,seek,step, | step-in, step-out) VERIFYTRK = 0x0004 | 1= verify on destination track (restore,seek, | step, step-in, step-out) STEPMSK = 0x0003 | stepping motor rate (restore,seek, | step, step-in, step-out) F_UPDTRKRG = 0x0010 | 1= update track register (step, step-in, | step-out) F_MULT = 0x0010 | 1= multiple record flag(read/write sector) F_LENGTH = 0x0008 | 1= lsb sector length in sector id field means | 00=128 01=256 10=512 11=1024 | (read/write sector) F_15MSDLY = 0x0004 | 1= 15MS delay(30 MS for 1MHZ) (read/write | sector, read/write track and read address) F_UPDATESSO = 0x0002 | 1= update SSO to 1 (read/write | sector, read/write track and read address) F_D_A_MRK = 0x0001 | data address mark (write sector) F_INT0 = 0x0001 | force interrupt on not ready to ready | transition. (force interrupt) F_INT1 = 0x0002 | force interrupt on ready to not ready | transition. (force interrupt) F_INT2 = 0x0004 | force interrupt on index pulse. | (force interrupt) F_INT3 = 0x0008 | force interrupt immediately (requires reset). | (force interrupt) F_INT_NO = 0x0000 | terminate with no interrupt.(force interrupt) | | Status information for the WD2797. F_BUSY = 0x0001 | 1= command under execution F_DRQ = 0x0002 | 1= data request line F_LOSTDATA = 0x0004 | 1= CPU didn't respond to DRQ F_CRCERR = 0x0008 | 1= error in one or more id fields or an error | in the data field F_RECNF = 0x0010 | 1= requested side,trac, sector not found F_RECTYP = 0x0020 | 1= deleted data mark else data mark, on read. | forced to zero on write. F_WRPROT = 0x0040 | 1= indicates a protected disk on write, | not used on read F_NOTRDY = 0x0080 | 1= drive not ready F_TRK0 = 0x0004 | 1= heads on track zero #endif gdisk_m 0707070000020023551006660001460001440000010307140352172556500001400000011472sys/gtape.h/* Convergent Technologies - System V - Feb 1985 */ /* "@(#)gtape.h 0.0" */ #define TP_MAXSTAT 6 /* number of stat bytes return */ /* Tape controller interface */ struct tci { unsigned short *tp_hcreg, /* tape handshake,control reg */ *tp_csreg, /* tape command status reg */ *tp_dmacnt, /* tape dma count reg */ *tp_chsmh, /* tape controller id-chksum MSB */ *tp_chsml, /* LSB */ *tp_numh, /* id-number MSB */ *tp_numl; /* LSB */ unsigned char *tp_dmaloaddr, /* tape dma address reg */ *tp_dmahiaddr; }; /* Tape controller, driver interface */ struct tcdi { char xop; /* command opcode */ int dma_addr; /* dma address */ int dma_cnt; /* dma count */ int dma_dir; /* dma direction */ char retry; /* number of retry */ char maxretry; /* num of retry allowed */ char cntchk; /* 1-> check dma count */ char tape_excptn; /* tape exception flag */ char tapeint; /* tape interrupt flag */ unsigned short tp_hccsreg_save; /* memory image of tape controllers */ char tp_stat[ TP_MAXSTAT ]; /* tape status bytes */ struct tci tp_regs; /* tape controller reg */ }; /* Slot offset addresses */ #define SLOT0 0xc00000 #define SLOT1 0xc40000 #define SLOT2 0xc80000 /* All of the address defined below are base addresses they must be added to the offset address which depends on slot # */ /* DMA count reg */ #define TP_DMACNT_ADDR 0x3ffe /* DMA address reg */ #define TP_DMALO_ADDR 0x20000 #define TP_DMAHI_ADDR 0x24000 /* ID register A read from any of these reg will clear the tape interrupt. A write to any of these reg will reset the tape drive controller. (R/W) */ #define TP_CHSMH_ADDR 0x3fffe /* check sum hi byte */ #define TP_CHSML_ADDR 0x3fffc /* lo */ #define TP_NUMH_ADDR 0x3fffa /* ID number hi byte */ #define TP_NUML_ADDR 0x3fff8 /* lo */ #define TP_IDSUM 0xefff /* ID checksum value */ #define TP_IDNUM 0x1001 /* ID number value */ /* Tape control register and mask words. */ #define TP_CS_ADDR 0x7ffe /* tape command,status reg */ #define TP_HC_ADDR 0xbffe /* tape hand shake,control */ /* READ mode */ /* Either tape ready or exception can generate an interrupt, to reset interrupt read ID register. D0-7 contains the status byte when issue a read status */ #define TP_INTRQ 0x100 /* tape interrupt request */ #define TP_EXCPTN 0x200 /* tape exception */ #define TP_NRDY 0x400 /* tape not ready */ /* WRITE All 16 bits of the register must be written at the same time. */ /* Control signals */ #define TP_ONLINE 0x8000 /* indicates a transfer is started. Must stayed active during transfer. */ #define TP_REQUEST 0x4000 /* */ #define TP_DMA_ENABLE 0x2000 /* set to start DMA, after set up */ #define TP_DMA_READ 0x1000 /* DMA from mem to tape */ #define TP_DMA_WRITE ~TP_DMA_READ #define TP_INT_ENABLE 0x800 /* enable tape drive interrupt */ #define TP_DRIV_NRESET 0x200 /* normal operation */ #define TP_BRD_NRESET 0x100 /* normal operation */ /* Tape drive commands */ #define TP_SELECT 0x00 /* Select drive, D0-3 = drive # */ #define TP_POS_BEGIN 0x21 /* Position to begin of tape */ #define TP_POS_ERASE 0x22 /* erase the tape */ #define TP_POS_INIT 0x24 /* initialize tape */ #define TP_WR_DATA 0x40 /* write data */ #define TP_WR_FLMK 0x60 /* write file mark */ #define TP_WR_MULT_FLMK 0x70 /* write multiple filemarks, D0-4 contains the number */ #define TP_RD_DATA 0x80 /* read data */ #define TP_RD_FDATA 0x81 /* step forward to next data block*/ #define TP_RD_RDATA 0x89 /* reverse */ #define TP_RD_FLMK 0xa0 /* read file mark */ #define TP_RD_EOD 0xa3 /* seek end of data */ #define TP_RD_RFLMK 0xa8 /* seek to previous filemark */ #define TP_RD_MULT_FLMK 0xb0 /* read multiple filemark, D0-4 contains the number */ #define TP_RD_STAT 0xc0 /* read status, consists of 6 bytes , use when a tape exception occurs */ /* Meaning of the 6 status bytes */ #define EXC_BIT 0x80 /* set if other bit is set in this byte */ /* BYTE 0 */ #define CART_NOTIN_B0 0x40 /* Cartridge not in */ #define DRIVE_NOTON_B0 0x20 /* drive not on line */ #define WRITE_PROT_B0 0x10 /* write protect on cartridge */ #define END_MEDIA_B0 0x8 /* end of media */ #define RW_ERR_B0 0x4 /* error after 16 retries */ #define BIE_NOTLOC_B0 0x2 /* error occurs at earlier transfer */ #define FLMK_DET_B0 0x1 /* file mark detected */ /* BYTE 1 */ #define ILL_CMD_B1 0x40 /* illegal command */ #define NODATA_DET_B1 0x20 /* no data detected */ #define RETRIES_B1 0x10 /* 8 or more retries occur */ #define BEG_MEDIA_B1 0x8 /* begin of media */ #define RESET_ACK_B1 0x1 /* tape drive got reset */ /* BYTE 2( MSB ),3( LSB ) contains tape data errors counter */ /* BYTE 4( MSB ),5( LSB ) contains buffer underrun counter */ 0707070000020023561006660001460001440000010307520352172556600001700000016341sys/hardware.h/* Convergent Technologies - System V - Jun 1983 */ /* "@(#)hardware.h 1.2" */ #ifndef hardware_h #define hardware_h #include #include /* 68010 status bits */ #define S_TRACE 0x8000 #define S_SUPV 0x2000 #define S_INTMASK 0x700 #define HIGH (S_SUPV|S_INTMASK) /* high priority supervisor mode (spl 7) */ #define LOW S_SUPV /* low priority, supervisor mode (spl 0) */ /* * WARNING: All these definitions are set up on the assumption * that they are operating on 16 bit quantities read/written from/to * the even address specified as the register address. * It is further assumed that all reads/writes of hardware registers * will be performed as 16 bit transfers to the even byte address. * It is believed that other schemes may work, but this is the way * these definitions are set up. */ /* General Control Register - GCR */ /* Write only. Uses address bits 16-18 of I/O address E4X0000 */ #define SYSERR_GCR_ADDR ((unsigned short *)0xE40000) /* EE+ */ #define SYSERR_ENABLE 0x8000 /* EE 1=enable NMI/BERR */ #define SYSERR_DISABLE 0x0000 /* EE 0=disable NMI/BERR */ #define PE_INT_GCR_ADDR ((unsigned short *)0xE41000) /* PIE+ */ #define PE_INT_ENABLE 0x8000 /* PIE 1=enable PE's */ #define PE_INT_DISABLE 0x0000 /* PIE 0=disable PE's */ #define PE_FRC_GCR_ADDR ((unsigned short *)0xE42000) /* BP+ */ #define PE_FRC_ENABLE 0x8000 /* BP 1=force bad parity */ #define PE_FRC_DISABLE 0x0000 /* BP 0=generate good parity*/ #define ROM_GCR_ADDR ((unsigned short *)0xE43000) /* ROMLMAP- */ #define ROM_DISABLE 0x8000 /* ROMLMAP 1=ROM disabled at low addr*/ #define ROM_ENABLE 0x0000 /* ROMLMAP 0=ROM mapped at low addr */ #define L1MD_GCR_ADDR ((unsigned short *)0xE44000) /* L1MD- */ #define L1MD_DISCONNECT 0x8000 /*L1MD 1=modem disconnected from line 1*/ #define L1MD_CONNECT 0x0000 /*L1MD 0=modem connected to line 1 */ #define L2MD_GCR_ADDR ((unsigned short *)0xE45000) /* L2MD- */ #define L2MD_DISCONNECT 0x8000 /*L2MD 1=modem disconnected from line 2*/ #define L2MD_CONNECT 0x0000 /*L2MD 0=modem connected to line 2 */ #define DNCT_GCR_ADDR ((unsigned short *)0xE46000) /* D/NCD1- */ #define DNLN1_CONNECT 0x0000 /* D/NCD1 0 => dialer connected to line 1 */ #define DNLN2_CONNECT 0x8000 /* D/NCD1 1 => dialer connected to line 2 */ /* Miscellaneous Control Register - MCR (4A0,000) (w) */ /* Write only. Uses most significant byte of 16 bit word */ #define MCR_ADDR ((unsigned short *)0x4A0000) #define CLRSINT 0x8000 /* CLRSINT- toggle from 1 to 0 and back to 1 to dismiss level 6, 60 hertz interrupt */ #define DMA_READ 0x4000 /* DMAR/W- 0 = disk DMA write 1 = disk DMA read */ #define LPSTB 0x2000 /* LPSTB+ toggle from 0 to 1 and back to 0 to strobe data to line printer */ #define MCKSEL 0x1000 /* MCKSEL- 0 = modem RX & TX selected 1 = programmable Baud Rate generator is selected */ #define LED3 0x800 /* LED3- 0 = on, 1 = off */ #define LED2 0x400 /* LED2- 0 = on, 1 = off */ #define LED1 0x200 /* LED1- 0 = on, 1 = off */ #define LED0 0x100 /* LED0- 0 = on, 1 = off */ /* General Status Register - GSR (410,000) (r) */ /* Read only. Uses most significant byte of 16 bit word */ #define GSR_ADDR ((unsigned short *)0x410000) #define R_W_CYCLE 0x4000 /* R/W- 1=read cycle */ #define NPC_CYCLE 0x2000 /* NPC+ 1=DMA 0=processor */ #define PAGE_FAULT 0x1000 /* PF- 0=page fault */ #define PIE_STATE 0x400 /* PIE+ 1=PE's are enabled */ #define USR_IO_FAULT 0x100 /* UIE- 0=user accessed I/O */ /* Clear Status Register - CSR */ /* Read/Write. Uses most significant byte of 16 bit word */ /* Any access to this register clears the GSR and BSR0, BSR1 */ #define CSR_ADDR ((unsigned short *)0x4C0000) /* Bus Status Register 0 - BSR0 (430,000) (r) */ /* Read only. Uses 16 bit word */ /* Latched at the same time as the GSR and BSR1, also cleared by CSR */ #define BSR0_ADDR ((unsigned short *)0x430000) #define MMU_ERR 0x8000 /* 0=mmu error: processor or DMA page fault user writing to write protected page user accessing kernel space */ #define NOT_DGNT 0x4000 /* DKBG- 0 = disk DMA cycle */ #define NOT_XGT0 0x2000 /* EXP0BG- 0 = EXP0 DMA cycle */ #define NOT_XGT1 0x1000 /* EXP1BG- 0 = EXP1 DMA cycle */ #define NOT_XGT2 0x800 /* EXP2BG- 0 = EXP2 DMA cycle */ #define NOT_XGT3 0x400 /* EXP3BG- 0 = EXP3 DMA cycle */ #define UPPER_DATA_STROBE 0x200 /* UDS- 0 = Upper Data Strobe from 68010 */ #define LOWER_DATA_STROBE 0x100 /* LDS- 0 = Lower Data Strobe from 68010 */ #define PA23 0x80 /* PA23 Processor Address 23 */ #define PA22 0x40 /* PA22 Processor Address 22 */ #define LA21 0x20 /* A21 Logical Address 21 */ #define LA20 0x10 /* A20 Logical Address 20 */ #define LA19 0x8 /* A19 Logical Address 19 */ #define LA18 0x4 /* A18 Logical Address 18 */ #define LA17 0x2 /* A17 Logical Address 17 */ #define LA16 0x1 /* A16 Logical Address 16 */ #define A23_A16_MASK 0xff /* mask of A23 to A16 */ #define A21_A16_MASK 0x3f /* mask of A21 to A16 */ /* Bus Status Register 1 - BSR1 (440,000) (r) */ /* Read only. Uses all of 16 bit word */ /* Latched at the same time as the GSR and BSR0, also cleared by CSR */ #define BSR1_ADDR ((unsigned short *)0x440000) #define A15_A00_MASK 0xffff /* mask of A15 to A0 */ /* Off-board addressing registers */ #define MY_SLOT ((slot_t *)0) /* lie about it */ /* Hardware Register Definitions */ #define KSTACK 0x70900 /* kernel stack address */ #define PG_USER 0x70 /* virtual page no of user table */ /* mcrsav must be written to whenever the real MCR is written to. */ extern ushort mcrsav; /* defines to manipulate the LED's */ /* where x is a led expression with values from 0x0 to 0x15 */ #define led_init() * MCR_ADDR = mcrsav &= ~LED2 #define led_on(x) * MCR_ADDR = mcrsav &= (ushort)(~(x << 8)) #define led_off(x) * MCR_ADDR = mcrsav |= (ushort)(x << 8) #define led_toggle(x) * MCR_ADDR = mcrsav ^= (ushort)(x << 8) /* address in vector table of a pointer to the CDT. */ #define pCDT 0x3F8 /* software leaves pointer in penultimate int vector */ /* CDT signature long word */ #define SIG1 0x45504A52 /* Format - to be used by crash in analyzing dump * * 0000 - 003F: machine registers * 0040 - 0041: GSR * 0042 set to zero * 0043 - 0045: BSR * 0046 - 0845 memory map registers * 0846 - 08C5 CDT */ /* Displacements from the start of a crash dump plus SAVEAREA. */ #define SAVEAREA 0x0000 #define SVREGS 0x0000 #define SVGSR 0x0040 #define SVBSR 0x0042 #define SVMAP 0x0046 #define SVCDT 0x0846 /* Format of the CDT (128 bytes) * signature 4 bytes * lbolt 4 bytes * time of day 4 bytes * reason 1 byte * (0 = panic, 1 = reset, 2 = poweron) * boot media 1 byte * (2 = fd, 1 = syq, 0 = hd) * panic string 114 bytes #define CdtSig 0x00 #define CdtLbolt 0x04 #define CdtTOD 0x08 #define CdtReason 0x0C #define CdtMedia 0x0D #define CdtPanic 0x0E */ #define SZPANIC 114 #define SZCDT 128 struct CDT { unsigned int CdtSig; time_t lbolt; time_t time; char CdtReason; char CdtMedia; char CdtPanic[SZPANIC]; }; /* Reasons */ #define PANIC 0 #define RESET 1 #define POWERON 2 /* Address the loader is loaded at */ #define LOADADDR 0x70000 #define BOOTCDT LOADADDR-SZCDT #endif hardware_h 0707070000020023601006660001460001440000010307660352172556700001700000020523sys/hardware.m/* # Convergent Technologies - System V - Jul 1983 # "@(&)hardware.m 1.1" */ #ifndef hardware_m #define hardware_m /* #S4 HARDWARE DEFINITION - processor # 68010 ASSEMBLY INCLUDE FILE # (see also iohw.m for peripherals) # # FILE NAME: hardware.m # #Memory mapping hardware #from sys/param.h */ set VUSER_START,0x80000 /*# start address of user process*/ set VUSER_END,0x380000 /*# end address of user process*/ set KVMEM_VPAGES,128 set PG_BASE,0x400000 /*#address of page table*/ set USER_MAP,PG_BASE + 256 /*# address of user part of page table*/ set MAP_TOP,PG_BASE+2048-256/*# address past end of memory map*/ set UPTE,0x4000E0 /*# address of UPAGE pte*/ /* #Page table entry. #WE bit 15 =1 user can write page, =0 user can read page #USE bits 14-13 value 0=not present, 1=present, not accessed # value 2=accessed not written, 3=written to #PAGEADDR bits 8-0 set PHYSADDR,(PAGEADDR*4096) + byte within page #STATES: #page not in memory: WE set as needed and set rest,0 #page in memory: WE, PAGEADDR set as needed and USE non zero */ set PROT_MASK,0x8000 /*#mask for write bit*/ set USE_MASK,0x6000 /*#mask for usage bits*/ set PG_MASK,0x3ff /*#page address mask*/ set PG_WRITE,0x8000 /*#user write enable*/ set NO_PAGE,0x0 /*#to initialize pte's*/ set PG_IN,0x7fff /*#AND mask*/ set PG_PRESENT,0x2000 /*#pte&USE_MASK page just in */ set PG_NOT_DIRTY,0x4000 /*#pte&set USE_MASK,accessed */ set PAGE_DIRTY,0x6000 /*#pte&set USE_MASK,written to*/ set P_ACCESS_CHECK,0x6000 /*#AND mask*/ set NO_ACCESS,0 set TOTAL_PTES,1024 set TOTAL_PAGES,1024 set PAGES_IN_PROC,1024-KVMEM_VPAGES set BYTES_PER_PAGE,0x1000 set PAGESHIFT,12 /*#gets page number from addr*/ /* #4 Mbyte logical address space */ set MAX_MEM,0x400000 /* #4 Mbyte physical address space */ set MAX_PHYS_MEM,0x400000 set PAGES_PER_SEG,16 /*#needed to correspond to megaframe rounding*/ /* #some defines that lie about some things */ set SEGS_PER_PROC,64 /*#miniframe doesn't have segments*/ set SEGSHIFT,4 /*#seg to page*/ set PG_KR,0 /*#the kernel can read anything*/ set PG_KW,0 /*#the kernel can write to anything*/ /* #Page table entry masks */ set PG_PROT,0x00008000 set PG_STAT,0x00006000 set PG_ACC,0x00004000 set PG_V,0x00002000 set PG_M,0x00006000 set PG_FOD,0x00001000 set PG_VREADM,0x00000400 set PG_PFNUM,0x000003ff set USIZE,1 /*#number of pages in usrtbl (upage)*/ set USRSIZE,4096 /*#size of usrtbl (upage) in bytes*/ set SEGSIZE,0x10000 /*#size of a segment*/ /* #processor (mostly) registers #from sys/hardware.h #WARNING: All these definitions are set up on the assumption #that they are operating on 16 bit quantities read/written from/to #the even address specified as the register address. #It is further assumed that all reads/writes of hardware registers #will be performed as 16 bit transfers to the even byte address. #It is believed that other schemes may work, but this is the way #these definitions are set up. #68010 status bits */ set S_TRACE,0x8000 set S_SUPV,0x2000 set S_INTMASK,0x700 set HIGH,S_SUPV + S_INTMASK /*#high priority supervisor mode (spl 7)*/ set LOW,S_SUPV /*#low priority, supervisor mode (spl 0)*/ /* #General Control Register - GCR #Write only. Uses address bits 16-18 of I/O address E4X000 */ set SYSERR_GCR_ADDR,0xE40000 /*#EE+*/ set SYSERR_ENABLE,0x8000 /*#EE 1=enable NMI/BERR*/ set SYSERR_DISABLE,0x0000 /*#EE 0=enable NMI/BERR*/ set PE_INT_GCR_ADDR,0xE41000 /*#PIE+*/ set PE_INT_ENABLE,0x8000 /*#PIE 1=enable PE's*/ set PE_INT_DISABLE,0x0000 /*#PIE 1=disable PE's*/ set PE_FRC_GCR_ADDR,0xE42000 /*#BP+*/ set PE_FRC_ENABLE,0x8000 /*#BP 1=force bad parity*/ set PE_FRC_DISABLE,0x0000 /*#BP 1=force bad parity*/ set ROM_GCR_ADDR,0xE43000 /*#ROMLMAP-*/ set ROM_DISABLE,0x8000 /*#ROMLMAP 1=ROM disabled at low addr*/ set ROM_ENABLE,0x0000 /*#ROMLMAP 0=ROM mapped at low addr*/ set L1MD_GCR_ADDR,0xE44000 /*#L1MD-*/ set L1MD_DISCONNECT,0x8000 /*#L1MD 1 = modem disconnected from line1*/ set LMD_CONNECT,0x0000 /*#L1MD 0 = modem connected to line 1*/ set L2MD_GCR_ADDR,0xE45000 /*#L2MD-*/ set L2MD_DISCONNECT,0x8000 /*#L2MD 1 = modem disconnected from line2*/ set L2MD_CONNECT,0x0000 /*#L2MD 0 = modem connected to line 2*/ set DNCT1_GCR_ADDR,0xE46000 /*#D/NCD1-*/ set DNCT1_DISCONNECT,0x8000 /*#D/NCD1 1 = dial/network disconnected */ /*# from line 1*/ set DNCT1_CONNECT,0x0000 /*#D/NCD1 0 = dial/network connected */ /*# to line 1*/ /* # Miscellaneous Control Register - MCR (4A0,000) (w) # Write only. Uses most significant byte of 16 bit word */ set MCR_ADDR,0x4a0000 set CLRSINT,0x8000 /*#CLRSINT- toggle from 1 to 0 and back to # 1 to dismiss level 6, 60 hertz # interrupt*/ set DMA_READ,0x4000 /*#DMAR/W- 0 = disk DMA write*/ /*# 1 = disk DMA read*/ set LPSTB,0x2000 /*#LPSTB+ toggle from 0 to 1 and back*/ /*# to 0 to strobe data to line printer*/ set MCKSEL,0x1000 /*#MCKSEL- 0 = modem RX & TX selected*/ /*# 1 = programmable Baud Rate*/ /*# generator is selected*/ set LED3,0x800 /*#LED3- 0 = on, 1 = off*/ set LED2,0x400 /*#LED2- 0 = on, 1 = off*/ set LED1,0x200 /*#LED1- 0 = on, 1 = off*/ set LED0,0x100 /*#LED0- 0 = on, 1 = off*/ /* #General Status Register - GSR (410,000) (r) #Read only. Uses most significant byte of 16 bit word */ set GSR_ADDR,0x410000 set R_W_CYCLE,0x4000 /*#R/W- 1=read cycle*/ set NPC_CYCLE,0x2000 /*#NPC+ 1=DMA 0=processor*/ set PAGE_FAULT,0x1000 /*#PF- 0=page fault*/ set PIE_STATE,0x400 /*#PIE+ 1=PE's are enabled*/ set USR_IO_FAULT,0x100 /*#UIE- 0=user accessed I/O*/ /* #Clear Status Register - CSR #Read/Write. Uses most significant byte of 16 bit word #Any access to this register clears the GSR and BSR0, BSR1 */ set CSR_ADDR,0x4C0000 /* #Bus Status Register 0 - BSR0 (430,000) (r) #Read only. Uses 16 bit word #Latched at the same time as the GSR and BSR1, also cleared by CSR */ set BSR0_ADDR,0x430000 set MMU_ERR,0x8000 /*# 0=mmu error: # processor or DMA page fault # user writing to write protected page # user accessing kernel space*/ set NOT_DGNT,0x4000 /*#DKBG- 0 = disk DMA cycle*/ set NOT_XGT0,0x2000 /*#EXP0BG- 0 = EXP0 DMA cycle*/ set NOT_XGT1,0x1000 /*#EXP1BG- 0 = EXP1 DMA cycle*/ set NOT_XGT2,0x800 /*#EXP2BG- 0 = EXP2 DMA cycle*/ set NOT_XGT3,0x400 /*#EXP3BG- 0 = EXP3 DMA cycle*/ set UPPER_DATA_STROBE,0x200 /*#UDS- 0 = Upper Data Strobe from 68010*/ set LOWER_DATA_STROBE,0x100 /*#LDS- 0 = Lower Data Strobe from 68010*/ set PA23,0x80 /*#PA23 Processor Address 23*/ set PA22,0x40 /*#PA22 Processor Address 22*/ set LA21,0x20 /*#A21 Logical Address 21*/ set LA20,0x10 /*#A20 Logical Address 20*/ set LA19,0x8 /*#A19 Logical Address 19*/ set LA18,0x4 /*#A18 Logical Address 18*/ set LA17,0x2 /*#A17 Logical Address 17*/ set LA16,0x1 /*#A16 Logical Address 16*/ set A23_A16_MASK,0xff /*#mask of A23 to A16*/ set A21_A16_MASK,0x3f /*#mask of A21 to A16*/ /* #Bus Status Register 1 - BSR1 #Read only. Uses all of 16 bit word #Latched at the same time as the GSR and BSR0, also cleared by CSR */ set BSR1_ADDR,0x440000 set A15_A00_MASK,0xffff /*#mask of A15 to A0*/ /* # Hardware Register Definitions */ set KSTACK,0x70900 /*#kernel stack address*/ set PG_USER,0x70 /*#virtual page no of user table*/ /* # mcrsav must be written to whenever the real MCR is written to. # global mcrsav # address in vector table of a pointer to the CDT. */ set pCDT,0x3F8 /*#software leaves pointer in penultimate int vector*/ /* # CDT signature long word */ set SIG1,0x45504A52 /* # Format - to be used by crash in analyzing dump # # 0000 - 003F: machine registers # 0040 - 0041: GSR # 0042 set to zero # 0043 - 0045: BSR # 0046 - 0845 memory map registers # 0846 - 08C5 CDT # Displacements from the start of a crash dump plus SAVEAREA. */ set SAVEAREA,0x0000 set SVREGS,0x0000 set SVGSR,0x0040 set SVBSR,0x0042 set SVMAP,0x0046 set SVCDT,0x0846 /* # Format of the CDT (128 bytes) # signature 4 bytes # lbolt 4 bytes # time of day 4 bytes # reason 1 byte # (0 = panic, 1 = reset, 2 = poweron) # boot media 1 byte # (2 = fd, 1 = syq, 0 = hd) # panic string 114 bytes */ set CdtSig,0x00 set CdtLbolt,0x04 set CdtTOD,0x08 set CdtReason,0x0C set CdtMedia,0x0D set CdtPanic,0x0E set SZPANIC,114 set SZCDT,128 /* # Disk types. */ set HD,0 #Winchester set SY,1 #syquest set FD,2 #Floppy /* # Reasons */ set PANIC,0 set RESET,1 set POWERON,2 /* # copy of VHBMAGIC from gdisk.h */ set VHBMAGIC,0x55515651 /* # Address the loader is loaded at */ set LOADADDR,0x70000 set BOOTCDT,LOADADDR-SZCDT #endif hardware_m 0707070000020023611006660001460001440000010312640352172557000001100000016076sys/hw.h/* Convergent Technologies - System V - Jun 1983 */ /* "@(#)hardware.h 1.2" */ #ifndef hardware_h #define hardware_h #include #include /* 68010 status bits */ #define S_TRACE 0x8000 #define S_SUPV 0x2000 #define S_INTMASK 0x700 #define HIGH (S_SUPV|S_INTMASK) /* high priority supervisor mode (spl 7) */ #define LOW S_SUPV /* low priority, supervisor mode (spl 0) */ /* * WARNING: All these definitions are set up on the assumption * that they are operating on 16 bit quantities read/written from/to * the even address specified as the register address. * It is further assumed that all reads/writes of hardware registers * will be performed as 16 bit transfers to the even byte address. * It is believed that other schemes may work, but this is the way * these definitions are set up. */ /* General Control Register - GCR */ /* Write only. Uses address bits 16-18 of I/O address E4X0000 */ #define SYSERR_GCR_ADDR ((unsigned short *)0xE40000) /* EE+ */ #define SYSERR_ENABLE 0x8000 /* EE 1=enable NMI/BERR */ #define SYSERR_DISABLE 0x0000 /* EE 0=disable NMI/BERR */ #define PE_INT_GCR_ADDR ((unsigned short *)0xE41000) /* PIE+ */ #define PE_INT_ENABLE 0x8000 /* PIE 1=enable PE's */ #define PE_INT_DISABLE 0x0000 /* PIE 0=disable PE's */ #define PE_FORCE_GCR_ADDR ((unsigned short *)0xE42000) /* BP+ */ #define PE_FORCE_ENABLE 0x8000 /* BP 1=force bad parity */ #define PE_FORCE_DISABLE 0x0000 /* BP 0=generate good parity*/ #define ROM_GCR_ADDR ((unsigned short *)0xE43000) /* ROMLMAP- */ #define ROM_DISABLE 0x8000 /* ROMLMAP 1=ROM disabled at low addr*/ #define ROM_ENABLE 0x0000 /* ROMLMAP 0=ROM mapped at low addr */ #define L1MD_GCR_ADDR ((unsigned short *)0xE44000) /* L1MD- */ #define L1MD_DISCONNECT 0x8000 /*L1MD 1=modem disconnected from line 1*/ #define L1MD_CONNECT 0x0000 /*L1MD 0=modem connected to line 1 */ #define L2MD_GCR_ADDR ((unsigned short *)0xE45000) /* L2MD- */ #define L2MD_DISCONNECT 0x8000 /*L2MD 1=modem disconnected from line 2*/ #define L2MD_CONNECT 0x0000 /*L2MD 0=modem connected to line 2 */ #define DNCT1_GCR_ADDR ((unsigned short *)0xE46000) /* D/NCD1- */ #define DNCT1_DISCONNECT 0x8000 /* D/NCD1 1=dial/network disconnected from line 1 */ #define DNCT1_CONNECT 0x0000 /* D/NCD1 0=dial/network connected to line 1 */ #define LED0ON ((unsigned short *)0x4A000C) #define LED0OFF ((unsigned short *)0x4A000E) #define LED1ON ((unsigned short *)0x4A0010) #define LED1OFF ((unsigned short *)0x4A0012) #define LED2ON ((unsigned short *)0x4A0014) #define LED2OFF ((unsigned short *)0x4A0016) #define LED3ON ((unsigned short *)0x4A0018) #define LED3OFF ((unsigned short *)0x4A001A) #define LED4ON ((unsigned short *)0x4A001C) #define LED4OFF ((unsigned short *)0x4A001E) #define LED0 1 #define LED1 2 #define LED2 4 #define LED3 8 #define LED4 0x10 /* General Status Register - GSR */ /* Read only. Uses most significant byte of 16 bit word */ #define GSR_ADDR ((unsigned short *)0x410000) #define LOG_WRITE 0x4000 /* LWT 1=read cycle */ #define BUS_GRANT 0x2000 /* BGNT 1=DMA 0=processor */ #define PAGE_FAULT 0x1000 /* PGF 0=page fault */ #define PIE_STATE 0x400 /* PIE 0=PE's are disabled */ #define PARITY_ERR 0x200 /* PE 0=parity err occurred */ #define USR_IO_FAULT 0x100 /* UIE 0=user accessed I/O */ /* Clear Status Register - CSR */ /* Read/Write. Uses most significant byte of 16 bit word */ /* Any access to this register clears the GSR and BSR0, BSR1 */ #define CSR_ADDR ((unsigned short *)0xE40000) /* Bus Status Register 0 - BSR0 */ /* Read only. Uses least significant byte of 16 bit word */ /* Latched at the same time as the GSR, also cleared by CSR */ #define BSR0_ADDR ((unsigned short *)0x430000) #define MMU_ERR 0x8000 /* 0=mmu error either write violation or page fault */ #define NOT_DGNT 0x4000 /* DGNT 0=bus grant to disk */ #define NOT_XGNT 0x2000 /* XGNT 0=bus grant to expansion 0 */ #define NOT_XGT0 0x2000 /* XGT0 0=bus grant to expansion 0 */ #define NOT_XGT1 0x1000 /* XGT1 0=bus grant to expansion 1 */ #define NOT_XGT2 0x800 /* XGT2 0=bus grant to expansion 2 */ #define NOT_XGT3 0x400 /* XGT3 0=bus grant to expansion 3 */ #define UPPER_DATA_STROBE 0x200 /* Upper Data Strobe from 68010 */ #define LOWER_DATA_STROBE 0x100 /* Lower Data Strobe from 68010 */ #define PA23 0x80 /* Processor Address 23 */ #define PA22 0x40 /* Processor Address 22 */ #define LA21 0x20 /* Logical Address 21 */ #define LA20 0x10 /* Logical Address 20 */ #define LA19 0x8 /* Logical Address 19 */ #define LA18 0x4 /* Logical Address 18 */ #define LA17 0x2 /* Logical Address 17 */ #define LA16 0x1 /* Logical Address 16 */ #define A23_A16_MASK 0xff /* mask of A23 to A16 */ #define A21_A16_MASK 0x3f /* mask of A21 to A16 */ /* Bus Status Register 1 - BSR1 */ /* Read only. Uses all of 16 bit word */ /* Latched at the same time as the GSR, also cleared by CSR */ #define BSR1_ADDR ((unsigned short *)0x440000) #define A15_A00_MASK 0xffff /* mask of A15 to A0 */ /* Off-board addressing registers */ #define MY_SLOT ((slot_t *)0) /* lie about it */ /* Hardware Register Definitions */ #define INIT_GCR ROM_DISABLE /* inital value of GCR */ #define KSTACK 0x70900 /* kernel stack address */ #define PG_USER 0x70 /* virtual page no of user table */ /* ourgcr must be written to whenever the real GCR is written to. */ #ifdef KERNEL extern short ourgcr; extern char ledsav; #endif /* defines to manipulate the LED's */ #define led_init() setleds(ledsav=LED2) #define led_on(x) setleds(ledsav &= (char)(~(x))) #define led_off(x) setleds(ledsav |= (char)(x)) #define led_toggle(x) setleds(ledsav ^= (char)(x)) /* address in vector table of a pointer to the CDT. */ #define pCDT 0x3F8 /* software leaves pointer in penultimate int vector */ /* CDT signature long word */ #define SIG1 0x45504A52 /* Format - to be used by crash in analyzing dump * * 0000 - 003F: machine registers * 0040 - 0041: GSR * 0042 set to zero * 0043 - 0045: BSR * 0046 - 0845 memory map registers * 0846 - 08C5 CDT */ /* Displacements from the start of a crash dump plus SAVEAREA. */ #define SAVEAREA 0x0000 #define SVREGS 0x0000 #define SVGSR 0x0040 #define SVBSR 0x0042 #define SVMAP 0x0046 #define SVCDT 0x0846 /* Format of the CDT (128 bytes) * signature 4 bytes * lbolt 4 bytes * time of day 4 bytes * reason 1 byte * (0 = panic, 1 = reset, 2 = poweron) * boot media 1 byte * (2 = fd, 1 = syq, 0 = hd) * panic string 114 bytes #define CdtSig 0x00 #define CdtLbolt 0x04 #define CdtTOD 0x08 #define CdtReason 0x0C #define CdtMedia 0x0D #define CdtPanic 0x0E */ #define SZPANIC 114 #define SZCDT 128 struct CDT { unsigned int CdtSig; time_t lbolt; time_t time; char CdtReason; char CdtMedia; char CdtPanic[SZPANIC]; }; /* Disk types(see gdisk.h). */ /* #define HD 0 /* Winchester */ /* #define SY 1 /* syquest */ /* #define FD 2 /* Floppy */ /* Reasons */ #define PANIC 0 #define RESET 1 #define POWERON 2 /* Address the loader is loaded at */ #define LOADADDR 0x70000 #define BOOTCDT LOADADDR-SZCDT #endif hardware_h 0707070000020023621006660001460001440000010313010352172557200001400000021002sys/i8274.h/* Convergent Technologies - System V - Jul 1983 */ /* "@(#)i8274.h 1.1" */ #ifndef i8274_h #define i8274_h /* * Definitions for the I8274. */ /* * defines for WR0 */ #define REG_SELECT 0x07 /* A mask for the field that selects which register */ #define B35MASK 0x38 /* mask for bits 3-5 */ /* values for bits 3-5 - Command bits */ #define NULL_CTL 0x00 /* null code */ #define SEND_ABORT 0x08 /* send abort (sdlc) */ #define RST_EX_INT 0x10 /* reset ext/status interrupts */ #define RST_CHNL 0x18 /* channel reset */ #define ENAB_INT 0x20 /* enable interrupt on next Rx char */ #define RST_TX_PEND 0x28 /* reset Tx int/DMA pending */ #define ERR_RESET 0x30 /* error reset */ #define END_OF_INT 0x38 /* end of interrupt */ #define CRC_RST_CODE 0xc0 /* mask for CRC reset code */ /* values for bits 6-7 - CRC reset code */ #define NULL_CRC 0x00 /* null code */ #define RST_RX_CRC 0x40 /* reset RX CRC checker */ #define RST_TX_CRC 0x80 /* reset TX CRC generator */ #define RST_TX_URUN 0xc0 /* reset TX underrun/EOM latch */ /* * defines for WR1 */ #define EXT_INTENAB 0x01 /* external/status interrupt enable */ #define TX_INTENAB 0x02 /* TX interrupt/DMA enable */ #define VEC_TYPE 0x04 /* status affects vector 1=variable 0=fixed */ #define RX_INT_MD 0x18 /* mask for RX interrupt mode */ /* values for bits 3-4 - RX interrupt mode */ #define RX_INTDISAB 0x00 /* 0= RX interrupts/DMA disable */ #define RX_INT_FIRST 0x08 /* 1= RX interrupt on 1'st char only or special condition */ #define RX_INT_ALLPE 0x10 /* 2= interrupt on all RX chars or special condition (inc PE) */ #define RX_INTALL 0x18 /* 3= interrupt on all RX chars or special condition (not PE) */ #define WAIT_RX_TX 0x20 /* 1=wait on RX, 0=wait on TX */ #define MBZ 0x40 /* must be zero */ #define WAIT_ENAB 0x80 /* 1=wait enabled 0=wait disabled */ /* * defines for WR2 (channel A) */ #define SYS_CONFIG 0x03 /* system configuration */ /* values for bits 0-1 - system configuration */ #define INTA_INTB 0x00 /* channels A+B both interrupt */ #define DMAA_INTB 0x01 /* channel A uses DMA, channel B interrupts */ #define DMAA_DMAB 0x02 /* channels A+B both use DMA */ #define ILL_CODE 0x03 /* illegal code */ #define CH_PRIORITY 0x04 /* relative priorities: 0=RXA, TXA, RXB, TXB, EXTA, EXTB (low) 1=RXA, RXB, TXA, TXB, EXTA, EXTB (low) */ #define INT_CODE 0x18 /* interrupt code */ /* values for bits 3-4 - system configuration */ #define VEC_85_1 0x00 /* vectored 8085 mode 1 */ #define VEC_85_2 0x08 /* vectored 8085 mode 2 */ #define VEC_86_88 0x10 /* vectored 8086/8088 */ #define VEC_ILL 0x18 /* illegal mode */ #define VECTORED 0x20 /* 1=vectored 0=non vectored */ #define MBZ2 0x40 /* must be zero */ #define PIN_10 0x80 /* 0=RTS 1=SYNDET */ /* * defines for WR2 (channel B) */ #define INT_TYPE 0x07 /* interrupt type: (set by 8274) 0=channel B TX 0=channel B EXT/status 0=channel B RX 0=channel B special RX 0=channel A TX 0=channel A EXT/status 0=channel A RX 0=channel A special RX */ #define VEC_BASE 0xf8 /* vector base # for this chip */ /* * defines for WR3 */ #define RX_ENAB 0x01 /* RX enable */ #define SYNC_CH_INH 0x02 /* SYNC char load inhibit */ #define ADDR_SRCH_MD 0x04 /* address search mode (SDLC) */ #define RX_CRC_ENAB 0x08 /* RX CRC enable */ #define ENT_HUNT_MD 0x10 /* enter hunt mode */ #define AUTO_ENAB 0x20 /* auto enable */ #define RX_SIZE 0xc0 /* RX character size mask */ /* values for bits 6-7 - RX character size */ #define RX5 0x00 /* 0= 5 bits per char */ #define RX7 0x40 /* 1= 7 bits per char */ #define RX6 0x80 /* 2= 6 bits per char */ #define RX8 0xc0 /* 3= 8 bits per char */ /* * defines for WR4 */ #define PARITY 0x01 /* 1=enable parity 0=disable parity */ #define PARITYEVEN 0x02 /* 1=even parity 0=odd parity */ #define STOP_BITS_MSK 0x0c /* mask for the stop bits */ /* values for bits 2-3 - stop bits/sync mode */ #define ENAB_SYNC 0x00 /* 0= selects synchronous modes */ #define STOP1 0x04 /* 1= 1 stop bit (asynch) */ #define STOP15 0x08 /* 2= 1.5 stop bits (asynch) */ #define STOP2 0x0c /* 3= 2 stop bits (asynch) */ #define SYNC_MD_SEL 0x30 /* sync mode select mask */ /* values for bits 4-5 - SYNC mode select */ #define SYNC8 0x00 /* 0= 8 bit sync character */ #define SYNC16 0x10 /* 1= 16 bit sync character */ #define SDLC_HDLC 0x20 /* 2= SDLC mode (flag sync) */ #define EXT_SYNC_MD 0x30 /* 3= external sync mode */ #define CLOCK_MD_MSK 0xc0 /* mask for the clock mode */ /* values for bits 6-7 - clock modes */ #define X1 0x00 /* 0= x1 clock */ #define X16 0x40 /* 1= x16 clock */ #define X32 0x80 /* 2= x32 clock */ #define X64 0xc0 /* 3= x64 clock */ /* * defines for WR5 */ #define TX_CRC_ENAB 0x01 /* 1= enable TX CRC */ #define RTS 0x02 /* RTS pin */ #define SDLC_CRC_16 0x04 /* 1=CRC 16 0=CCITT CRC */ #define TX_ENABLE 0x08 /* 1=enable transmitter */ #define SEND_BREAK 0x10 /* 1= break line 0=normal */ #define TX_CHR_LN 0x60 /* TX character length mask */ /* values for bits 5-6 - TX character length */ #define TX5 0x00 /* 0= 5 bits per char */ #define TX7 0x20 /* 1= 7 bits per char */ #define TX6 0x40 /* 2= 6 bits per char */ #define TX8 0x60 /* 3= 8 bits per char */ #define DTR 0x80 /* DTR pin */ /* * defines for WR6 */ #define SYNC_ADDR 0xff /* sync/address */ /* * defines for WR7 */ #define SYNC_FLAG 0xff /* sync/flag */ /* * defines for RR0 */ #define RX_IN 0x01 /* RX character available */ #define INT_PEND 0x02 /* interrupt pending (chnl A only) */ #define TX_EMPTY 0x04 /* TX buffer empty */ #define CARRIER 0x08 /* carrier detect (CD) */ #define SYNC_HUNT 0x10 /* sync/hunt */ #define CTS 0x20 /* CTS */ #define TX_URUN 0x40 /* TX underrun/EOM */ #define BREAK 0x80 /* break/abort */ /* RX_IN and FLAGON are used in devconflg */ #define FLAGON BREAK /* * defines for RR1 */ #define ALL_SENT 0x01 /* all sent */ #define RESIDUE_CODES 0x0e /* mask for residue codes */ /* values for bits 1-3 - residue codes */ #define RC28 0x00 /* 0= 2(prev) 8(2'nd prev) */ #define RC06 0x02 /* 1= 0(prev) 6(2'nd prev) */ #define RC04 0x04 /* 2= 0(prev) 4(2'nd prev) */ #define RC08 0x06 /* 3= 0(prev) 8(2'nd prev) */ #define RC03 0x08 /* 4= 0(prev) 3(2'nd prev) */ #define RC07 0x0a /* 5= 0(prev) 7(2'nd prev) */ #define RC05 0x0c /* 6= 0(prev) 5(2'nd prev) */ #define RC18 0x0e /* 7= 1(prev) 8(2'nd prev) */ #define PAR_ERR 0x10 /* parity error */ #define RX_ORUN 0x20 /* RX overrun error */ #define CRC_FRAME 0x40 /* CRC/framing error */ #define END_OF_FRAME 0x80 /* end of frame */ /* * defines for RR2 */ #define INT_VEC 0xff /* pending interrupt vector */ /* * structure containing device addresses and registers * The first part of this structure is accessed by assembly code * in ml/i8274.s. The following entries must not be changed without * changing tx8274. txcnt, txptr, cmdad, datad, cmdadA. */ struct device { int txcnt; /* count of characters in transmit buffer */ char *txptr; /* pointer to transmit character */ ushort *cmdad, *datad; /* address for command and data */ ushort *cmdadA; /* address of A port for this chip */ char wr2,wr3,wr4,wr1; /* chip registers */ char wr5; /* chip registers */ char bprt; /* =0 if B port else A port */ ushort *clkcnt; /* address for 8253 count, this port */ ushort clkpsel; /* timer port selection code for this port */ }; /* data associated with the low level RS-232 input routine in ml/i8274.s */ struct serbuf { char minr; /* minor device number for this character */ char data; /* received data character */ }; extern unsigned short serbuf[]; extern unsigned short *inptr; /* address of next char to put in buffer */ extern unsigned short *outptr; /* address of next char to take from buffer */ extern int serbufcnt; /* count of characters in buffer */ extern int serbufful; /* max characters that can be put in buffer */ extern int serhiwater; /*hi water mark, when serbufcnt exceeds -xoff */ extern int serlowater; /*low water mark, when serbufcnt falls below -xon */ extern char serinprogress; /* =1 means C serrint is running */ extern char serxoff; /* XOFF sent by us */ extern char serinxoff; /* XOFF blocking TX */ extern char serrqstxoff; /* XOFF requested */ extern char sercd; /* CD state for all lines */ extern char sercts; /* CTS state for all lines */ extern unsigned short *eserbuf; /* first address past end of serbuf */ extern short ser_ports[]; /* preserves extended control bits */ #define ALL_SER ser_cnt+1 #endif i8274_h 0707070000020023631006660001460001440000010313130352172557300001300000002010sys/init.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)init.h 1.3" */ extern int clkstart(),cinit(),binit(),errinit(),iinit(),inoinit(); extern int finit(); extern gdinit(); extern wvinit(); extern wdinit(); extern initkbd(); extern int bswinit(),exinit(),setupclock(); #ifdef MEGA extern int heapinit(); #endif MEGA #ifdef X25_0 extern x25init(); #endif #ifdef ST_0 extern stinit(); #endif #ifdef VPM_0 extern vpminit(); #endif /* Array containing the addresses of the various initializing */ /* routines executed by "main" at boot time. */ int (*init_tbl[])() = { inoinit, cinit, binit, #ifdef MEGA heapinit, exinit, #endif MEGA setupclock, clkstart, /* initialises the clock if poweron, otherwise iinit calls setclk on reboot with the clock already running */ errinit, gdinit, finit, iinit, bswinit, #ifdef VPM_0 vpminit, #endif #ifdef X25_0 x25init, #endif #ifdef ST_0 stinit, #endif wvinit, /* this must come before wdinit */ initkbd, /* this must come before wdinit */ wdinit, 0 }; 0707070000020023641006660001460001440000010313150352172557300001200000001253sys/ino.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)ino.h 1.2" */ #ifndef ino_h #define ino_h /* Inode structure as it appears on a disk block. */ struct dinode { ushort di_mode; /* mode and type of file */ short di_nlink; /* number of links to file */ ushort di_uid; /* owner's user id */ ushort di_gid; /* owner's group id */ off_t di_size; /* number of bytes in file */ char di_addr[40]; /* disk block addresses */ time_t di_atime; /* time last accessed */ time_t di_mtime; /* time last modified */ time_t di_ctime; /* time created */ }; /* * the 40 address bytes: * 39 used; 13 addresses * of 3 bytes each. */ #endif ino_h 0707070000020024031006660001460001440000010313170352172557300001400000006175sys/inode.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)inode.h 1.2" */ #ifndef inode_h #define inode_h /* * 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, from mode on, is read in * from permanent inode on volume. */ #define NADDR 13 #define NSADDR (NADDR*sizeof(daddr_t)/sizeof(short)) struct inode { struct inode *i_forw; /* hash chain forw */ struct inode *i_back; /* hash chain back */ char i_flag; cnt_t i_count; /* reference count */ dev_t i_dev; /* device where inode resides */ ino_t i_number; /* i number, 1-to-1 with device address */ ushort i_mode; short i_nlink; /* directory entries */ ushort i_uid; /* owner */ ushort i_gid; /* group of owner */ off_t i_size; /* size of file */ struct { union { daddr_t i_a[NADDR]; /* if normal file/directory */ short i_f[NSADDR]; /* if fifo's */ } i_p; daddr_t i_l; /* last logical block read (for read-ahead) */ } i_blks; short i_vfdcnt; /* number of fd's vreading this inode */ struct locklist *i_locklist; /* locked region list */ }; /* file locking hooks -- Sept 1980, John Bass */ struct locklist { /* NOTE link must be first in struct */ struct locklist *ll_link; /* link to next lock region */ int ll_flags; /* misc flags ** sleeping */ struct proc *ll_proc; /* process which owns region */ off_t ll_start; /* starting offset */ off_t ll_end; /* ending offset, zero is eof */ }; extern struct locklist locklist[]; /* The lock table itself */ extern struct inode inode[]; /* The inode table itself */ /* flags */ #define ILOCK 01 /* inode is locked */ #define IUPD 02 /* file has been modified */ #define IACC 04 /* inode access time to be updated */ #define IMOUNT 010 /* inode is mounted on */ #define IWANT 020 /* some process waiting on lock */ #define ITEXT 040 /* inode is pure text prototype */ #define ICHG 0100 /* inode has been changed */ #define ISYN 0200 /* do synchronous write for iupdate */ /* modes */ #define IFMT 0170000 /* type of file */ #define IFDIR 0040000 /* directory */ #define IFCHR 0020000 /* character special */ #define IFBLK 0060000 /* block special */ #define IFREG 0100000 /* regular */ #define IFMPC 0030000 /* multiplexed char special */ #define IFMPB 0070000 /* multiplexed block special */ #define IFIFO 0010000 /* fifo special */ #define ISUID 04000 /* set user id on execution */ #define ISGID 02000 /* set group id on execution */ #define ISVTX 01000 /* save swapped text even after use */ #define IREAD 0400 /* read, write, execute permissions */ #define IWRITE 0200 #define IEXEC 0100 #define i_addr i_blks.i_p.i_a #define i_lastr i_blks.i_l #define i_rdev i_blks.i_p.i_a[0] #define i_faddr i_blks.i_p.i_a #define NFADDR 10 #define PIPSIZ (NFADDR * BSIZE) #define i_frptr i_blks.i_p.i_f[NSADDR-5] #define i_fwptr i_blks.i_p.i_f[NSADDR-4] #define i_frcnt i_blks.i_p.i_f[NSADDR-3] #define i_fwcnt i_blks.i_p.i_f[NSADDR-2] #define i_fflag i_blks.i_p.i_f[NSADDR-1] #define IFIR 01 #define IFIW 02 #endif 0707070000020024231006660001460001440000010313230352172557400001400000003473sys/iobuf.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)iobuf.h 1.2" */ #ifndef iobuf_h #define iobuf_h #include #include #include #include /* * Each block device has a iobuf, which contains private state stuff * and 2 list heads: the b_forw/b_back list, which is doubly linked * and has all the buffers currently associated with that major * device; and the d_actf/d_actl list, which is private to the * device but in fact is always used for the head and tail * of the I/O queue for the device. * Various routines in bio.c look at b_forw/b_back * (notice they are the same as in the buf structure) * but the rest is private to each device driver. */ struct iobuf { int b_flags; /* see buf.h */ struct buf *b_forw; /* first buffer for this dev */ struct buf *b_back; /* last buffer for this dev */ struct buf *b_actf; /* head of I/O queue */ struct buf *b_actl; /* tail of I/O queue */ dev_t b_dev; /* major+minor device name */ char b_active; /* busy flag */ char b_errcnt; /* error count (for recovery) */ struct eblock *io_erec; /* error record */ int io_nreg; /* number of registers to log on errors */ physadr io_addr; /* csr address */ #ifdef vax physadr io_mba; /* mba address */ #endif struct iostat *io_stp; /* unit I/O statistics */ time_t io_start; int io_s1; /* space for drivers to leave things */ int io_s2; /* space for drivers to leave things */ }; #ifdef vax #define tabinit(dv,stat) {0,0,0,0,0,makedev(dv,0),0,0,0,0,0,0,stat,0,0} #else #define tabinit(dv,stat) {0,0,0,0,0,makedev(dv,0),0,0,0,0,0,stat,0,0} #endif #define NDEVREG (sizeof(struct device)/sizeof(int)) #define B_ONCE 01 /* flag for once only driver operations */ #define B_TAPE 02 /* this is a magtape (no bdwrite) */ #define B_TIME 04 /* for timeout use */ #endif 0707070000020024241006660001460001440000010313250352172557400001400000000114sys/ioctl.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)ioctl.h 1.2" */ 0707070000020024251006660001460001440000010313260352172557500001300000007774sys/iohw.h/* Convergent Technologies - System V - Jun 1983 */ /* "@(#)iohw.h 1.4" */ #ifndef iohw_h #define iohw_h #include #include /* Video Bitmap Definitions */ #define VIDMEM ((unsigned short *)0x420000) /* mem addr */ #define VIDWIDTH 720 /* pixels */ #define VIDHEIGHT 348 #define VIDBYTES (VIDWIDTH/8) /* bytes */ /* value to use in touching processor registers for some control functions */ #define ACTIVATE (ushort)0 /* --------------------------------------------------------- | RS-232 Ports A + B Registers - 8274 | | Port A is used for RS-232, port B is used for | | the SCM modem. | | Uses the least significant byte of 16 bit word | --------------------------------------------------------- */ #define A_DATA_ADDR ((unsigned short *)0xE50000) /* R/W */ #define B_DATA_ADDR ((unsigned short *)0xE50002) /* R/W */ #define A_CMND_ADDR ((unsigned short *)0xE50004) /* R/W */ #define B_CMND_ADDR ((unsigned short *)0xE50006) /* R/W */ /* --------------------------------------------------------- | Keyboard serial driver, using the Motorola 6850 | | Uses the least significant byte of 16 bit word | --------------------------------------------------------- */ #define C_DATA_ADDR ((unsigned short *)0xE70002) /* R/W */ #define C_CMND_ADDR ((unsigned short *)0xE70000) /* R/W */ /* --------------------------------------------------------- | Baud generator for channel A, the lower 3 | | nibble of the address is the counter value. | | No baud generator for modem channel, constant | | 19.2k at clock input, use divide by 16 and | | divide by 64 logic of 8274 to obtain 1200 and | | 300 baud. | --------------------------------------------------------- */ #define A_BAUD_ADDR ((unsigned short *)0x4B0000) /* WO */ /* --------------------------------------------------------- | Parallel Line Printer Registers | | Uses the least significant byte of 16 bit word | --------------------------------------------------------- */ #define LP_STATUS_ADDR ((unsigned short *)0x470000) /* R */ #define LP_DATA_ADDR ((unsigned short *)0x4F0000) /* WO */ /* bits in the status register on reading */ #define LP_BUSY 0x80 /* LPB+ 1 = lp busy */ #define LP_SELECTED 0x40 /* LPS+ 1 = lp selected */ #define LP_OUT_PAPER 0x20 /* NP+ 1 = lp out of paper */ #define LP_ERR 0x10 /* LPERR- 0 = lp error */ #define FDINTRQ 0x08 /* FDINTRQ+ 1 = floppy interrupt */ #define HDINTRQ 0x04 /* HDINTRQ+ 1 = hard disk interrupt */ #define PARITY_ERR 0x02 /* PERR- 0 = parity error */ #define DTDET 0x01 /* DTDET- 0 = dial tone detected */ /* --------------------------------------------------------- | DISK Bus interface registers | | Uses the least significant byte of 16 bit word | --------------------------------------------------------- */ #define HD_BASE ((unsigned short *)0xE00000) #define FD_BASE ((unsigned short *)0xE10000) #define DMA_CNT ((unsigned short *)0x460000) /* RW */ #define DMA_LOADDR ((unsigned char *)0x4D0000) /* W */ #define DMA_HIADDR ((unsigned char *)0x4D4000) /* W */ #define DISK_CNTRL ((unsigned short *)0x4E0000) /* RW */ /* Bits in disk control register */ #define NOT_FDRST 0x80 /* 0 = reset, 1 = not reset */ #define FDR0 0x40 /* 1 = floppy selected */ #define FDMTR 0x20 /* 1 = floppy motor on */ #define NOT_HDRST 0x10 /* 0 = hdc reset, 1 = hdc not reset */ #define HDR0 0x08 /* 1 = hard disk 0 selected */ #define HDSEL 0x07 /* Head select mask */ /* Note: Bit 7 of the general control register is used as hard disk 1 select in machines with this hardware modification. This is an otherwise unused, bit-addressable bit at address 4c7000 */ /* Also note: All bits of the disk control register will be 0 after reset */ /* Bits in dma count register */ #define DMA_ENABLE 0x8000 /* 0 = dma disable, 1 = dma enabled */ #define DMA_CNT_MASK 0x3fff /* Bits 13...0 holds dma count */ #define DMA_ERROR 0x8000 /* dma error bit mask, 0 = error */ /* Masks for dma addresses */ #define DMA_LO_MASK 0x01fe #define DMA_HI_MASK 0x1ffe #endif iohw.h 0707070000020024261006660001460001440000010313320352172557500001300000010536sys/iohw.m/* Convergent Technologies - System V - Jul 1983 "@(&)iohw.m 1.3" */ #ifndef iohw_m #define iohw_m /* MINIFRAME HARDWARE DEFINITION - peripherals # 68010 ASSEMBLY INCLUDE FILE # (see also hardware.h for processor) # # FILE NAME: iohw.m # */ /* #8253-B interval timer #Control is Read only. Uses least significant byte of 16 bit word #Counters are Read/Write. Uses least significant byte of 16 bit word #set CNTL_WD,0xE78006 #set CNT_RAM_REFRESH,0xE78000 #set CNT_F,0xE78002 #set CNT_TICKS,0xE78002 #set CNT_S,0xE78004 # #SC bits of control word bits 6-7 #|set SEL_RAM_REFRESH,0x00 |SC select ram refresh #set SEL_FC_TIM,0x40 |SC select fast clock timer #set SEL_TICK_CNT,0x40 |SC select counter of ticks #set SEL_SC_TIM,0x80 |SC select slow clock timer #counts #set HZ_60_MSB,0x41 |MSB of 60HZ count #set HZ_60_LSB,0x1B |LSB of 60HZ count #RL bits of control word bits 4-5 #set RW2BYTE,0x30 |RL set bits,LSB then MSB #set RL_LATCH,0x00 |RL latch state of timer #set MODE0,0x0 #set MODE1,0x2 #set MODE2,0x4 |for periodic interrupt #set MODE3,0x6 |for counting ticks # value to use in writing to io control registers to trigger actions. */ set ACTIVATE,0 /* #RS-232 Ports A + B Registers - 8274-A #Port A is used for RS-232, port B is not used # except for detecting events. #Uses the least significant byte of 16 bit word */ set A_DATA_ADDR,0xE50000 #R/W set B_DATA_ADDR,0xE50002 #R/W set A_CMND_ADDR,0xE50004 #WO set B_CMND_ADDR,0xE50006 #WO /* #the internal/external selection: 0=internal, 1=external #set EX_SELA,0x02 |select int/ext clk chnl A #set EX_SELB,0x01 |select int/ext clk chnl B #status bits in the extended control register on reading #set EX_DSRA,0x40 |0=DSR chnl A #set EX_DSRB,0x08 |0=DSR chnl B #RS-232 Ports C + D Registers - 8274-B #Uses the least significant byte of 16 bit word */ set C_CMND_ADDR,0xE70000 #WO set C_DATA_ADDR,0xE70002 #R/W /* #set D_DATA_ADDR,0xE74002 |R/W #set D_CMND_ADDR,0xE74006 |WO */ /* #8253-A timer for 8274 channel A + C + D #Timer 0 is for RS-232, timer 1 for the modem, timer 2 for keyboard #Control is Read only. Uses least significant byte of 16 bit word #Counters are Read/Write. Uses least significant byte of 16 bit word #set AB_CNTL_WD,0xE76006 #set CD_CNTL_WD,0xE76006 #set A_BAUD_ADDR,0xE76000 #set C_BAUD_ADDR,0xE76002 #set D_BAUD_ADDR,0xE76004 #SC bits of control word bits 6-7 #set SEL_A_BAUD,0x00 |SC select A baud rate #set SEL_C_BAUD,0x40 |SC select C baud rate #set SEL_D_BAUD,0x80 |SC select D baud rate #Parallel Line Printer Registers #Uses the least significant byte of 16 bit word */ set LP_STATUS_ADDR,0x470000 #R set LP_DATA_ADDR,0x4F0000 #W /* #bits in the status register on reading */ set LP_BUSY,0x80 #LPB+ 1 = lp busy set LP_SELECTED,0x40 #LPS+ 1 = lp selected set LP_OUT_PAPER,0x20 #NP+ 1 = lp out of paper set LP_ERR,0x10 #LPERR- 0 = lp error set FDINTRQ,0x08 #FDINTRQ+ 1 = floppy interrupt set HDINTRQ,0x04 #HDINTRQ+ 1 = hard disk interrupt set PARITY_ERR,0x02 #PERR- 0 = parity error set DTDET,0x01 #DTDET- 0 = dial tone detected /* #DISK Bus interface registers #Uses the least significant byte of 16 bit word */ set HD_BASE,0xE00000 set FD_BASE,0xE10000 set DMA_CNT,0x460000 #R/W set DMA_LOADDR_ADDR,0x4D0000 #W set DMA_HIADDR_ADDR,0x4D0100 #W set DISK_CNTRL_ADDR,0x4E0000 #R/W set MCR_ADDR,0x4A0000 #W /* #Bits in Disk Control Register */ set NOT_FDRST,0x80 #0 = reset, 1 = not reset set FDR0,0x40 #1 = floppy selected set FDMTR,0x20 #1 = floppy motor on set NOT_HDRST,0x10 #0 = hdc reset, 1 = hdc not reset set HDR0,0x08 #1 = hard disk 0 selected set HDSEL,0x07 #Head select mask /* #Note: Bit 7 of the general control register is used as hard disk 1 #select in machines with this hardware modification. This is an otherwise #unused, bit-addressable bit at address 4c7000 #Also note: All bits of the disk control register will be 0 after reset #Bits in the miscellaneous control registers pertaining to dma #set DMA_READ,0x4000 |0 = dma write, 1 = dma read #Bits in dma count register */ set DMA_ENABLE,0x8000 #0 = dma disable, 1 = dma enabled set DMA_CNT_MASK,0x3fff #Bits 13...0 holds dma count set DMA_ERROR,0x8000 #dma error bit mask, 0 = error /* #Bits in line printer status register pertaining to disk driver #set FDINTRQ,0x08 |1 = fdc interrupt #set HDINTRQ,0x04 |1 = hdc interrupt #Masks for dma addresses */ set DMA_LO_MASK,0x01fe set DMA_HI_MASK,0x1ffe #endif iohw_m 0707070000020024271006660001460001440000010313370352172557600001200000001643sys/ipc.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)ipc.h 1.2" */ #ifndef ipc_h #define ipc_h #include /* Common IPC Access Structure */ struct ipc_perm { ushort uid; /* owner's user id */ ushort gid; /* owner's group id */ ushort cuid; /* creator's user id */ ushort cgid; /* creator's group id */ ushort mode; /* access modes */ ushort seq; /* slot usage sequence number */ key_t key; /* key */ }; /* Common IPC Definitions. */ /* Mode bits. */ #define IPC_ALLOC 0100000 /* entry currently allocated */ #define IPC_CREAT 0001000 /* create entry if key doesn't exist */ #define IPC_EXCL 0002000 /* fail if key exists */ #define IPC_NOWAIT 0004000 /* error if request must wait */ /* Keys. */ #define IPC_PRIVATE (key_t)0 /* private key */ /* Control Commands. */ #define IPC_RMID 0 /* remove identifier */ #define IPC_SET 1 /* set options */ #define IPC_STAT 2 /* get options */ #endif ipc_h 0707070000020024341006660001460001440000010313400352172557700001200000024442sys/kbd.h#include "sys/param.h" /* Miscellaneous Parameters */ #define REPTDLAY (HZ/2) /* initial repeat delay */ #define REPTRATE (HZ/15) /* repeat rate */ /* Special Keyboard Scan Codes */ #define KALLUP 0x40 /* all keys up */ #define KLAST 0x80 /* last entry in list */ #define KBOGUS 0x3F /* invalid code */ #define KSHIFT1 0x48 /* left-hand shift */ #define KSHIFT2 0x49 /* right-hand shift */ #define KCTRL1 0x4C /* left-hand control */ #define KCTRL2 0x4D /* right-hand control */ #define KCAPLCK 0x45 /* caps lock */ #define KNUMLCK 0x7E /* num lock */ #define KPRINT 0x43 /* num 7, print */ #define KRFRSH 0x44 /* num 8, refresh */ #define KPAGE 0x46 /* num 9, page */ #define KBEG 0x47 /* num 4, beg */ #define KHOME 0x4A /* num 5, home */ #define KEND 0x4B /* num 6, end */ #define KPREV 0x05 /* num 1, prev */ #define KUP 0x01 /* num 2, up */ #define KNEXT 0x0C /* num 3, next */ #define KLEFT 0x0E /* num -, left */ #define KDOWN 0x0B /* num 0, down */ #define KRIGHT 0x0F /* num ., right */ /* Keyboard Output Codes */ #define KBDRST 0x92 /* reset */ #define CAPLED 0xB0 /* caplck (b0=0 b1=1) */ #define NUMLED 0xA0 /* numlck (a0=0 a1=1) */ /* Keyboard Table Defs */ #define REPT 0x1 /* key repeats */ #define CAPLCK 0x2 /* caps lock'able */ #define NUMLCK 0x4 /* num lock'able */ #define ILLK -1 /* illegal key */ struct keydef { short kt_codes[3]; /* norm,shift,ctrl */ char kt_flags; /* flags */ }; #ifdef GEN_KT struct keydef keymap[] = { 0xffff,0xffff,0xffff, 0, /* 0x00 (key= 0, att= 0) `unused' */ 0x0241,0x0254,0x0254, 5, /* 0x01 (key=93, att=98) `ROLL/UP' */ 0x0361,0x0341,0x0341, 0, /* 0x02 (key= 1, att= 1) `ClearLine' */ 0x0362,0x0342,0x0342, 0, /* 0x03 (key= 2, att= 2) `Rstrt/Ref' */ 0x036b,0x034b,0x034b, 0, /* 0x04 (key=11, att=15) `Exit' */ 0x0467,0x0447,0x0447, 5, /* 0x05 (key=92, att=97) `PREV' */ 0xfd08,0xfd08,0xfd08, 0, /* 0x06 (key=12, att=16) `Msg' */ 0x0377,0x0357,0x0357, 0, /* 0x07 (key=38, att=42) `CANCL' */ 0x0008,0x0008,0x0008, 1, /* 0x08 (key=34, att=38) `BACKSPACE' */ 0x0009,0x025a,0x025a, 1, /* 0x09 (key=41, att=45) `TAB' */ 0x000a,0x000a,0x000a, 0, /* 0x0a (key=91, att=96) `ENTER' */ 0x0242,0x0253,0x0253, 5, /* 0x0b (key=102, att=109) `ROLL/DN' */ 0x0468,0x0448,0x0448, 5, /* 0x0c (key=94, att=99) `NEXT' */ 0x000d,0x000d,0x000d, 1, /* 0x0d (key=73, att=77) `RETURN' */ 0x0244,0x044b,0x044b, 5, /* 0x0e (key=101, att=108) `<-' */ 0x0243,0x044c,0x044c, 5, /* 0x0f (key=103, att=110) `->' */ 0x036e,0x034e,0x034e, 0, /* 0x10 (key=14, att=18) `Creat' */ 0x036f,0x034f,0x034f, 0, /* 0x11 (key=15, att=19) `Save' */ 0x0463,0x0443,0x0443, 0, /* 0x12 (key=59, att=63) `MOVE' */ 0x0372,0x0352,0x0352, 0, /* 0x13 (key=18, att=22) `Ops' */ 0x0464,0x0444,0x0444, 0, /* 0x14 (key=60, att=64) `COPY' */ 0x0363,0xfe00,0xffff, 0, /* 0x15 (key= 3, att= 3) `F1' */ 0x0364,0xfe01,0xffff, 0, /* 0x16 (key= 4, att= 4) `F2' */ 0x0365,0xfe02,0xffff, 0, /* 0x17 (key= 5, att= 5) `F3' */ 0x0366,0xfe03,0xffff, 0, /* 0x18 (key= 6, att= 8) `F4' */ 0x0367,0xfe04,0xffff, 0, /* 0x19 (key= 7, att= 9) `F5' */ 0x0368,0xfe05,0xffff, 0, /* 0x1a (key= 8, att=12) `F6' */ 0x001b,0x007f,0xffff, 1, /* 0x1b (key=21, att=25) `Esc/DEL' */ 0x0369,0xfe06,0xffff, 0, /* 0x1c (key= 9, att=13) `F7' */ 0x036a,0xfe07,0xffff, 0, /* 0x1d (key=10, att=14) `F8' */ 0xff0a,0xff09,0xff09, 0, /* 0x1e (key=16, att=20) `Suspd' */ 0xff0c,0xff0b,0xff0b, 0, /* 0x1f (key=17, att=21) `Rsume' */ 0x0020,0x0020,0x0020, 1, /* 0x20 (key=98, att=104) `SPACE' */ 0x0373,0x0353,0x0353, 0, /* 0x21 (key=19, att=23) `Undo' */ 0x0374,0x0354,0x0354, 0, /* 0x22 (key=20, att=24) `Redo' */ 0x0378,0x0358,0x0358, 0, /* 0x23 (key=39, att=43) `FIND' */ 0x0379,0x0359,0x0359, 0, /* 0x24 (key=40, att=44) `RPLAC' */ 0x00ff,0x00ff,0x00ff, 0, /* 0x25 (key=35, att=39) `RESET/BREAK' */ 0x0466,0x0446,0x0446, 1, /* 0x26 (key=78, att=83) `DLETECHAR' */ 0x0027,0x0022,0xffff, 1, /* 0x27 (key=72, att=76) `'' */ 0x0469,0x0449,0x0449, 0, /* 0x28 (key=95, att=100) `SLECT/MARK' */ 0x046a,0x044a,0x044a, 0, /* 0x29 (key=96, att=101) `INPUT/MODE' */ 0x036d,0x034d,0x034d, 0, /* 0x2a (key=13, att=17) `Help' */ 0xffff,0xffff,0xffff, 0, /* 0x2b (key= 0, att= 0) `unused' */ 0x002c,0x003c,0xffff, 1, /* 0x2c (key=87, att=92) `,' */ 0x002d,0x005f,0x056b, 1, /* 0x2d (key=32, att=36) `-' */ 0x002e,0x003e,0xffff, 1, /* 0x2e (key=88, att=93) `.' */ 0x002f,0x003f,0xffff, 1, /* 0x2f (key=89, att=94) `/' */ 0x0030,0x0029,0x056a, 1, /* 0x30 (key=31, att=35) `0' */ 0x0031,0x0021,0x0561, 1, /* 0x31 (key=22, att=26) `1' */ 0x0032,0x0040,0x0562, 1, /* 0x32 (key=23, att=27) `2' */ 0x0033,0x0023,0x0563, 1, /* 0x33 (key=24, att=28) `3' */ 0x0034,0x0024,0x0564, 1, /* 0x34 (key=25, att=29) `4' */ 0x0035,0x0025,0x0565, 1, /* 0x35 (key=26, att=30) `5' */ 0x0036,0x005e,0x0566, 1, /* 0x36 (key=27, att=31) `6' */ 0x0037,0x0026,0x0567, 1, /* 0x37 (key=28, att=32) `7' */ 0x0038,0x002a,0x0568, 1, /* 0x38 (key=29, att=33) `8' */ 0x0039,0x0028,0x0569, 1, /* 0x39 (key=30, att=34) `9' */ 0xffff,0xffff,0xffff, 0, /* 0x3a (key= 0, att= 0) `unused' */ 0x003b,0x003a,0xffff, 1, /* 0x3b (key=71, att=75) `;' */ 0xffff,0xffff,0xffff, 0, /* 0x3c (key= 0, att= 0) `unused' */ 0x003d,0x002b,0x056c, 1, /* 0x3d (key=33, att=37) `=' */ 0xffff,0xffff,0xffff, 0, /* 0x3e (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x3f (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x40 (key= 0, att= 0) `unused' */ 0x0375,0x0355,0x0355, 0, /* 0x41 (key=36, att=40) `CMD' */ 0x0376,0x0356,0x0356, 0, /* 0x42 (key=37, att=41) `CLOSE/OPEN' */ 0x037a,0xff0d,0xff0d, 4, /* 0x43 (key=56, att=60) `PRINT' */ 0x0461,0x024a,0x024a, 4, /* 0x44 (key=57, att=61) `CLEAR/RFHSH' */ 0xffff,0xffff,0xffff, 0, /* 0x45 (key=61, att=65) `CAPLOCK' */ 0x0255,0x0256,0x0256, 4, /* 0x46 (key=58, att=62) `PAGE' */ 0x0139,0x0442,0x0442, 4, /* 0x47 (key=74, att=79) `BEG' */ 0xffff,0xffff,0xffff, 0, /* 0x48 (key=79, att=84) `L-SHIFT' */ 0xffff,0xffff,0xffff, 0, /* 0x49 (key=90, att=95) `R-SHIFT' */ 0x0248,0x044d,0x044d, 4, /* 0x4a (key=75, att=80) `HOME' */ 0x0130,0x044e,0x044e, 4, /* 0x4b (key=76, att=81) `END' */ 0xffff,0xffff,0xffff, 0, /* 0x4c (key=97, att=103) `CTRL' */ 0xffff,0xffff,0xffff, 0, /* 0x4d (key=99, att=105) `CTRL' */ 0xffff,0xffff,0xffff, 0, /* 0x4e (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x4f (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x50 (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x51 (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x52 (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x53 (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x54 (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x55 (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x56 (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x57 (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x58 (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x59 (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x5a (key= 0, att= 0) `unused' */ 0x005b,0x007b,0x001b, 1, /* 0x5b (key=52, att=56) `[' */ 0x005c,0x007c,0x001c, 1, /* 0x5c (key=54, att=58) `\\' */ 0x005d,0x007d,0x001d, 1, /* 0x5d (key=53, att=57) `]' */ 0xffff,0xffff,0xffff, 0, /* 0x5e (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x5f (key= 0, att= 0) `unused' */ 0x0060,0x007e,0x0000, 1, /* 0x60 (key=55, att=59) ``' */ 0x0061,0x0041,0x0001, 3, /* 0x61 (key=62, att=66) `A' */ 0x0062,0x0042,0x0002, 3, /* 0x62 (key=84, att=89) `B' */ 0x0063,0x0043,0x0003, 3, /* 0x63 (key=82, att=87) `C' */ 0x0064,0x0044,0x0004, 3, /* 0x64 (key=64, att=68) `D' */ 0x0065,0x0045,0x0005, 3, /* 0x65 (key=44, att=48) `E' */ 0x0066,0x0046,0x0006, 3, /* 0x66 (key=65, att=69) `F' */ 0x0067,0x0047,0x0007, 3, /* 0x67 (key=66, att=70) `G' */ 0x0068,0x0048,0x0008, 3, /* 0x68 (key=67, att=71) `H' */ 0x0069,0x0049,0x0009, 3, /* 0x69 (key=49, att=53) `I' */ 0x006a,0x004a,0x000a, 3, /* 0x6a (key=68, att=72) `J' */ 0x006b,0x004b,0x000b, 3, /* 0x6b (key=69, att=73) `K' */ 0x006c,0x004c,0x000c, 3, /* 0x6c (key=70, att=74) `L' */ 0x006d,0x004d,0x000d, 3, /* 0x6d (key=86, att=91) `M' */ 0x006e,0x004e,0x000e, 3, /* 0x6e (key=85, att=90) `N' */ 0x006f,0x004f,0x000f, 3, /* 0x6f (key=50, att=54) `O' */ 0x0070,0x0050,0x0010, 3, /* 0x70 (key=51, att=55) `P' */ 0x0071,0x0051,0x0011, 3, /* 0x71 (key=42, att=46) `Q' */ 0x0072,0x0052,0x0012, 3, /* 0x72 (key=45, att=49) `R' */ 0x0073,0x0053,0x0013, 3, /* 0x73 (key=63, att=67) `S' */ 0x0074,0x0054,0x0014, 3, /* 0x74 (key=46, att=50) `T' */ 0x0075,0x0055,0x0015, 3, /* 0x75 (key=48, att=52) `U' */ 0x0076,0x0056,0x0016, 3, /* 0x76 (key=83, att=88) `V' */ 0x0077,0x0057,0x0017, 3, /* 0x77 (key=43, att=47) `W' */ 0x0078,0x0058,0x0018, 3, /* 0x78 (key=81, att=86) `X' */ 0x0079,0x0059,0x0019, 3, /* 0x79 (key=47, att=51) `Y' */ 0x007a,0x005a,0x001a, 3, /* 0x7a (key=80, att=85) `Z' */ 0xffff,0xffff,0xffff, 0, /* 0x7b (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x7c (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x7d (key= 0, att= 0) `unused' */ 0xffff,0xffff,0xffff, 0, /* 0x7e (key=100, att=107) `NUMLOCK' */ 0x0465,0x0445,0x0445, 0, /* 0x7f (key=77, att=82) `DLETE' */ }; /* Special sequence prefixes */ char *ksptab[] = { "\033OC", "\033OD", "\033OE", "\033OF", "\033OG", "\033OH", "\033OI", "\033OJ", "\032", "\033OP", "\033Op", "\033OQ", "\033Oq", "\033OZ" }; char *kprefix[] = { "\033", "\033[", "\033O", "\033N", "\033P" }; #endif GEN_KT /* These are special key code values needed by mouse border handling. */ #define KCSUP 0x254 #define KCSDOWN 0x253 #define KCPAGEDN 0x255 #define KCPAGEUP 0x256 #define KCBEG 0x139 #define KCEND 0x130 #define KCCANCEL 0x357 #define KCSSUSPD 0xff09 #define KCSRSUME 0xff0b #define KCSLEFT 0x44b #define KCHELP 0x36d #define KCSRIGHT 0x44c /* These are special key code values needed by mouse activated SLKs */ #define KCF1 0x363 #define KCF2 0x364 #define KCF3 0x365 #define KCF4 0x366 #define KCF5 0x367 #define KCF6 0x368 #define KCF7 0x369 #define KCF8 0x36a /* icon numbers - returned by WBFIND(), used in mouse.c */ #define IC_MOVE 1 #define IC_HELP 2 #define IC_RESIZE 3 #define IC_CANCEL 4 #define IC_UPSCROLL 5 #define IC_DNSCROLL 6 #define IC_LSCROLL 7 #define IC_RSCROLL 8 0707070000020024431006660001460001440000010313540352172560000001500000000453sys/lapbtr.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)lapbtr.h 1.2" */ #define TRACE(X,Y,Z) {U = X|Y; trace(U,Z);} #define TSEQ 0 #define TSTART_T1 040 #define TSTOP_T1 0100 #define TXMT 0140 #define TRCV 0200 #define TNOBUF 0240 #define TOSTATE 0300 #define TNSTATE 0340 #define TDSCFRM 020 0707070000020024451006660001460001440000010313550352172560000001300000000303sys/lock.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)lock.h 1.2" */ /* * flags for locking procs and texts */ #define UNLOCK 0 #define PROCLOCK 1 #define TXTLOCK 2 #define DATLOCK 4 0707070000020024461006660001460001440000010313560352172560100001400000000502sys/lprio.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)lprio.h 1.2" */ /* * Line Printer Type Devices I/O Control */ struct lprio { short ind; short col; short line; }; /* ioctl commands */ #define LPR ('l'<<8) #define LPRGET (LPR|01) #define LPRSET (LPR|02) #define LPRGETV (LPR|05) #define LPRSETV (LPR|06) 0707070000020024471006660001460001440000010313570352172560100001200000004433sys/map.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)map.h 1.1" */ #ifndef map_h #define map_h /* * 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. * * System 5 introduced the ability to request a wakeup on a map when * an mfree was performed. This has been merged with the UCB map routines * by using the most significant bit of the map name to signal that a * wakeup is required when an mfree is performed on this map. */ struct map { struct mapent *m_limit; /* address of last slot in map */ uint m_want:1, /* non zero means do wakeup on map */ m_name:31; /* address of name of resource */ /* we use m_name when the map overflows, in warning messages */ }; struct mapent { int m_size; /* size of this segment of the map */ int m_addr; /* resource-space addr of start of segment */ }; #ifdef KERNEL extern struct map swapmap[]; extern int nswapmap; extern struct map argmap[]; #define ARGMAPSIZE 16 #ifdef mega extern struct map kmap[]; #define KMAPSIZE 32 #endif #endif #ifdef vax #define mapstart(X) &X[1] #define mapwant(X) X[0].m_addr #define mapsize(X) X[0].m_size #define mapdata(X) {(X)-2, 0} , {0, 0} #define mapinit(X, Y) X[0].m_size = (Y)-2 #else #define mapwant(X) X[0].m_want #endif #endif 0707070000020024511006660001460001440000010313620352172560100001400000016567sys/modem.h/* ------------------------------------------------------------------------- | This include file contains constant to control the 882A Switched | | Capacitor Modem (SCM). | ------------------------------------------------------------------------- --------------------------------------------------------- | Addresses of SCM Control registers, register 7 | | does not exist. | | W/R at the end defines a Read or Write register. | --------------------------------------------------------- */ #define SCM_0W_Control ((unsigned short *) 0xE60000) #define SCM_1W_Control ((unsigned short *) 0xE61000) #define SCM_2R_Control ((unsigned short *) 0xE62000) #define SCM_3R_Control ((unsigned short *) 0xE63000) #define SCM_4W_Control ((unsigned short *) 0xE64000) #define SCM_5W_Control ((unsigned short *) 0xE65000) #define SCM_6W_Control ((unsigned short *) 0xE66000) #define SCM_8W_Control ((unsigned short *) 0xE68000) #define SCM_9W_Control ((unsigned short *) 0xE69000) #define SCM_10R_Control ((unsigned short *) 0xE6A000) /* --------------------------------------------------------- | Bit definition for write control register 0. | | Modem line control from terminal and telephone | | interfaces. | --------------------------------------------------------- */ #define SCM_RingEnable_Wr0 0x80 #define SCM_TalkMode_Wr0 0x40 #define SCM_OffHook_Wr0 0x20 #define SCM_DataMode_Wr0 0x10 #define SCM_AsyncMode_Wr0 0x08 #define SCM_TurnOnDTR_Wr0 0x04 #define SCM_LowPower_Wr0 0x02 /* Reset for normal operation */ #define SCM_PowerReset_Wr0 0x01 /* Set and reset for normal operation */ #define SCM_ResetDone_Wr0 0x00 /* --------------------------------------------------------- | Bit definition for write control register 1. | | Customer control and modem test controls. | --------------------------------------------------------- */ #define InternalClock_SCM_Wr1 0x00 #define ExternalClock_SCM_Wr1 0x40 #define VoiceMode_SCM_Wr1 0x20 #define Baud300_SCM_Wr1 0x00 #define Baud1200_SCM_Wr1 0x10 #define Baud2400_SCM_Wr1 0x10 /* also need R8b3 to be set */ /* Loopback test selection */ #define RemoteDigtal_SCM_Wr1 0x08 #define LocalAnalog_SCM_Wr1 0x04 #define LocalDigital_SCM_Wr1 0x02 #define SelfTest_SCM_Wr1 0x01 /* --------------------------------------------------------- | Bit definition for read control register 2 | | Modem status to terminal interface. | --------------------------------------------------------- */ #define FailedSelfTest_SCM_Rr2 0x80 #define SCMinTestMode_SCM_Rr2 0x40 #define SCMinDataMode_SCM_Rr2 0x20 /* an incoming call was answered */ #define DSRisOn_SCM_Rr2 0x10 #define BaudrateMask_SCM_Rr2 0x0C #define at300Baud_SCM_Rr2 0x00 #define at1200Baud_SCM_Rr2 0x04 #define at2400Baud_SCM_Rr2 0x0C #define DataValid_SCM_Rr2 0x02 /* set after modem handshake */ #define CTSisOn_SCM_Rr2 0x01 /* --------------------------------------------------------- | Bit definition for read control register 3 | | Modem status to lamps and relays. | --------------------------------------------------------- */ #define DigitalTestActive_SCM_Rr3 0x80 /* local or remote */ #define SlfTestActive_SCM_Rr3 0x40 #define SendDataState_SCM_Rr3 0x20 /* input to modulator */ #define ReceiveDataState_SCM_Rr3 0x10 /* output from demodulator */ #define EnergyOnLine_SCM_Rr3 0x08 #define ModemInUse_SCM_Rr3 0x04 #define SwitchFromPhoneToModem_SCM_Rr3 0x02 #define RingRelayIsSet_SCM_Rr3 0x01 /* --------------------------------------------------------- | Bit definition for write control register 4 | | Options: Asynchronous/synchronous converter | | and handshaking. | --------------------------------------------------------- */ #define SetSynchMode_SCM_Wr4 0x80 /* 1200 and 2400 baud only */ #define SetAsyncMode_SCM_Wr4 0x00 #define SetOptionAsync_SCM_Wr4 0x40 #define Set6DataBits_SCM_Wr4 0x20 #define Set7DataBits_SCM_Wr4 0x10 #define Set8DataBits_SCM_Wr4 0x00 #define Set9DataBits_SCM_Wr4 0x30 #define NormalBandMode_SCM_Wr4 0x00 #define ReverseBandMode_SCM_Wr4 0x04 #define TxLowBandMode_SCM_Wr4 0x08 /* Force originate only */ #define TxHighBandMode_SCM_Wr4 0x0C /* Force answer only */ #define PrivateHandshake_SCM_Wr4 0x02 #define CCITTAnswerTone_SCM_Wr4 0x01 #define B212AnswerTone_SCM_Wr4 0x00 /* --------------------------------------------------------- | Bit definition for write control register 5 | | Options: CCITT and disconnect. | --------------------------------------------------------- */ #define Wr5_NormalOperations_SCM_Wr 0x00 #define CCITTDSR_SCM_Wr5 0x80 #define B212DSR_SCM_Wr5 0x00 #define CCITT2100HzTone_SCM_Wr5 0x40 #define B212No2100HzTone_SCM_Wr5 0x00 #define Set1800GuardBand_SCM_Wr5 0x20 #define B212NoGuardBand_SCM_Wr5 0x00 #define NoAutoDataMode_SCM_Wr5 0x10 #define DTRAutoDataMode_SCM_Wr5 0x00 /* Modem disconnect options */ #define SendNoSpaceDisconnect_SCM_Wr5 0x08 #define SendSpaceDisconnect_SCM_Wr5 0x00 /* send space for 4 seconds */ #define IgnoreSpaces_SCM_Wr5 0x04 #define SpaceRcvdDisconnect_SCM_Wr5 0x00 #define IgnoreLossOfLCD_SCM_Wr5 0x02 #define LossOfLCDDisconnect_SCM_Wr5 0x00 #define IgnoreRemoteDigRequest_SCM_Wr5 0x01 #define AcceptRemoteDigRequest_SCM_Wr5 0x00 /* --------------------------------------------------------- | Bit definition for write control register 6 | | Data and timing output clamps and chip test. | --------------------------------------------------------- */ #define Wr6_NormalOperations_SCM_Wr6 0x00 #define SetTxDataToMark_SCM_Wr6 0x80 #define SetTxTimingToMark_SCM_Wr6 0x40 #define SetRxDataToMark_SCM_Wr6 0x20 #define SetRxTimingToMark_SCM_Wr6 0x10 /* --------------------------------------------------------- | Bit definition for write control register 8 | | Tranceiver control register. | --------------------------------------------------------- */ #define Wr8_NormalOperations_SCM_Wr8 0x20 #define TxScramblerBypass_SCM_Wr8 0x80 #define RxDescramblerBypass_SCM_Wr8 0x40 #define Set2400Baud_SCM_Wr8 0x08 /* R1b4 should also be set */ #define ForceTxMarks_SCM_Wr8 0x04 #define Force2100Hz_SCM_Wr8 0x02 #define Force1800Hz_SCM_Wr8 0x01 /* --------------------------------------------------------- | Bit definition for write control register 9 | | Transceiver control register II. | --------------------------------------------------------- */ #define Wr9_NormalOperations_SCM_Wr9 0x00 #define SendDoubleDotting_SCM_Wr9 0x01 /* --------------------------------------------------------- | Bit definition for read control register 10 | | Transceiver status register. | --------------------------------------------------------- */ /* SCM handshake indicators */ #define SendingSpaces_SCM_Rr10 0x80 #define DigLoopbackTest_SCM_Rr10 0x40 /* is set in the modem requesting the test */ #define FSKScramMarkReceived_SCM_Rr10 0x20 /* stays set in data mode */ #define AnsToneReceived_SCM_Rr10 0x10 /* stays set in data mode */ /* Received data indicators, these bits reflect the current state of the receiver, values are not latched. */ #define FSKUnscramMarkRcving_SCM_Rr10 0x08 #define PSKUnscramMarkRcving_SCM_Rr10 0x04 #define PSKScramMarkRcving_SCM_Rr10 0x02 #define DoubleDottingRcving_SCM_Rr10 0x01 #define MD_IDLE 0 /* initial state */ #define MD_WAITREADY 1 /* after offhook, wait modem ready */ #define MD_WAITHANDCOMP 2 /* wait handshake complete */ #define MD_HANGUPWAIT 3 /* wait for hangup */ 0707070000020024521006660001460001440000010313720352172560200001400000001046sys/mount.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)mount.h 1.2" */ #ifndef mount_h #define mount_h #include #include /* * Mount structure. * One allocated on every mount. */ struct mount { int m_flags; /* status */ dev_t m_dev; /* device mounted */ struct inode *m_inodp; /* pointer to mounted on inode */ struct buf *m_bufp; /* buffer for super block */ struct inode *m_mount; /* pointer to mount root inode */ }; #define MFREE 0 #define MINUSE 1 #define MINTER 2 extern struct mount mount[]; #endif 0707070000020024531006660001460001440000010313730352172560200001400000001552sys/mouse.h#ifndef _MOUSE #define _MOUSE /* Keyboard/Mouse Codes */ #define MSENABLE 0xD0 /* enable mouse */ #define MSDISABLE 0xD1 /* disable mouse */ #define BEGMOUSE 0xCE /* mouse data follows */ #define BEGEMOUSE 0xCF /* mouse data lost */ #define BEGKBD 0xDF /* kbd data follows */ /* Bits in the mouse byte #1 */ #define MBUTR 0x01 /* right button down */ #define MBUTM 0x02 /* middle button down */ #define MBUTL 0x04 /* left button down */ #define MSY 0x08 /* sign of Y */ #define MSX 0x10 /* sign of X */ #define MBUTALL (MBUTL|MBUTM|MBUTR) /* all the buttons */ /* Default scaling formulae */ #define MDPI 200 /* mouse dots/inch */ #define MVI 4 /* mouse vertical trav */ #define MHI 4 /* horizontal trav */ #define MXSCALE ((MHI*MDPI)/VIDWIDTH) /* x scaling */ #define MYSCALE ((MVI*MDPI)/VIDHEIGHT) /* y scaling */ #endif _MOUSE 0707070000020024541006660001460001440000010313740352172560300001200000004024sys/msg.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)msg.h 1.2" */ /* ** IPC Message Facility. */ /* ** Implementation Constants. */ #define PMSG (PZERO + 2) /* message facility sleep priority */ /* ** Permission Definitions. */ #define MSG_R 0400 /* read permission */ #define MSG_W 0200 /* write permission */ /* ** ipc_perm Mode Definitions. */ #define MSG_RWAIT 01000 /* a reader is waiting for a message */ #define MSG_WWAIT 02000 /* a writer is waiting to send */ /* ** Message Operation Flags. */ #define MSG_NOERROR 010000 /* no error if big message */ /* ** Structure Definitions. */ /* ** There is one msg queue id data structure for each q in the system. */ struct msqid_ds { struct ipc_perm msg_perm; /* operation permission struct */ struct msg *msg_first; /* ptr to first message on q */ struct msg *msg_last; /* ptr to last message on q */ ushort msg_cbytes; /* current # bytes on q */ ushort msg_qnum; /* # of messages on q */ ushort msg_qbytes; /* max # of bytes on q */ ushort msg_lspid; /* pid of last msgsnd */ ushort msg_lrpid; /* pid of last msgrcv */ time_t msg_stime; /* last msgsnd time */ time_t msg_rtime; /* last msgrcv time */ time_t msg_ctime; /* last change time */ }; /* ** There is one msg structure for each message that may be in the system. */ struct msg { struct msg *msg_next; /* ptr to next message on q */ long msg_type; /* message type */ short msg_ts; /* message text size */ short msg_spot; /* message text map address */ }; /* ** User message buffer template for msgsnd and msgrecv system calls. */ struct msgbuf { long mtype; /* message type */ char mtext[1]; /* message text */ }; /* ** Message information structure. */ struct msginfo { int msgmap, /* # of entries in msg map */ msgmax, /* max message size */ msgmnb, /* max # bytes on queue */ msgmni, /* # of message queue identifiers */ msgssz, /* msg segment size (should be word size multiple) */ msgtql; /* # of system message headers */ ushort msgseg; /* # of msg segments (MUST BE < 32768) */ }; 0707070000020024561006660001460001440000010313770352172560300001200000000552sys/opt.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)opt.h 1.5" */ #if MESG==0 msgsys(){nosys();} msginit(){return(0);} #endif #if SEMA==0 semsys(){nosys();} seminit(){} semexit(){} #endif #if SHMEM==0 shmsys(){nosys();} shmexec(){} shmexit(){} shmfork(){} shmreset(){} shminit(){} setupshm(){} freeshmseg(){} #endif #if DEBUGGER==0 dbmain(){} #endif 0707070000020024611006660001460001440000010314000352172560300001400000017124sys/param.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)param.h 1.4" */ #ifndef param_h #define param_h /* * fundamental variables * don't change too often */ #define NOFILE 20 /* max open files per process */ #define MAXPID 30000 /* max process id */ #define MAXUID 60000 /* max user id */ #define MAXLINK 1000 /* max links */ #include /* Memory mapping hardware */ /* see sys/pte.h */ #define VUSER_START 0x80000 /* start address of user process */ #define VUSER_END 0x380000 /* end address of user process */ #define MAXMEM (btoc(0x400000)) /* max core in 4096-byte clicks */ #define MAXUMEM (btoc(VUSER_END)) /* max user program size in 4096 byte clicks */ #define MAXBLK 64 /* max blocks possible for phys IO */ /* limited by the number of Kernel map slots dedicated to dma */ #define SSIZE 4 /* initial stack size (*4096 bytes) */ #define SINCR 4 /* increment of stack (*4096 bytes) */ #define UPAGES 1 #define USIZE (UPAGES + 1) /* size of user block (*4096) */ #define USRSTACK (VUSER_END-ctob(USIZE)) /* Start of user stack */ #define KVMEM_VBASE VUSER_END #define KVMEM_VLIMIT 0x400000 #define KVMEM_PAGES btoc(KVMEM_VLIMIT-KVMEM_VBASE) #define KVMEM_VPAGE0 btoc(KVMEM_VBASE) #define CANBSIZ 256 /* max size of typewriter line */ #define HZ 60 /* Ticks/second of the clock */ #define NCARGS 5120 /* # characters in exec arglist */ /* * priorities * should not be altered too much */ #define PMASK 0177 #define PCATCH 0400 #define PSWP 0 /* swapper needs a swap candidate */ #define PINOD 10 /* process accessing locked inode */ #define PRIBIO 20 /* process sleeping on block I/O system buffer */ #define PZERO 25 /* sleep <= PZERO not broken by signals */ #define NZERO 20 /* default process nice */ #define PPIPE 26 /* sleeping on empty pipe read, full pipe write */ #define TTIPRI 27 /* waiting for tty input (was 28) */ #define PEXWT 28 /* user wait on exchange: exWait() or exCall() */ #define TTOPRI 29 /* waiting for space in tty output clist */ #define PWIND 30 /* waiting for window exposure, etc. */ #define PWAIT 40 /* waiting death of child: wait() sys call */ #define PSLEP 49 /* waiting signal: pause() sys call */ #define PUSER 60 /* base priority for user process with dflt nice */ #define PIDLE 127 /* no runnable processes in system */ /* * fundamental constants of the implementation-- * cannot be changed easily */ #define NBPW sizeof(int) /* number of bytes in an integer */ #ifdef KERNEL #define FsTYPE 2 #else /* some commands are more compatible if use dual file system */ #ifndef FsTYPE #define FsTYPE 3 #endif #endif KERNEL #if FsTYPE==1 /* Original 512 byte file system */ #define BSIZE 512 /* size of file system block (bytes) */ #define SBUFSIZE BSIZE /* system buffer size */ #define BSHIFT 9 /* LOG2(BSIZE) */ #define NINDIR (BSIZE/sizeof(daddr_t)) #define BMASK 0777 /* BSIZE-1 */ #define INOPB 8 /* inodes per block */ #define INOSHIFT 3 /* LOG2(INOPB) if exact */ #define NMASK 0177 /* NINDIR-1 */ #define NSHIFT 7 /* LOG2(NINDIR) */ #define FsBSIZE(dev) BSIZE #define FsBSHIFT(dev) BSHIFT #define FsNINDIR(dev) NINDIR #define FsBMASK(dev) BMASK #define FsINOPB(dev) INOPB #define FsLTOP(dev, b) b #define FsPTOL(dev, b) b #define FsNMASK(dev) NMASK #define FsNSHIFT(dev) NSHIFT #define FsITOD(dev, x) itod(x) #define FsITOO(dev, x) itoo(x) #endif #if FsTYPE==2 /* New 1024 byte file system */ #define BSIZE 1024 /* size of file system block (bytes) */ #define SBUFSIZE BSIZE /* system buffer size */ #define BSHIFT 10 /* LOG2(BSIZE) */ #define NINDIR (BSIZE/sizeof(daddr_t)) #define BMASK 01777 /* BSIZE-1 */ #define INOPB 16 /* inodes per block */ #define INOSHIFT 4 /* LOG2(INOPB) if exact */ #define NMASK 0377 /* NINDIR-1 */ #define NSHIFT 8 /* LOG2(NINDIR) */ #define Fs2BLK 0x2000 #define FsBSIZE(dev) BSIZE #define FsBSHIFT(dev) BSHIFT #define FsNINDIR(dev) NINDIR #define FsBMASK(dev) BMASK #define FsINOPB(dev) INOPB #define FsLTOP(dev, b) (b<<1) #define FsPTOL(dev, b) (b>>1) #define FsNMASK(dev) NMASK #define FsNSHIFT(dev) NSHIFT #define FsITOD(dev, x) itod(x) #define FsITOO(dev, x) itoo(x) #define FsINOS(dev, x) ((x&~017)+1) #define FsBOFF(dev, x) ((x)&01777) #define FsBNO(dev, x) ((x)>>10) #endif #if FsTYPE==3 /* Dual system */ #define BSIZE 512 /* size of file system block (bytes) */ #define SBUFSIZE (BSIZE*2) /* system buffer size */ #define BSHIFT 9 /* LOG2(BSIZE) */ #define NINDIR (BSIZE/sizeof(daddr_t)) #define BMASK 0777 /* BSIZE-1 */ #define INOPB 8 /* inodes per block */ #define INOSHIFT 3 /* LOG2(INOPB) if exact */ #define NMASK 0177 /* NINDIR-1 */ #define NSHIFT 7 /* LOG2(NINDIR) */ #define Fs2BLK 0x2000 #define FsLRG(dev) (dev&Fs2BLK) #define FsBSIZE(dev) (FsLRG(dev) ? (BSIZE*2) : BSIZE) #define FsBSHIFT(dev) (FsLRG(dev) ? 10 : 9) #define FsNINDIR(dev) (FsLRG(dev) ? 256 : 128) #define FsBMASK(dev) (FsLRG(dev) ? 01777 : 0777) #define FsBOFF(dev, x) (FsLRG(dev) ? ((x)&01777) : ((x)&0777)) #define FsBNO(dev, x) (FsLRG(dev) ? ((x)>>10) : ((x)>>9)) #define FsINOPB(dev) (FsLRG(dev) ? 16 : 8) #define FsLTOP(dev, b) (FsLRG(dev) ? b<<1 : b) #define FsPTOL(dev, b) (FsLRG(dev) ? b>>1 : b) #define FsNMASK(dev) (FsLRG(dev) ? 0377 : 0177) #define FsNSHIFT(dev) (FsLRG(dev) ? 8 : 7) #define FsITOD(dev, x) (daddr_t)(FsLRG(dev) ? \ ((unsigned)x+(2*16-1))>>4 : ((unsigned)x+(2*8-1))>>3) #define FsITOO(dev, x) (daddr_t)(FsLRG(dev) ? \ ((unsigned)x+(2*16-1))&017 : ((unsigned)x+(2*8-1))&07) #define FsINOS(dev, x) (FsLRG(dev) ? \ ((x&~017)+1) : ((x&~07)+1)) #endif #define NICFREE 50 /* number of superblock free blocks */ #define NCPS 16 /* Number of clicks per segment */ #define NBPC 4096 /* Number of bytes per click */ #define BPCSHIFT 12 /* LOG2(NBPC) if exact */ #define NULL 0 #define CMASK 0 /* default mask for file creation */ #define CDLIMIT (1L<<11) /* default max write address */ #define NODEV (dev_t)(-1) #define ROOTINO ((ino_t)2) /* i number of all roots */ #define SUPERB ((daddr_t)1) /* physical block number of the super block */ #define SUPERBOFF 512 /* byte offset of the super block */ #define DIRSIZ 14 /* max characters per directory */ #define NICINOD 100 /* number of superblock inodes */ #define DS 1 /* used by expand to expand ds size */ #define SS 2 /* used by expand to expand ss size */ #define PTE_BANK0 128 /* size of mpte's in the first page of u */ #define MAXKERNEL 128 /* maximum size of kernel (4k click) */ #define SYSPAGE 128 /* page table entries reserved for kernel */ #define SYSSEG 8 /* segment table entries reserved for kernel */ #define VPG_BASE 0x70000 /* starting virtual address of user pages */ #define U_OFFSET 0x0900 /* offset of u struct into user pages */ #define PTE_OFFSET 0xE00 /* offset of pte in usr tbl */ #define VPTE_BASE 0x70E00 /* starting virtual address of pte in u */ /* * variables for BSD 4.1 */ #define MSWAPX 15 /* pseudo mount table index for swapdev */ #define NBBY 8 /* number of bits in a byte */ #define NBPG NBPC #define PGOFSET (NBPG-1) /* byte offset into page */ #define PGSHIFT BPCSHIFT /* LOG2(NBPG) */ #define KLSIZE 1 #define CLOFSET (KLSIZE*NBPG-1) /* for clusters, like PGOFSET */ /* give the base virtual address (first of KLSIZE) */ #define clbase(i) (i) /* round a number of clicks up to a whole cluster */ #define clrnd(i) (i) /* end of BSD 4.1 stuff */ /* * Some macros for units conversion */ #include /* Machine-dependent bits and macros */ #define SUPVMODE 0x2000 /* usermode bits */ #define USERMODE(ps) ((ps & SUPVMODE) == 0) #define BASEPRI(ps) ((ps & 0x700) != 0) #define lobyte(X) (((unsigned char *)&X)[1]) #define hibyte(X) (((unsigned char *)&X)[0]) #define loword(X) (((ushort *)&X)[1]) #define hiword(X) (((ushort *)&X)[0]) #endif param_h 0707070000020024621006660001460001440000010314220352172560400001100000010506sys/ph.h/* created 4/25/84 C. Liu */ #include "sys/proc.h" #include "sys/tty.h" #define MS_TICK (1000/HZ) /* msec per tick */ #define T_50MS 0x04 /* 4 ticks */ #define T_70MS 0x05 /* 5 ticks */ #define T_100MS 0x08 /* 10 ticks */ /* ------------------------------------------------------------------------- | phone line control structure | ------------------------------------------------------------------------- */ /* p_flags values */ #define PF_OPEN 0x01 /* line in use */ #define PF_VOICE 0x02 /* line used for voice */ #define PF_DATA 0x04 /* line used with modem */ #define PF_PULSE 0x10 /* use pulse for dialing*/ #define PF_DTMF 0x20 /* use tones for dialing*/ #define PF_PUDT 0x30 /* use either for dial */ /* p_linestate */ #define PL_IDLE 0x00 /* line idle */ #define PL_OFFHOOK 0x01 /* handset picked up */ #define PL_WAITDIALTONE 0x02 /* waiting for dialtone */ #define PL_DIALTONE 0x03 /* dialtone */ #define PL_DIALLING 0x04 /* tone or pulsing */ #define PL_HOOKFLASH 0x05 /* generate hook flash */ #define PL_WAITRINGBACK 0x06 /* dialling complete */ #define PL_RINGBACK 0x07 /* ringback detected */ #define PL_BADTONESTATE 0x08 /* busy or congestion */ #define PL_CONNECTED 0x09 /* call complete */ #define PL_ONHOLD 0x0A /* call on hold */ /* p_resource */ #define PR_DIALER 0x01 /* line owns dialer */ #define PR_MODEM 0x02 /* line owns modem */ /* p_hookstatus */ #define PH_OPENED 0x00 /* onhook */ #define PH_CLOSED 0xff /* offhook */ /* p_setstatus */ #define PS_MESSAGE 0x01 /* message waiting */ #define PS_SETOFFHOOK 0x02 /* handset offhook */ #define PS_INCRING 0x04 /* incoming ring detcd */ #define PS_TONEMASK 0xf0 /* mask for tone */ #define PS_DIALTONE 0x10 /* dialtone detected */ #define PS_BUSYTONE 0x20 /* busy tone */ #define PS_CONGTONE 0x40 /* congestion tone */ #define PS_RGBKTONE 0x80 /* ringback tone */ struct phdef { char p_flags; /* state and param info */ char p_statemch; /* line contrl state machine */ char p_resource; /* resource owned by the line */ char p_digit; /* current digit being dialed */ char p_hookstatus; /* status of hook relay */ char p_ringdetected; /* YES if ring detected and */ /* reported. */ char p_ringcnt; /* used to count ring cycles */ char p_waitdialtone; /* wait for dialtone in sec */ ushort p_linestatus; /* status of line and tone */ ushort p_waitflash; /* flash duration in msec */ ushort *p_hookrelay; /* pointer to hook relay */ ushort *p_aleadrelay; /* pointer to a-lead relay */ ushort *p_holdrelay; /* pointer to hold relay */ struct proc *p_procp; /* pointer to owner process */ struct tty *p_tp; /* tty pointer */ int p_lineparam; /* user specified line control */ }; struct progdef { char p_state; /* IDLE AND ACTIVE */ char p_waittone; /* tone to wait for */ char p_gottone; /* actual tone detected */ char p_levelchg; /* number of energy trasitions */ ushort p_tickcount; /* not to exceed p_timeout */ ushort p_timeout; /* 60 hz ticks, return error */ }; /* ------------------------------------------------------------------------- | modem control parameters | ------------------------------------------------------------------------- */ #define MDOPEN 0x01 /* modem in use */ #define MDINCMNG 0x02 /* modem will answer incoming calls */ #define MDOUTGO 0x04 /* modem is used for outgoing */ struct mddef { char m_flags; /* state and param info */ char m_phnline; /* current user of the modem */ char m_state; /* modem state machine */ char m_timeout; /* timeout count */ struct tty *m_tp; /* pointer to tty struct */ }; /* ------------------------------------------------------------------------- | dial network control structure | ------------------------------------------------------------------------- */ #define DN_OPEN 0x01 /* dialer in use */ #define DN_FEEDBK 0x02 /* speaker used for monitoring */ #define DN_SOFT 0x04 /* soft speaker volume */ #define DN_NORMAL 0x08 /* normal speaker volume */ #define DN_LOUD 0x0c /* loud speaker volume */ #define DN_CASS 0x10 /* allow cassette voice path */ struct dndef { char d_flags; /* state and param info */ char d_phnline; /* current user of dialer */ ushort d_lastcmd; /* copy of the last control word*/ ushort d_feedback; /* dial network control */ }; 0707070000020024641006660001460001440000010314270352172560500001400000006065sys/phone.h/* USER LEVEL PHONE IOCTL STRUCTURE */ /* ioctl commands */ #define PIOC ('P'<<8) #define PIOCGETP (PIOC|1) /* get phone line params */ #define PIOCSETP (PIOC|2) /* set phone line params */ #define PIOCOFFHOOK (PIOC|3) /* start call, go offhook */ #define PIOCDIAL (PIOC|4) /* dialling of digits */ #define PIOCFLASH (PIOC|5) /* flash the line */ #define PIOCDISC (PIOC|6) /* disconnect the line */ #define PIOCHOLD (PIOC|7) /* put the line on hold */ #define PIOCUNHOLD (PIOC|8) /* reconnect the line */ /* device files */ #define PHDEV "/dev/ph" /* phone line devices */ struct updata /* user parameter */ { char c_lineparam; /* set line states */ char c_waitdialtone; /* timeout value */ ushort c_linestatus; /* line status, read only.*/ ushort c_feedback; /* controls dialer */ ushort c_waitflash; /* duration of flash */ }; /* c_lineparam, sets the line usage and dial methods */ #define VOICE 0x01 /* indicate voice only */ #define DATA 0x02 /* mutually exclusive with voice*/ #define DTMF 0x04 /* use DTMF only */ #define PULSE 0x08 /* use pulse only, if both bits */ /* are set, DTMF will be tried */ /* first, then pulse. */ #define INCMNG 0x10 /* set to accept incoming call */ /* if not set in voice mode, */ /* ringing will be ignored. */ #define BAUD1200 0x00 /* specifies the outgoing speed */ #define BAUD300 0x20 /* 1200 and 300 baud. Used only */ /* in conjuction with data mode */ /* c_waitdialtone, if dialtone is not detected within this time, */ /* dial function will return with an error. In unit of seconds. */ /* c_linestatus, this is read only and is ignored on PIOCSET. */ /* This provides status on call progress, message wait, line */ /* ringing. */ #define MESSAGE 0x0001 /* message waiting detected */ #define SETOFFHOOK 0x0002 /* handset in cradle or not */ #define INCOMERING 0x0004 /* incoming ringin detected */ #define NOTONE 0x0008 /* silence on the line */ #define DIALTONE 0x0010 /* dialtone detected */ #define BUSYTONE 0x0020 /* busytone detected */ #define CONGTONE 0x0040 /* congestion tone detected */ #define RGBKTONE 0x0080 /* ringback tone detected */ /* c_feedback, sets the options for monitoring call on the */ /* speaker. */ #define SPEAKERON 0x0001 /* use for outgoing calls, if */ /* speaker on is set, line is */ /* monitored on the speaker. */ #define SOFTSPK 0x0002 /* speaker volume control */ #define NORMSPK 0x0004 #define LOUDSPK 0x0006 #define RINGON 0x0010 /* use for incoming calls, if */ /* ringon is set, incoming call */ /* will generate ringing on the */ /* speaker; for voice only. */ #define SOFTRNG 0x0020 /* ring volume */ #define NORMRNG 0x0040 #define LOUDRNG 0x0060 #define LOWRNG 0x0100 /* ringing tone for incoming */ #define MEDRNG 0x0200 /* calls. */ #define HIRNG 0x0300 /* c_hookflash, specifies the down time of the hook switch */ /* during a hookflash operation. In units of milliseconds. */ struct uddata /* user dialling data */ { char dd_digit; /* digit to be dialed */ }; 0707070000020024651006660001460001440000010314330352172560600001300000012643sys/proc.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)proc.h 1.3" */ #ifndef proc_h #define proc_h #include #include #include #include #include /* fork types - parameter to newproc */ #define KFORK 0 /* original kernel call of newproc */ #define OFORK 1 /* original sys1 call of newproc */ /* #define VFORK 2 /* vfork call of newproc */ /* * 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 proc { struct proc *p_link; /* linked list of running processes */ int p_flag; char p_stat; char p_pri; /* priority, negative is high */ char p_time; /* resident time for scheduling */ char p_cpu; /* cpu usage for scheduling */ char p_nice; /* nice for cpu usage */ char p_szpt; /* 0 - 1 page user tbl, 1 - 2 page user tbl */ char p_usrpri; /* user-priority based on p_cpu and p_nice */ char p_slptime; /* time since last block */ ushort p_uid; /* real user id */ ushort p_suid; /* set (effective) user id */ short p_pgrp; /* name of process group leader */ short p_pid; /* unique process id */ short p_ppid; /* process id of parent */ ushort p_addr[2]; /* physical page no of u-area */ struct proc *p_pptr; /* pointer to process structure of parent */ swblk_t p_swaddr; /* disk address of u area when swapped */ size_t p_tsize; /* size of text (clicks)(used by exec/swapin) */ size_t p_ssize; /* size of stack(clicks)(used by exec/swapin) */ size_t p_dsize; /* size of data space (clicks) */ size_t p_tpage; /* no of pages(rounded to segment) of text */ size_t p_dpage; /* no of pages(rounded to segment) of data */ size_t p_spage; /* no of pages(rounded to segment) of stack */ size_t p_rssize; /* current resident set size in clicks */ size_t p_maxrss; /* copy of u.u_limit[MAXRSS] */ size_t p_swrss; /* resident set size before last swap */ long p_sig; /* signals pending to this process */ union { caddr_t p_cad; /* event process is awaiting */ int p_int; } p_unw; #define p_wchan p_unw.p_cad #define p_arg p_unw.p_int struct text *p_textp; /* pointer to text structure */ struct proc *p_xlink; /* linked list of procs sharing same text */ int p_clktim; /* time to alarm clock signal */ struct shmpt_ds *p_smbeg; /* beginning pte entry for shared memory */ int p_smend; /* ending pte entry for shared memory */ short p_ndx; /* proc index for memall (because of vfork) */ ushort p_xino; /* disk inode no for the text file - extension from cmap structure. */ short p_poip; /* count of page outs in progress */ }; #ifdef KERNEL extern struct proc proc[]; /* the proc table itself */ #endif /* stat codes */ #define SSLEEP 1 /* awaiting an event */ #define SWAIT 2 /* (abandoned state) */ #define SRUN 3 /* running */ #define SIDL 4 /* intermediate state in process creation */ #define SZOMB 5 /* intermediate state in process termination */ #define SSTOP 6 /* process being traced */ #define SXBRK 7 /* process being xswapped */ #define SXSTK 8 /* process being xswapped */ #define SXTXT 9 /* process being xswapped */ /* flag codes */ #define SLOAD 0x000001 /* in core */ #define SSYS 0x000002 /* swapper or pager process */ #define SLOCK 0x000004 /* process being swapped out */ #define SSWAP 0x000008 /* save area flag */ #define STRC 0x000010 /* process is being traced */ #define SWTED 0x000020 /* another tracing flag */ #ifdef SWAP #define STEXT 0100 /* text pointer valid */ #define SSPART 0200 /* process is partially swapped out */ #else #define SULOCK 0x000040 /* prevent a user process to be swapped out */ #define SPAGE 0x000080 /* process in page wait state */ #define SKEEP 0x000100 /* another flag to prevent swap out */ #define SDLYU 0x000200 /* delayed unlock of pages */ #define SWEXIT 0x000400 /* working on exiting */ #define SPHYSIO 0x000800 /* doing physical i/o (bio.c) */ #ifdef VFORK #define SVFORK 0x001000 /* process resulted from vfork() */ #define SVFDONE 0x002000 /* another vfork flag */ #define SNOVM 0x004000 /* no vm, parent in a vfork() */ #endif VFORK #define SPAGI 0x008000 /* init data space on demand, from inode */ #define SSEQL 0x010000 /* user warned of sequential vm behavior */ #define SUANOM 0x020000 /* user warned of random vm behavior */ #define STIMO 0x040000 /* timing out during sleep */ #define SDETACH 0x080000 /* detached inherited by init */ #define SOWEUPC 0x200000 /* owe process an addupc() call at next ast */ #endif /* * parallel proc structure * to replace part with times * to be passed to parent process * in ZOMBIE state. */ #ifndef NPROC struct xproc { struct proc *xp_link; /* linked list of running processes */ int xp_flag; char xp_stat; char xp_pri; /* priority, negative is high */ char xp_time; /* resident time for scheduling */ char xp_cpu; /* cpu usage for scheduling */ char xp_nice; /* nice for cpu usage */ char xp_szpt; char xp_usrpri; char xp_slptime; ushort xp_uid; /* real user id */ ushort xp_suid; /* set (effective) user id */ short xp_pgrp; /* name of process group leader */ short xp_pid; /* unique process id */ short xp_ppid; /* process id of parent */ ushort xp_addr[2]; struct proc *xp_pptr; /* pointer to process structure of parent */ short xp_xstat; /* Exit status for wait */ time_t xp_utime; /* user time, this proc */ time_t xp_stime; /* system time, this proc */ struct vtimes xp_vm; }; #endif #endif 0707070000020024661006660001460001440000010314410352172560700001200000013617sys/pte.h/* Convergent Technologies - System V - Jun 1983 */ /* "@(#)pte.h 1.1" */ #ifndef pte_h #define pte_h #include /* * Incore 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. */ /* The format of a pte in the map */ struct pte { ushort pt_wp:1, /* write permission */ pt_acc:2, /* access status */ :4, /* non h/w flags */ pt_pfnum:9; /* core page frame number */ }; /* The format of a pte in memory (our RAM) */ struct mpte { unsigned int pg_ipte:16, /* index of hardware pte */ pt_wp:1, /* write permission */ pg_acc:2, /* access control */ pg_fod:1, /* is fill on demand (=0) */ pg_swapm:1, /* have to write back to swap */ pg_vreadm:1, /* modified since vread (or with _m) */ pg_pageo:1, /* page is being paged out */ pg_pfnum:9; /* core page frame number or 0 */ }; struct fpte { unsigned int pg_blkno:16, /* file system block number */ pt_wp:1, /* write permission */ pg_acc:2, /* access control */ pg_fod:1, /* is fill on demand (=0) */ pg_swapm:1, /* have to write back to swap */ pg_vreadm:1, /* modified since vread (or with _m) */ pg_pageo:1, /* page is being paged out */ pg_last:1, /* last data page */ pg_lastsec:2, /* disk sectors in the last data page*/ :1, pg_fileno:5; /* file no for the page */ }; #define PG_PROT ((ushort)0x00008000) #define PG_STAT ((ushort)0x00006000) #define PG_STA_SHFT 13 /* shift to get usage field */ #define PG_ACC ((ushort)0x00004000) #define PG_V ((ushort)0x00002000) #define PG_M ((ushort)0x00006000) #define PG_FOD ((ushort)0x00001000) #define PG_VREADM ((ushort)0x00000400) #define PG_PFNUM ((ushort)0x000001ff) #define PG_FZERO (NOFILE) #define PG_FTEXT (NOFILE+1) #define PG_FMAX (PG_FTEXT) /* * Pte related macros */ #define dirty(pte) ((pte)->pg_fod == 0 && (pte)->pg_pfnum && (pte)->pg_swapm) #ifdef mega #define pgaccess(pte) (*(unsigned short *)(PG_BASE+(pte)->pg_ipte) & PG_STAT == PG_ACC) #define setpgvalid(pte) (*(unsigned short *)(PG_BASE+(pte)->pg_ipte) = (pte)->pg_pfnum | PG_V) #endif #define setpginvalid(hpte) ((hpte)->pt_acc = 0) #define pagevalid(hpte) ((hpte)->pt_acc != 0) #define reference(hpte) (*(unsigned short *)(hpte) & (unsigned short) PG_ACC) #define resetref(hpte) (*(unsigned short *)(hpte) = (*(unsigned short *)(hpte) & (~PG_STAT)) | PG_V) #define modified(hpte) ((*(unsigned short *)(hpte) & PG_STAT) == PG_M) /* * The following variables are defined in end.s and start.s */ extern unsigned long cmaptmp; extern unsigned long ecmaptmp; extern unsigned long eend; extern unsigned long freemem; extern unsigned long ncmaptmp; extern struct pte *ptefork; extern struct pte *ptemutl; extern struct pte *pteswp1; extern struct pte *pteswp2; extern struct pte *ptetmp1; extern struct pte *ptetmp2; extern struct pte *ptevfutl; extern struct pte *mmpte; extern ushort epg; extern ushort epgdata; extern ushort epgtext; extern ushort esg; extern ushort esgdata; extern ushort esgtext; extern ushort upg; extern ushort usg; extern ushort usrcore; struct vaddress { unsigned v_region:2, /* Region of memory(ram,map+regs,rom,i/o) */ v_vpn:10, /* Virtual page number */ v_byte:12; /* Byte within the page */ }; /* Definition of a physical address. */ struct paddress { unsigned p_mbz:11, /* Must be zero */ p_pfn:9, /* Page frame number */ p_byte:12; /* Byte within the page */ }; /* Memory mapping hardware */ #define PG_BASE ((unsigned short *)0x400000) /* address of page table */ #define USER_MAP (unsigned short *)(0x400100) /* address of user part of page table */ #define MAP_TOP (unsigned short *)(0x400800 - 2*KVMEM_VPAGES) /* address past end of memory map */ #define DMA_MAP (unsigned short *)(0x4000c0) /* Disk dma uses segment 6 for i/o */ #define DMA_XFR_ADR 0x60000 /* virtual address corresponding to DMA_MAP */ #define DMA_UPTR (unsigned short *)(0x4000dc) /* Disk dma pte's to access U page */ #define UPTE ((unsigned short *)0x4000E0) /* address of UPAGE pte */ /* Page table entry. * WE bit 15 =1 user can write page, =0 user can read page * USE bits 14-13 value 0=not present, 1=present, not accessed * value 2=accessed not written, 3=written to * PAGEADDR bits 8-0 PHYSADDR=(PAGEADDR*4096) + byte within page * STATES: * page not in memory: WE set as needed and rest=0 * page in memory: WE, PAGEADDR set as needed and USE non zero */ #define PROT_MASK ((ushort)0x8000) /* mask for write bit */ #define USE_MASK ((ushort)0x6000) /* mask for usage bits */ #define PG_MASK 0x1ff /* page address mask */ #define PG_WRITE ((ushort)0x8000) /* user write enable */ #define NO_PAGE 0x0 /* to initialize pte's */ #define PG_IN 0x7fff /* AND mask */ #define PG_PRESENT 0x2000 /* pte&USE_MASK page just in */ #define PG_NOT_DIRTY 0x4000 /* pte&USE_MASK = accessed */ #define PAGE_DIRTY 0x6000 /* pte&USE_MASK = written to */ #define P_ACCESS_CHECK 0x6000 /* AND mask */ #define NO_ACCESS 0 #define TOTAL_PTES 1024 #define TOTAL_PAGES 1024 #define PAGES_IN_PROC 1024-KVMEM_PAGES /* leave out slow memory */ #define BYTES_PER_PAGE 0x1000 #define PAGESHIFT 12 /* gets page number from addr */ /* 4 Mbyte logical address space */ #define MAX_MEM 0x400000 /* 2 Mbyte physical address space */ #define MAX_PHYS_MEM 0x200000 #define PAGES_PER_SEG 16 /* needed to correspond to megaframe rounding */ #define USRSIZE 4096 /* size of usrtbl (upage) in bytes */ #define SEGSIZE 0x10000 /* size of a segment */ /* some defines that lie about some things */ #define SEGS_PER_PROC 64 /* miniframe doesn't have segments */ #define SEGSHIFT 4 /* seg to page */ #define PG_KR 0 /* the kernel can read anything */ #define PG_KW 0 /* the kernel can write to anything */ #endif pte_h 0707070000020024671006660001460001440000010314470352172561000001200000002662sys/reg.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)reg.h 1.1" */ #ifndef reg_h #define reg_h #include /* * Location of the users' stored registers relative to R0. * Usage is u.u_ar0[XX]. */ #define R0 (0) #define R1 (1) #define R2 (2) #define R3 (3) #define R4 (4) #define R5 (5) #define R6 (6) #define R7 (7) #define AR0 (8) #define AR1 (9) #define AR2 (10) #define AR3 (11) #define AR4 (12) #define AR5 (13) #define AR6 (14) #define AR7 (15) #define SP (15) #define PC (17) #define RPS (16) #define VECTOR (18) /* vector offset + flag in MS 16 bits special status word in LS 16 bits */ #define EV_FLTADR (19) /* fault address */ #define EV_DOPBF (20) /* data output buffer in LS 16 bits */ #define EV_DIPBF (21) /* data input buffer in LS 16 bits */ #define EV_IIPBF (22) /* instruction input buffer */ #define EV_LNGFRMT 0x80000000 /* 1= long format */ /* bits in special status word of the long format exception stack frame */ #define EV_RR 0x8000 /* rerun flag 0=processor rerun 1=s/w rerun */ #define EV_IF 0x2000 /* instruction fetch */ #define EV_DF 0x1000 /* data fetch to data input buffer */ #define EV_RM 0x0800 /* read-modify-write cycle */ #define EV_HB 0x0400 /* high byte transfer (valid if BY set) */ #define EV_BY 0x0200 /* BY=1 byte xfr else word */ #define EV_RW 0x0100 /* read/write 0=write 1=read */ #define EV_FC 0x0007 /* fc2-0 */ #define TBIT 0100000 /* PS trace bit */ #endif 0707070000020024701006660001460001440000010314510352172561000001200000003171sys/rtc.h/* Convergent Technologies - System V - June 1983 */ /* "@(#)rtc.h 1.0" */ /* real time clock */ #include /* */ /* REAL TIME CLOCK TC8250P */ /* WRITE MODE */ /* Uses upper byte of I/O address 0x480000 */ /* Upper 4 bits used to control chip operation */ /* Lower 4 bits used for internal chip addressing and I/O data */ #define RTC_WRITE_ADDR ((unsigned short *)0x480000) /* RTC write address */ #define RTCCE 0x8000 /*1=real clock chip select*/ #define RTCALE 0x4000 /*1= RTC address latch enable */ #define RTCRW 0x2000 /*1= RTC write enable, 0=read enable */ #define RTCDE 0x1000 /*0= RTC write data enable */ /* READ MODE */ /* Uses lower byte of I/O address 0xe30000 */ /* Uses lowest 4 bits only(D0-3)*/ #define RTC_READ_ADDR ((unsigned short *)0xe30000) /* RTC read addr */ /* ADDRESS MODES */ #define ONE_SEC_DIGT 0x0000 /* 1 sec digit */ #define TEN_SEC_DIGT 0x0100 /* 10 sec digit */ #define ONE_MIN_DIGT 0x0200 /* 1 minute digit */ #define TEN_MIN_DIGT 0x0300 /* 10 minutes digit */ #define ONE_HR_DIGT 0x0400 /* 1 hour digit */ #define TEN_HR_DIGT 0x0500 /* 10 hours digit */ #define ONE_DAY_DIGT 0x0600 /* 1 day digit */ #define TEN_DAY_DIGT 0x0700 /* 10 days digit */ #define ONE_MNTH_DIGT 0x0800 /* 1 month digit */ #define TEN_MNTH_DIGT 0x0900 /* 10 month digit */ #define ONE_YR_DIGT 0x0a00 /* 1 year digit */ #define TEN_YR_DIGT 0x0b00 /* 10 year digit */ #define WEEK_DAY 0x0c00 /* day of the week */ #define TOUT_CONTROL 0x0d00 /* Tout control */ #define PROTECT_KEY 0x0e00 /* protection key */ #define RTC_STATUS 0x0f00 /* real time clock status */ 0707070000020024711006660001460001440000010314530352172561100001200000005071sys/sem.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)sem.h 1.3" */ #ifndef sem_h #define sem_h #include "sys/ipc.h" /* ** IPC Semaphore Facility. */ /* ** Implementation Constants. */ #define PSEMN (PZERO + 3) /* sleep priority waiting for greater value */ #define PSEMZ (PZERO + 2) /* sleep priority waiting for zero */ /* ** Permission Definitions. */ #define SEM_A 0200 /* alter permission */ #define SEM_R 0400 /* read permission */ /* ** Semaphore Operation Flags. */ #define SEM_UNDO 010000 /* set up adjust on exit entry */ /* ** Semctl Command Definitions. */ #define GETNCNT 3 /* get semncnt */ #define GETPID 4 /* get sempid */ #define GETVAL 5 /* get semval */ #define GETALL 6 /* get all semval's */ #define GETZCNT 7 /* get semzcnt */ #define SETVAL 8 /* set semval */ #define SETALL 9 /* set all semval's */ /* ** Structure Definitions. */ /* ** There is one semaphore id data structure for each set of semaphores ** in the system. */ struct semid_ds { struct ipc_perm sem_perm; /* operation permission struct */ struct sem *sem_base; /* ptr to first semaphore in set */ ushort sem_nsems; /* # of semaphores in set */ time_t sem_otime; /* last semop time */ time_t sem_ctime; /* last change time */ }; /* ** There is one semaphore structure for each semaphore in the system. */ struct sem { ushort semval; /* semaphore text map address */ short sempid; /* pid of last operation */ ushort semncnt; /* # awaiting semval > cval */ ushort semzcnt; /* # awaiting semval = 0 */ }; /* ** There is one undo structure per process in the system. */ struct sem_undo { struct sem_undo *un_np; /* ptr to next active undo structure */ short un_cnt; /* # of active entries */ struct undo { short un_aoe; /* adjust on exit values */ short un_num; /* semaphore # */ int un_id; /* semid */ } un_ent[1]; /* undo entries (one minimum) */ }; /* ** semaphore information structure */ struct seminfo { int semmap, /* # of entries in semaphore map */ semmni, /* # of semaphore identifiers */ semmns, /* # of semaphores in system */ semmnu, /* # of undo structures in system */ semmsl, /* max # of semaphores per id */ semopm, /* max # of operations per semop call */ semume, /* max # of undo entries per process */ semusz, /* size in bytes of undo structure */ semvmx, /* semaphore maximum value */ semaem; /* adjust on exit max value */ }; /* ** User semaphore template for semop system calls. */ struct sembuf { ushort sem_num; /* semaphore # */ short sem_op; /* semaphore operation */ short sem_flg; /* operation flags */ }; #endif sem_h 0707070000020024721006660001460001440000010314560352172561100001200000005503sys/shm.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)shm.h 1.3" */ #ifndef shm_h #define shm_h #include "sys/ipc.h" #include "sys/pte.h" /* ** IPC Shared Memory Facility. */ /* ** Implementation Constants. */ #define SHMLBA (BYTES_PER_PAGE * PAGES_PER_SEG) /* segment low boundary address multiple */ /* (SHMLBA must be a power of 2) */ /* ** Permission Definitions. */ #define SHM_R 0400 /* read permission */ #define SHM_W 0200 /* write permission */ /* ** ipc_perm Mode Definitions. */ #define SHM_CLEAR 01000 /* clear segment on next attach */ #define SHM_DEST 02000 /* destroy segment when # attached = 0 */ /* ** Message Operation Flags. */ #define SHM_RDONLY 010000 /* attach read-only (else read-write) */ #define SHM_RND 020000 /* round attach address to SHMLBA */ /* ** Structure Definitions. */ /* ** There is a shared mem id data structure for each segment in the system. ** These structs form shmem[] array, and are pointed to from shm_shmem[]. ** The word "segment" above meant a piece of shared memory. ** Shared memory, and its page table entries and map thereto, are locked ** into memory (unless, perhaps, all users are currently swapped?). ** The page table entries are managed by an in-core copy in the area ** provided by shmmpte[], using a map (via rmap()) in shmmap[]. */ struct shmid_ds { struct ipc_perm shm_perm; /* operation permission struct */ int shm_segsz; /* segment size */ struct mpte *shm_ptbl; /* ptr to associated page table */ ushort shm_lpid; /* pid of last shmop */ ushort shm_cpid; /* pid of creator */ ushort shm_nattch; /* current # attached */ time_t shm_atime; /* last shmat time */ time_t shm_dtime; /* last shmdt time */ time_t shm_ctime; /* last change time */ }; /* ** Shared memory page table descriptors, used to form shm_pte[] array. ** Array shm_pte[] contains fixed number available per-process, ** and active elements are chained together off p->p_smbeg, via ** the shm_link member, in increasing order of the shm_sgbegin ** segment #, to allow shmat() to do first fit easily. */ struct shmpt_ds { struct shmpt_ds *shm_link; /* links for the shared memory used by a process */ unsigned char shm_sflg; /* R/W permission on segment */ unsigned char shm_index; /* index into shmem */ ushort shm_sgbegin; /* beginning virtual page number */ }; /* values for shm_sflg */ #define SHMPT_R 0x1 #define SHMPT_W 0x2 /* ** One shminfo struct per system, with standard System V shared memory ** parameters. */ struct shminfo { int shmmax, /* max shared memory segment size */ shmmin, /* min shared memory segment size */ shmmni, /* # of shared memory identifiers */ shmseg, /* max attached shared memory segments per process */ shmbrk, /* gap (in clicks) used between data and shared memory */ shmall; /* max total shared memory system wide (in clicks) */ }; #endif shm_h 0707070000020024731006660001460001440000010314610352172561200001500000002341sys/signal.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)signal.h 1.2" */ #ifndef signal_h #define signal_h #define SIGHUP 1 /* hangup */ #define SIGINT 2 /* interrupt (rubout) */ #define SIGQUIT 3 /* quit (ASCII FS) */ #define SIGILL 4 /* illegal instruction (not reset when caught)*/ #define SIGTRAP 5 /* trace trap (not reset when caught) */ #define SIGIOT 6 /* IOT instruction */ #define SIGEMT 7 /* EMT instruction */ #define SIGFPE 8 /* floating point exception */ #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 SIGUSR1 16 /* user defined signal 1 */ #define SIGUSR2 17 /* user defined signal 2 */ #define SIGCLD 18 /* death of a child */ #define SIGPWR 19 /* power-fail restart */ #define SIGWIND 20 /* window change */ #define SIGPHONE 21 /* handset, line status change */ #define NSIG 32 #define SIG_DFL (int (*)())0 #if lint #define SIG_IGN (int (*)())0 #else #define SIG_IGN (int (*)())1 #endif #endif signal_h 0707070000020024741006660001460001440000010314630352172561200001400000021015sys/space.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)space.h 1.12" */ #ifndef space_h #define space_h /* #define KERNEL */ #include #include "sys/acct.h" struct acct acctbuf; struct inode *acctp; #include "sys/tty.h" struct cblock cfree[NCLIST]; #include "sys/buf.h" struct buf buf[NBUF]; /* buffer headers */ char buffers [NBUF][BSIZE] = "Copyright 1983, Convergent Technologies, Inc. \ Licensed Material, Property of \ Convergent Technologies, Inc. \ All Rights Reserved."; struct buf bfreelist; /* head of the free list of buffers */ struct pfree pfreelist; /* Head of physio header pool */ struct buf pbuf[NPBUF]; /* Physical io header pool */ int nbuf = NPBUF; struct buf swbuf[NSWBUF]; int swpf [NSWBUF]; short swsize [NSWBUF]; int nswbuf = NSWBUF; struct buf bswlist; struct buf *bclnlist; struct hbuf hbuf[NHBUF]; /* buffer hash table */ #include "sys/file.h" struct file file[NFILE]; /* file table */ #include "sys/inode.h" struct inode inode[NINODE]; /* inode table */ #ifdef LOCKF struct locklist locklist[NFLOCKS]; short nflocks = NFLOCKS; #endif LOCKF #include "sys/proc.h" struct proc proc[NPROC]; /* process table */ #include "sys/text.h" struct text text[NTEXT]; /* text table */ #include "sys/map.h" struct map swapmap[SMAPSIZ]; #ifdef mc68k struct map argmap[ARGMAPSIZE]; int nswapmap = SMAPSIZ; #endif mc68k #include "sys/callo.h" struct callo callout[NCALL]; struct callo fcallout[NCALL]; #include "sys/mount.h" struct mount mount[NMOUNT]; #include "sys/elog.h" #include "sys/err.h" #include "sys/erec.h" struct err err = { NESLOT, }; #include "sys/sysinfo.h" struct sysinfo sysinfo; struct syswait syswait; struct syserr syserr; #include "sys/opt.h" #include "sys/var.h" struct var v = { NBUF, NCALL, NINODE, (char *)(&inode[NINODE]), NFILE, (char *)(&file[NFILE]), NMOUNT, (char *)(&mount[NMOUNT]), NPROC, (char *)(&proc[2]), NTEXT, (char *)(&text[NTEXT]), NCLIST, NSABUF, MAXUP, SMAPSIZ, NHBUF, NHBUF-1, NPBUF, }; #include "sys/init.h" #ifndef PRF_0 prfintr() {} unsigned prfstat; #endif #ifdef VP_0 #include "sys/vp.h" #endif #ifdef DISK_0 #ifndef DISK_1 #define DISK_1 0 #endif #ifndef DISK_2 #define DISK_2 0 #endif #ifndef DISK_3 #define DISK_3 0 #endif #include "sys/iobuf.h" #include "sys/gdisk.h" /* MiniFrame general disk driver global variables */ char gdhdbbq[HDMAXCYL], gdsybbq[SYMAXCYL]; struct bbmcell gdhdbb[HDMAXBADBLK], gdsybb[SYMAXBADBLK]; extern ghdintr(), ghdstart(); extern gfpintr(), gfpstart(); struct gdswprt gddefault = { "Deflt",1,1,4,4,FPDENSITY,2,512}; /* sufficient to load vhb+bbt */ struct gdsw gdsw[] = { { 0,{"WIN", 1023, 4, 17, 68,0, 0, 512}, -1,0,16, 1023*16,40, ghdintr, ghdstart, HDMAXCYL, HDMAXBADBLK, gdhdbbq, gdhdbb,0}, { 0,{"SYQ", 306, 2, 17, 34,0, 0, 512}, -1,0,16, 306*16,40, ghdintr, ghdstart, SYMAXCYL, SYMAXBADBLK, gdsybbq, gdsybb,0}, { 0,{"FD", 80, 2, 8, 16,2, 0, 512}, -1,0,8, 80*8,60, gfpintr, gfpstart, FPMAXCYL, FPMAXBADBLK, NULL, NULL,0} }; struct iobuf gdutab[DISKS]; struct iobuf gdtab; struct iotime gdstat[DISKS]; struct driver gdreal; int gd_cnt = DISK_0; /* 1 general disk controller for HD SY FD */ char gdourunflg = 0; /* disk dma over/under run flag */ #endif #ifdef TRACE_0 #include "sys/trace.h" struct trace trace[TRACE_0]; #endif #ifdef CSI_0 #include "sys/csi.h" #include "sys/csihdw.h" struct csi csi_csi[CSI_0]; int csibnum = CSIBNUM; struct csibuf *csibpt[CSIBNUM]; #endif #ifdef PCL11B_0 #include "sys/pcl.h" #endif #if MESG==1 #include "sys/ipc.h" #include "sys/msg.h" struct map msgmap[MSGMAP]; struct msqid_ds msgque[MSGMNI]; struct msg msgh[MSGTQL]; char msgbuf[MSGSEG*MSGSSZ]; struct msginfo msginfo = { MSGMAP, MSGMAX, MSGMNB, MSGMNI, MSGSSZ, MSGTQL, MSGSEG }; #endif #if SEMA==1 # ifndef IPC_ALLOC # include "sys/ipc.h" # endif #include "sys/sem.h" struct semid_ds sema[SEMMNI]; struct sem sem[SEMMNS]; struct map semmap[SEMMAP]; struct sem_undo *sem_undo[NPROC]; #define SEMUSZ (sizeof(struct sem_undo)+sizeof(struct undo)*SEMUME) /* each undo struct is SEMUSZ bytes long */ unsigned char semu[SEMUSZ*SEMMNU]; union { short semvals[SEMMSL]; struct semid_ds ds; struct sembuf semops[SEMOPM]; } semtmp; struct seminfo seminfo = { SEMMAP, SEMMNI, SEMMNS, SEMMNU, SEMMSL, SEMOPM, SEMUME, SEMUSZ, SEMVMX, SEMAEM }; #endif #if SHMEM==1 # ifndef IPC_ALLOC # include "sys/ipc.h" # endif #include "sys/shm.h" struct shmid_ds shmem[SHMMNI]; struct shmpt_ds shm_pte[NPROC*SHMSEG]; struct shminfo shminfo = { SHMMAX, SHMMIN, SHMMNI, SHMSEG, SHMBRK, SHMALL }; struct map shmmap[SHMMAPSIZE]; struct mpte shmmpte[SHMALL]; /* page table entries */ #endif #ifdef NSC_0 #include "sys/nscdev.h" #endif #ifdef ST_0 #include "sys/st.h" struct stbhdr stihdrb[STIHBUF]; struct stbhdr stohdrb[STOHBUF]; struct ststat ststat = { STIBSZ, /* input buffer size */ STOBSZ, /* output buffer size */ STIHBUF, /* # of buffer headers */ STOHBUF, /* # of buffer headers */ STNPRNT /* # of printer channels */ }; #endif /* data associated with the low level RS-232 input routine in ml/i8274.s */ #include "sys/iohw.h" #include "sys/i8274.h" struct device sertty0 = { 0, NULL, A_CMND_ADDR, A_DATA_ADDR, A_CMND_ADDR, 0,0,0,0,0,0,A_BAUD_ADDR,SEL_A_BAUD }; /* this 8274 port used for the modem, always the last one in ser_addr[] */ struct device sermod0 = { 0, NULL, D_CMND_ADDR, D_DATA_ADDR, C_CMND_ADDR, 0,0,0,0,0,0,D_BAUD_ADDR,SEL_D_BAUD }; struct device *ser_addr[] = { &sertty0, &sermod0 }; #define SZSERBUF (NSERBUF) unsigned short serbuf[SZSERBUF]; unsigned short *inptr = serbuf; /* addr of next char to put in buffer */ unsigned short *outptr = serbuf; /* address of next char to take from buffer */ int serbufcnt = 0; /* count of characters in buffer */ int serbufful = SZSERBUF; /* max characters that can be put in buffer */ #ifdef LATER int serhiwater = (SZSERBUF - (I8274_0 * 2*SERHI)); /*hi water mark, when serbufcnt exceeds -xoff */ int serlowater = ((SZSERBUF / 4) * 1); /*low water mark, when serbufcnt falls below -xon */ char serrqstxoff = 0; /* RX requests TX to send XOFF */ #endif char serxoff = 0; /* XOFF from RX blocking TX */ char serinprogress = 0; /* =1 means C serrint is running */ char serinxoff = 0; /* received XOFF blocking TX */ char sertxblkd = 0; /* received XOFF should restart TX */ char sercd = 0; /* state of CD for each line */ char sercts = 0; /* state of CTS for each line */ char serixon = 0; /* state of ixon for each line */ unsigned short *eserbuf = &serbuf[SZSERBUF]; /* first address past end of serbuf */ short ser_ports[1] = {0}; /* preserves extended control bits per 8274 port */ int ser_cnt = 1; /* how many serial ports */ struct tty ser_tty[2] = {0}; /* modem uses the tty struct one above ser_cnt. */ #if !LATER int pwr_cnt = 0; int pwr_act = 0; #endif #include "sys/ph.h" #include "sys/dialer.h" short int DTMFpad[] = { kDIGIT0, kDIGIT1, kDIGIT2, kDIGIT3, kDIGIT4, kDIGIT5, kDIGIT6, kDIGIT7, kDIGIT8, kDIGIT9, kDIGAST, kDIGPND }; struct phdef phndef[] = { { 0,0,0,0,0,0,0,15,0,500,HOOK1_RELAY,A_LEAD1_RELAY, LINE1_ACTIVE, NULL, NULL, 0 }, { 0,0,0,0,0,0,0,15,0,500,HOOK2_RELAY,A_LEAD2_RELAY, LINE2_ACTIVE, NULL, NULL, 0 } }; /* structure for the 2 lines */ struct mddef moddef[1] = {0}; /* structure used for modem ctl */ struct dndef dnwdef[1] = {0}; /* structure for dial network */ struct mddef *mdptr = moddef; /* global pointer to modem struct */ struct dndef *dnptr = dnwdef; /* global pointer to dial struct */ ushort fcallprog= 0; /* true if monitoring call prog */ ushort telestat = 0; /* used for message wait and line */ /* 1 and 2 ringing. */ #include "sys/wd.h" struct windef windef[NWINDOWS]; struct tty wintty[NWINDOWS]; int win_cnt = NWINDOWS; struct wfont wfont[NSFONTS]; int fnt_cnt = NSFONTS; struct map fontmap[FMAPSIZE]; int fmapsize= FMAPSIZE; int fmemsize= FMEMSIZE; struct oldef olheap[NOL]; int ol_cnt = NOL; struct map pxmap[PXMAPSIZE]; int pxmapsize= PXMAPSIZE; int pxmemsize= PXMEMSIZE; /* Virtual Space */ #define VFONT /* put fonts in virtual space */ #define PXMEM (btopxc(KVMEM_VBASE)) #define WTXTMEM (btopxc(PXMEM+PXMEMSIZE)) #define WTXTSIZE (NWINDOWS*WTXTNUM*WTXTLEN) #ifdef VFONT #define FONTMEM (btopxc(WTXTMEM+WTXTSIZE)) #define VTOTAL (PXMEMSIZE+FMEMSIZE+WTXTSIZE) #else #define VTOTAL (PXMEMSIZE+WTXTSIZE) #endif short *pxmem = (short *)PXMEM; char *wtxt = (char *)WTXTMEM; #ifdef VFONT char *fontmem = (char *)FONTMEM; #else char xfontmem[FMEMSIZE]; char *fontmem = xfontmem; #endif struct mpte kv_mpte[(VTOTAL+NBPC-1)>>BPCSHIFT]; int kv_pages = (VTOTAL+NBPC-1)>>BPCSHIFT; swblk_t kv_swap; #endif space_h 0707070000020024761006660001460001440000010314740352172561300001100000015252sys/st.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)st.h 1.2" */ #ifndef st_h #define st_h #include "sys/param.h" #define STCWAIT (HZ / 3) #define STFUDGE 16 #define NOSLP 0 #define STSP 36 #define SOH 0001 #define STX 0002 #define ETX 0003 #define EOT 0004 #define ENQ 0005 #define BEL 0007 #define DLE 0020 #define DC1 0021 #define DC2 0022 #define DC3 0023 #define NAK 0025 #define SYN 0026 #define ETB 0027 #define ESC 0033 #define GS 0035 #define EFLG 0200 /* invalid address character flag */ #define ROWLEN 80 /* columns per row */ #define ROWCNT 24 /* rows per screen */ struct strca { char a_row; char a_col; }; struct stbaa { char a_baddr1; char a_baddr2; }; #define MAXWCSZ 150 #define MAXRCSZ 100 #define MAXWRSZ 100 #define MAXRRSZ 150 #define BLKSZ 256 /* minimum XMT buffer size */ #define BLKFDG 64 /* block size fudge factor */ #define FAC ' ' /* field attribute character */ #define PT '\011' /* program tab order */ #define EWC '5' /* erase write command */ #define WC '1' /* write command */ #define WCC '3' /* write control character, no print */ #define PWCC '#' /* write control character, start printer */ #define NSTCHQ 8 /* size of user RCV queue */ #define NXSTCHQ 8 /* size of user reXMT queue */ /* * Synchronous terminal parameter structure. * Set up in space.h. */ struct ststat { unsigned ibsz; /* input buffer size */ unsigned obsz; /* output buffer size */ int ihbuf; /* # of input buffer headers */ int ohbuf; /* # of output buffer headers */ int nprnt; /* # of print channels */ }; /* * Message header structure. * One per outstanding message. Others on free chain. */ struct stbhdr { struct csibd sm_bd; /* buffer descriptors */ char sm_flags; /* buffer flags */ }; /* * sm_flags definitions. */ #define STRCV 1 /* receive buffer */ #define STXMT 2 /* transmit buffer */ #define STWAK 4 /* issue wakeup when buffer returned */ /* * sm_type definitions. */ #define FRVI 0x01 /* XMT failed, RVI'ed */ #define FNAK 0x02 /* XMT failed, NAK'ed */ #define FWAK 0x04 /* XMT failed, WAK'ed */ #define FTO 0x08 /* XMT failed, timed out */ #define FGBG 0x10 /* XMT failed, garbage response */ #define FEOT 0x20 /* XMT failed, EOT'ed */ #define FBLOCK 1 /* 1st block in a RCV message */ #define LBLOCK 2 /* last block in a RCV message */ #define CONREPT 4 /* controller connected report */ /* * Message queue header structure. * One RCV queue & one reXMT queue per user channel. */ struct stmsghdr { short s_max; /* max length of queue */ short s_act; /* number of current queue members */ struct stbhdr *s_last; /* pointer to last queue member */ struct stbhdr *s_first; /* pointer to message queue */ }; /* * Synchronous terminal control header. * One per synchronous line. */ struct stc { ushort flags; /* flags */ ushort ttyid; /* current input terminal id */ char csidev; /* CSI interface device */ }; /* * flags definitions. */ #define STACTIVE 0x010 /* channel connected */ #define STRUN 0x020 /* script is running */ #define VPMERR 0x040 /* script terminated */ #define STLOAD 0x080 /* script loaded (but not yet started) */ #define STATTACH 0x100 /* device attached */ #define STHANGUP 0x200 /* device in HANGUP state */ /* * Synchronous terminal user header. * One per user printer or terminal channel. */ struct st { ushort s_ttyid; /* terminal identifier */ short s_pgrp; /* process group */ char s_row; /* cursor row of last field read */ char s_col; /* cursor col of last field read */ char s_orow; /* cursor row on last send */ char s_ocol; /* cursor col on last send */ char s_srow; /* row save area */ char s_scol; /* col save area */ char s_prow; /* cursor row of prompt protect FAC */ char s_pcol; /* cursor col of prompt protect FAC */ char s_tab; /* change to tab on input */ char s_aid; /* send key code */ char s_ss1; /* status and sense byte 1 */ char s_ss2; /* status and sense byte 2 */ ushort s_pcount; /* XMT buffer size request */ ushort s_roffset; /* read offset into s_rbuf */ ushort s_imode; /* input modes */ ushort s_omode; /* output modes */ ushort s_lmode; /* local modes */ ushort s_size; /* size of current XMT buffer */ short s_free; /* free bytes in current XMT buffer */ short s_pfree; /* s_free at prompt protect field */ struct stbhdr *s_rbuf; /* ptr to current RCV buffer */ struct stbhdr *s_xbuf; /* ptr to current XMT buffer */ char *s_ptr; /* ptr into current XMT buffer */ struct stc *s_ctrlp; /* ptr to associated control struct */ long s_flags; /* state of channel */ struct stmsghdr s_hdr; /* RCV queue header */ struct stmsghdr s_xhdr; /* reXMT queue header */ }; /* * s_flags definitions. */ #define CH_OPEN 0x00001L /* channel open */ #define CH_AVAIL 0x00002L /* channel not assigned to device */ #define WOUT 0x00004L #define WWOUT 0x00008L #define NOUT 0x00010L /* wait for entry before next output to term */ #define CTLD 0x00020L /* EOF indication entered */ #define STRFLG 0x00040L /* a reader is waiting for input */ #define STAWR 0x00080L #define STSOH 0x00100L /* a status and sense message was received */ #define STTO 0x00200L #define STFRD 0x00400L #define RESET 0x00800L #define DCF 0x01000L #define DCF2 0x02000L #define EOR 0x04000L #define STEOT 0x08000L #define STFMT 0x10000L #define STCLR 0x20000L/* CLEAR key hit, reformat screen */ #define STRVI 0x40000L/* device temporarily unavailable */ #define STWIP 0x80000L/* write in progress */ #define STWWAIT 0x100000L/* writer waiting for writer to complete */ #define STIGNTAB '\377' /* stty code for undefined control character */ #define PA1 '%' /* code for PA1 key */ #define PA2 '>' /* code for PA2 key */ #define PF12 '@' /* code for PF12 key */ #define CLEAR '_' /* code for CLEAR key */ /* Operation status flags for stcfl(). */ #define NOTEOW 0 /* flush because buffer full */ #define EOW 1 /* flush because end of write system call */ #define REOW 2 /* flush before read request */ #define LEOW 4 /* flush at end of output page */ #define PEOW 8 /* protect prompt before flush */ #define HDRSZ 7 /* protocol hdr size in RCV buffer */ #define TERMHSZ 7 /* protocol hdr size in terminal XMT buffer */ #define PRNTHSZ 10 /* protocol hdr size in printer XMT buffer */ #define RCVLEN 4 /* # of RCV buffers per line */ #define SMSGSZ 8 /* status message size */ #define DEVCOD " ABCDEFGHI[.<(+!&JKLMNOPQR]$*);^" /* valid synchronous device codes */ #define STMBSZ 256 /* RCV buffer size */ #define STMPRI (PZERO + 1) /* allow interrupted reads */ #define stid(X) (ushort)((X->sm_bd.d_octet2 << 8) | X->sm_bd.d_octet3) #ifdef pdp11 #define moveio(loc, cnt, rw) pimove((long)(unsigned)loc, cnt, rw) #else #define moveio(loc, cnt, rw) iomove((caddr_t)loc, cnt, rw) #endif #endif st_h 0707070000020025001006660001460001440000010315030352172561400001300000001722sys/stat.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)stat.h 1.2" */ #ifndef stat_h #define stat_h #include /* * Structure of the result of stat */ struct stat { dev_t st_dev; ino_t st_ino; ushort st_mode; short st_nlink; ushort st_uid; ushort st_gid; dev_t st_rdev; off_t st_size; time_t st_atime; time_t st_mtime; time_t st_ctime; }; #define S_IFMT 0170000 /* type of file */ #define S_IFDIR 0040000 /* directory */ #define S_IFCHR 0020000 /* character special */ #define S_IFBLK 0060000 /* block special */ #define S_IFREG 0100000 /* regular */ #define S_IFIFO 0010000 /* fifo */ #define S_ISUID 04000 /* set user id on execution */ #define S_ISGID 02000 /* set group id on execution */ #define S_ISVTX 01000 /* save swapped text even after use */ #define S_IREAD 00400 /* read permission, owner */ #define S_IWRITE 00200 /* write permission, owner */ #define S_IEXEC 00100 /* execute/search permission, owner */ #endif 0707070000020025011006660001460001440000010315040352172561400001600000001614sys/stermio.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)stermio.h 1.2" */ /* * ioctl commands for control channels */ #define STSTART 1 /* start protocol */ #define STHALT 2 /* cease protocol */ #define STPRINT 3 /* assign device to printer */ /* * ioctl commands for terminal and printer channels */ #define STGET (('X'<<8)|0) /* get line options */ #define STSET (('X'<<8)|1) /* set line options */ #define STTHROW (('X'<<8)|2) /* throw away queued input */ #define STWLINE (('X'<<8)|3) /* get synchronous line # */ struct stio { unsigned short ttyid; char row; char col; char orow; char ocol; char tab; char aid; char ss1; char ss2; unsigned short imode; unsigned short lmode; unsigned short omode; }; /* ** Mode Definitions. */ #define STFLUSH 00400 /* FLUSH mode; lmode */ #define STWRAP 01000 /* WRAP mode; lmode */ #define STAPPL 02000 /* APPLICATION mode; lmode */ 0707070000020025021006660001460001440000010315050352172561500001600000002166sys/sysinfo.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)sysinfo.h 1.2" */ #ifndef sysinfo_h #define sysinfo_h #include struct sysinfo { time_t cpu[4]; #define CPU_IDLE 0 #define CPU_USER 1 #define CPU_KERNAL 2 #define CPU_WAIT 3 time_t wait[3]; #define W_IO 0 #define W_SWAP 1 #define W_PIO 2 long bread; long bwrite; long lread; long lwrite; long phread; long phwrite; long swapin; long swapout; long bswapin; long bswapout; long pswitch; long syscall; long sysread; long syswrite; long sysfork; long sysexec; long runque; long runocc; long swpque; long swpocc; long iget; long namei; long dirblk; long readch; long writech; long rcvint; long xmtint; long mdmint; long rawch; long canch; long outch; long msg; long sema; }; extern struct sysinfo sysinfo; struct syswait { short iowait; short swap; short physio; }; extern struct syswait syswait; struct syserr { long inodeovf; long fileovf; long textovf; long procovf; long sbi[5]; #define SBI_SILOC 0 #define SBI_CRDRDS 1 #define SBI_ALERT 2 #define SBI_FAULT 3 #define SBI_TIMEO 4 }; extern struct syserr syserr; #endif 0707070000020025041006660001460001440000010315070352172561500002000000003632sys/sysmacros.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)sysmacros.h 1.2" */ #ifndef sysmacros_h #define sysmacros_h /* * Some macros for units conversion */ /* Core clicks (4096 bytes) to segments and vice versa */ #ifdef mc68k #define ctos(x) (((x)+15)>>4) #define stoc(x) ((x)<<4) #else vax #define ctos(x) ((x+(NCPS-1))/NCPS) #define stoc(x) ((x)*NCPS) #endif mc68k /* Core clicks (4096 bytes) to disk blocks (1024 bytes) */ #ifdef mc68k #define ctod(x) ((x)<<2) #define dtoc(x) ((x)>>2) #else vax #define ctod(x) ((x+(NCPD-1))/NCPD) #endif mc68k /* inumber to disk address */ #ifdef INOSHIFT #define itod(x) (daddr_t)(((unsigned)x+(2*INOPB-1))>>INOSHIFT) #else #define itod(x) (daddr_t)(((unsigned)x+(2*INOPB-1))/INOPB) #endif /* inumber to disk offset */ #ifdef INOSHIFT #define itoo(x) (int)(((unsigned)x+(2*INOPB-1))&(INOPB-1)) #else #define itoo(x) (int)(((unsigned)x+(2*INOPB-1))%INOPB) #endif /* clicks to bytes */ #ifdef BPCSHIFT #define ctob(x) ((x)<>BPCSHIFT) #define btoct(x) ((unsigned)(x)>>BPCSHIFT) #else #define btoc(x) (((unsigned)(x)+(NBPC-1))/NBPC) #define btoct(x) ((unsigned)(x)/NBPC) #endif /* major part of a device */ #define major(x) (int)((unsigned)x>>8) #define bmajor(x) (int)(((unsigned)x>>8)&037) #define brdev(x) (x&0x1fff) /* minor part of a device */ #define minor(x) (int)(x&0377) /* make a device number */ #define makedev(x,y) (dev_t)(((x)<<8) | (y)) /* kernel prints: make printf conditional on globl "kpflg" being set. */ #define kprintf kpflg&&printf extern int kpflg; /* kernel printf flag enables debugging output */ /* bytes to disk blocks, disk blocks to bytes */ #define btodb(x) (((x)+BSIZE-1)>>BSHIFT) #define dbtob(x) ((x)< #include #include #include #include #include #include #include /* * Random set of variables used by more than one routine. */ extern struct inode *rootdir; /* pointer to inode of root directory */ extern short cputype; /* type of cpu = 1 MegaFrame 2 MegaFrame2 (MiniFrame) */ extern time_t lbolt; /* time in HZ since last boot */ extern time_t time; /* time in sec from 1970 */ extern char runin; /* scheduling flag */ extern char runout; /* scheduling flag */ #ifdef vax extern char runrun; /* scheduling flag */ #else extern int runrun; /* scheduling flag */ #endif extern char curpri; /* current priority */ extern struct proc *curproc; /* current proc */ extern struct proc *curmapproc; /* current proc loaded in memory map */ extern struct proc *runq; /* head of linked list of running processes */ extern maxmem; /* max available memory */ extern physmem; /* physical memory on this CPU */ #ifdef vax extern daddr_t swplo; /* block number of swap space */ #endif extern nswap; /* size of swap space */ extern dev_t rootdev; /* device of the root */ extern dev_t swapdev; /* swapping device */ extern dev_t pipedev; /* pipe device */ extern char *panicstr; /* panic string pointer */ extern blkacty; /* active block devices */ extern pwr_cnt, pwr_act; extern int (*pwr_clr[])(); extern dev_t getmdev(); extern daddr_t bmap(); extern struct inode *ialloc(); extern struct inode *iget(); extern struct inode *owner(); extern struct inode *maknode(); extern struct inode *namei(); extern struct buf *alloc(); extern struct buf *getblk(); extern struct buf *geteblk(); extern struct buf *bread(); extern struct buf *breada(); extern struct filsys *getfs(); extern struct file *getf(); extern struct file *falloc(); extern int uchar(); /* * Structure of the system-entry table */ extern struct sysent { char sy_narg; /* total number of arguments */ #ifdef vax char sy_nrarg; /* number of args in registers */ #endif vax int (*sy_call)(); /* handler */ #if !LATER char *sy_name; /* name, for debugging */ #endif } sysent[]; int hand; /* current index into coremap used by daemon */ int nswdev; /* number of swap devices */ #ifndef slp_c extern int mpid; /* generic for unique process id's */ #endif #ifdef mega char kmapwnt; /* kernel map want flag */ #endif extern dev_t argdev; /* device for argument lists */ extern struct buf *baddr(); extern void bcopy(); extern int copyin(); extern int copyout(); extern int copyseg(); extern int clearseg(); #ifdef MEGA extern caddr_t calloc(); extern char *heap_alloc(); extern void heap_free(); extern char *heap_realloc(); #endif MEGA extern unsigned max(); extern void mclear(); extern int memall(); extern struct cmap *mfind(); extern unsigned min(); extern int schar(); #ifdef MEGA extern short segall(); #endif MEGA extern swblk_t vtod(); extern struct pte *vtohpte(); extern struct mpte *vtopte(); #ifdef mega #if LATER /* space for vmmap defined in locore.s */ char vmmap[]; /* poor name! */ #endif int umbabeg,umbaend; /* where sensitive vm begins/ends */ extern int catcher[256]; #endif int noproc; /* no one is running just now */ int wantin; #endif systm_h 0707070000020025061006660001460001440000010315160352172561600001500000000530sys/target.h/* Convergent Technologies - System V - Jun 1983 */ /* "@(#)target.h 1.3" */ #ifndef target_h #define target_h /* * To compile for mc68000, place "#define mc68000 1" below. * To compile for mc68010, place "#define mc68010 1" below. * * To compile for MiniFrame, place "#define mini 1" below. */ #define mc68010 1 #define mini 1 #endif 0707070000020025071006660001460001440000010315240352172561600001500000010573sys/termio.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)termio.h 1.2" */ #ifndef termio_h #define termio_h #define NCC 8 /* * To reduce the number of #define's seen by the rest of the kernel, * the following are only turned on if defined_io is set. */ #if !KERNEL || defined_io /* control characters */ #define VINTR 0 #define VQUIT 1 #define VERASE 2 #define VKILL 3 #define VEOF 4 #define VEOL 5 #define VEOL2 6 #define VMIN 4 #define VTIME 5 #define CNUL 0 #define CDEL 0377 /* default control chars */ #define CESC '\\' #define CINTR 0177 /* DEL */ #define CQUIT 034 /* FS, cntl | */ #define CERASE '\b' #define CKILL '@' #define CEOF 04 /* cntl d */ #define CSTART 021 /* cntl q */ #define CSTOP 023 /* cntl s */ /* input modes */ #define IGNBRK 0000001 #define BRKINT 0000002 #define IGNPAR 0000004 #define PARMRK 0000010 #define INPCK 0000020 #define ISTRIP 0000040 #define INLCR 0000100 #define IGNCR 0000200 #define ICRNL 0000400 #define IUCLC 0001000 #define IXON 0002000 #define IXANY 0004000 #define IXOFF 0010000 /* output modes */ #define OPOST 0000001 #define OLCUC 0000002 #define ONLCR 0000004 #define OCRNL 0000010 #define ONOCR 0000020 #define ONLRET 0000040 #define OFILL 0000100 #define OFDEL 0000200 #define NLDLY 0000400 #define NL0 0 #define NL1 0000400 #define CRDLY 0003000 #define CR0 0 #define CR1 0001000 #define CR2 0002000 #define CR3 0003000 #define TABDLY 0014000 #define TAB0 0 #define TAB1 0004000 #define TAB2 0010000 #define TAB3 0014000 #define BSDLY 0020000 #define BS0 0 #define BS1 0020000 #define VTDLY 0040000 #define VT0 0 #define VT1 0040000 #define FFDLY 0100000 #define FF0 0 #define FF1 0100000 /* control modes */ #define CBAUD 0000017 #define B0 0 #define B50 0000001 #define B75 0000002 #define B110 0000003 #define B134 0000004 #define B150 0000005 #define B200 0000006 #define B300 0000007 #define B600 0000010 #define B1200 0000011 #define B1800 0000012 #define B2400 0000013 #define B4800 0000014 #define B9600 0000015 #define EXTA 0000016 #define EXTB 0000017 #define CSIZE 0000060 #define CS5 0 #define CS6 0000020 #define CS7 0000040 #define CS8 0000060 #define CSTOPB 0000100 #define CREAD 0000200 #define PARENB 0000400 #define PARODD 0001000 #define HUPCL 0002000 #define CLOCAL 0004000 #define CTSCD 0010000 /* line discipline 0 modes */ #define ISIG 0000001 #define ICANON 0000002 #define XCASE 0000004 #define ECHO 0000010 #define ECHOE 0000020 #define ECHOK 0000040 #define ECHONL 0000100 #define NOFLSH 0000200 #define SSPEED B9600 /* default speed: 9600 baud */ #endif defined_io /* * Ioctl control packet */ struct termio { unsigned short c_iflag; /* input modes */ unsigned short c_oflag; /* output modes */ unsigned short c_cflag; /* control modes */ unsigned short c_lflag; /* line discipline modes */ char c_line; /* line discipline */ unsigned char c_cc[NCC]; /* control chars */ }; #if !KERNEL || defined_io #define IOCTYPE 0xff00 #define TIOC ('T'<<8) #define TCGETA (TIOC|1) #define TCSETA (TIOC|2) #define TCSETAW (TIOC|3) #define TCSETAF (TIOC|4) #define TCSBRK (TIOC|5) #define TCXONC (TIOC|6) #define TCFLSH (TIOC|7) #define TCDSET (TIOC|32) #define LDIOC ('D'<<8) #define LDOPEN (LDIOC|0) #define LDCLOSE (LDIOC|1) #define LDCHG (LDIOC|2) #define LDGETT (LDIOC|8) #define LDSETT (LDIOC|9) /* * Terminal types */ #define TERM_NONE 0 /* tty */ #define TERM_TEC 1 /* TEC Scope */ #define TERM_V61 2 /* DEC VT61 */ #define TERM_V10 3 /* DEC VT100 */ #define TERM_TEX 4 /* Tektronix 4023 */ #define TERM_D40 5 /* TTY Mod 40/1 */ #define TERM_H45 6 /* Hewlitt-Packard 45 */ #define TERM_D42 7 /* TTY Mod 40/2B */ /* * Terminal flags */ #define TM_NONE 0000 /* use default flags */ #define TM_SNL 0001 /* special newline flag */ #define TM_ANL 0002 /* auto newline on column 80 */ #define TM_LCF 0004 /* last col of last row special */ #define TM_CECHO 0010 /* echo terminal cursor control */ #define TM_CINVIS 0020 /* do not send esc seq to user */ #define TM_SET 0200 /* must be on to set/res flags */ #endif defined_io /* * structure of ioctl arg for LDGETT and LDSETT */ struct termcb { char st_flgs; /* term flags */ char st_termt; /* term type */ char st_crow; /* gtty only - current row */ char st_ccol; /* gtty only - current col */ char st_vrow; /* variable row */ char st_lrow; /* last row */ }; /* * Terminal types */ #define TERM_NONE 0 /* tty */ /* * Terminal flags */ #define TM_NONE 0000 /* use default flags */ #endif termio_h 0707070000020025101006660001460001440000010315310352172561700001300000002534sys/text.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)text.h 1.2" */ #ifndef text_h #define text_h #include #include #include /* * Text structure. * One allocated per pure procedure on swap device. * Manipulated by text.c */ #define NXDAD 16 /* param.h:MAXTSIZ / dmap.h:DMTEXT */ struct text { swblk_t x_daddr[NXDAD]; /* disk addresses of DMTEXT-page segments */ /* (relative to swplo) */ swblk_t x_ptdaddr; /* disk address of page table */ size_t x_size; /* size (clicks) */ struct proc *x_caddr; /* ptr to linked proc, if loaded */ struct inode *x_iptr; /* inode of prototype */ short x_rssize; short x_swrss; char x_count; /* reference count */ char x_ccount; /* number of loaded references */ char x_flag; /* traced, written flags */ char x_slptime; short x_poip; /* page out in progress count */ unsigned short x_xino; /* disk inode number of the text file */ }; #ifdef KERNEL extern struct text text[]; #endif #define XTRC 01 /* Text may be written, exclusive use */ #define XWRIT 02 /* Text written into, must swap out */ #define XLOAD 04 /* Currently being read from file */ #define XLOCK 010 /* Being swapped in or out */ #define XWANT 020 /* Wanted for swapping */ #define XPAGI 040 /* Page in on demand from inode */ #define XSWPIN 0100 /* Text is being swapped in */ #endif 0707070000020025111006660001460001440000010315350352172561700001400000000557sys/times.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)times.h 1.2" */ #ifndef times_h #define times_h #include /* * Structure returned by times() */ struct tms { time_t tms_utime; /* user time */ time_t tms_stime; /* system time */ time_t tms_cutime; /* user time, children */ time_t tms_cstime; /* system time, children */ }; #endif 0707070000020025121006660001460001440000010315360352172562000001400000005105sys/trace.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)trace.h 1.2" */ #ifndef trace_h #define trace_h #include #include /* * Per trace structure */ struct trace { struct clist tr_outq; short tr_state; short tr_chbits; short tr_rcnt; unsigned char tr_chno; char tr_ct; }; /* * File system buffer tracing points; all trace */ #define TR_HITBREAD 0 /* buffer read found in cache */ #define TR_MISSBREAD 1 /* buffer read not in cache */ #define TR_BWRITE 2 /* buffer written */ #define TR_HITRABREAD 3 /* buffer read-ahead found in cache */ #define TR_MISSRABREAD 4 /* buffer read-ahead not in cache */ #define TR_XFODMISS 5 /* exe fod read */ #define TR_XFODHIT 6 /* exe fod read */ #define TR_BRELSE 7 /* brelse */ /* * Memory allocator trace points; all trace the amount of memory involved */ #define TR_MALL 10 /* memory allocated */ /* * Paging trace points: all are */ #define TR_INTRANS 20 /* page intransit block */ #define TR_EINTRANS 21 /* page intransit wait done */ #define TR_FRECLAIM 22 /* reclaim from free list */ #define TR_RECLAIM 23 /* reclaim from loop */ #define TR_XSFREC 24 /* reclaim from free list instead of drum */ #define TR_XIFREC 25 /* reclaim from free list instead of fsys */ #define TR_WAITMEM 26 /* wait for memory in pagein */ #define TR_EWAITMEM 27 /* end memory wait in pagein */ #define TR_ZFOD 28 /* zfod page fault */ #define TR_EXFOD 29 /* exec fod page fault */ #define TR_VRFOD 30 /* vread fod page fault */ #define TR_CACHEFOD 31 /* fod in file system cache */ #define TR_SWAPIN 32 /* drum page fault */ #define TR_PGINDONE 33 /* page in done */ #define TR_SWPIO 34 /* swap i/o request arrives */ /* * System call trace points. */ #define TR_VADVISE 40 /* vadvise occurred with */ /* * Miscellaneous */ #define TR_STAMP 50 /* user said vtrace(VTR_STAMP, value); */ /* * This defines the size of the trace flags array. */ #define TR_NFLAGS 100 /* generous */ #define TRCSIZ 4096 /* * Specifications of the vtrace() system call, which takes one argument. */ #define VTRACE 64+51 #define VTR_DISABLE 0 /* set a trace flag to 0 */ #define VTR_ENABLE 1 /* set a trace flag to 1 */ #define VTR_VALUE 2 /* return value of a trace flag */ #define VTR_UALARM 3 /* set alarm to go off (sig 16) */ /* in specified number of hz */ #define VTR_STAMP 4 /* user specified stamp */ #ifdef KERNEL #ifdef TRACE char traceflags[TR_NFLAGS]; struct proc *traceproc; int tracebuf[TRCSIZ]; unsigned tracex; int tracewhich; #define trace(a,b,c) if (traceflags[a]) trace1(a,b,c) #endif #endif #endif 0707070000020025131006660001460001440000010315410352172562000001300000001554sys/trap.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)trap.h 1.2" */ #ifndef trap_h #define trap_h /* * Trap type values */ #define BUSFLT 2 /* bus error */ #define ADDRFLT 3 /* address error */ #define ILLFLT 4 /* illegal instruction */ #define ZDIVFLT 5 /* zero divide */ #define CHKFLT 6 /* check instruction */ #define TRPVFLT 7 /* trapv fault */ #define PRIVFLT 8 /* privileged instruction fault */ #define TRCTRAP 9 /* trace trap */ #define IOTFLT 10 /* iot instruction fault */ #define EMTFLT 11 /* emt instruction fault */ #define FRMER 14 /* format error */ #define UNINVEC 15 /* uninitialized interrupt vector */ #define SPURINT 24 /* spurious interrupt */ #define NMIFLT 31 /* NMI */ #define SYSCALL 32 /* trap instruction (syscall trap) */ #define BPTFLT 33 /* break point trap */ #define RESCHED 256 /* software level 1 trap (reschedule trap) */ #endif 0707070000020025141006660001460001440000010315420352172562000001400000001262sys/ttold.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)ttold.h 1.2" */ #ifndef ttold_h #define ttold_h struct sgttyb { char sg_ispeed; char sg_ospeed; char sg_erase; char sg_kill; int sg_flags; }; /* modes */ #define O_HUPCL 01 #define O_XTABS 02 #define O_LCASE 04 #define O_ECHO 010 #define O_CRMOD 020 #define O_RAW 040 #define O_ODDP 0100 #define O_EVENP 0200 #define O_NLDELAY 001400 #define O_NL1 000400 #define O_NL2 001000 #define O_TBDELAY 002000 #define O_NOAL 004000 #define O_CRDELAY 030000 #define O_CR1 010000 #define O_CR2 020000 #define O_VTDELAY 040000 #define O_BSDELAY 0100000 #define tIOC ('t'<<8) #define TIOCGETP (tIOC|8) #define TIOCSETP (tIOC|9) #endif 0707070000020025151006660001460001440000010316450352172562100001200000011634sys/tty.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)tty.h 1.4" */ #ifndef tty_h #define tty_h #include /* * A clist structure is the head of a linked list queue of characters. * The routines getc* and putc* manipulate these structures. */ struct clist { #ifdef mc68k ushort c_cc; /* character count */ #else int c_cc; /* character count */ #endif mc68k struct cblock *c_cf; /* pointer to first */ struct cblock *c_cl; /* pointer to last */ }; /* Macro to find clist structure given pointer into it */ #define CMATCH(pointer) (struct cblock *)(cfree + (pointer - cfree)) /* Character control block for interrupt level control */ struct ccblock { caddr_t c_ptr; /* buffer address */ ushort c_count; /* character count */ ushort c_size; /* buffer size */ }; /* * A tty structure is needed for each UNIX character device that * is used for normal terminal IO. */ #define NCC 8 #define NWCC 2 /* bytes for user use */ struct tty { struct clist t_rawq; /* raw input queue */ struct clist t_canq; /* canonical queue */ struct clist t_outq; /* output queue */ struct ccblock t_tbuf; /* tx control block */ struct ccblock t_rbuf; /* rx control block */ int (* t_proc)(); /* routine for device functions */ struct windef *t_wp; /* pointer to assoc. window */ ushort t_iflag; /* input modes */ ushort t_oflag; /* output modes */ ushort t_cflag; /* control modes */ ushort t_lflag; /* line discipline modes */ short t_state; /* internal state */ short t_pgrp; /* process group name */ char t_line; /* line discipline */ char t_delct; /* delimiter count */ char t_term; /* terminal type */ char t_tmflag; /* terminal flags */ char t_col; /* current column */ union { struct { char t_rw; /* current row */ char t_vrw; /* variable row */ char t_lrw; /* last physical row */ char t_hqct; /* no high queue packets on t_outq */ } s5; struct { unsigned char t_window; /* wndw # of this tty struct */ unsigned char t_mindev; /* minor dev # od this port */ unsigned char t_usr[NWCC]; /* for user use */ } pt; } un; #define t_row un.s5.t_rw #define t_vrow un.s5.t_vrw #define t_lrow un.s5.t_lrw #define t_hqcnt un.s5.t_hqct #define t_minordevice un.pt.t_mindev #define t_user un.pt.t_usr #define t_wndw un.pt.t_window char t_dstat; /* used by terminal handlers and line disciplines */ unsigned char t_cc[NCC]; /* settable control chars */ }; /* * The structure of a clist block */ #define CLSIZE 64 struct cblock { struct cblock *c_next; char c_first; char c_last; char c_data[CLSIZE]; }; extern struct cblock cfree[]; extern struct cblock * getcb(); extern struct cblock * getcf(); extern struct clist ttnulq; struct chead { struct cblock *c_next; short c_size; short c_count; int c_flag; }; extern struct chead cfreelist; struct inter { int cnt; }; #ifndef space_h #define QESC 0200 /* queue escape */ #define HQEND 01 /* high queue end */ #ifndef TTIPRI /* also defined in the priority table in param.h */ #define TTIPRI 27 /* waiting for tty input (was 28) */ #define TTOPRI 29 #endif /* limits */ extern int ttlowat[], tthiwat[]; #define TTYHOG 256 #define TTXOLO 60 #define TTXOHI 180 #define TTECHI 80 /* Hardware bits */ #define DONE 0200 #define IENABLE 0100 #define OVERRUN 040000 #define FRERROR 020000 #define PERROR 010000 /* Internal state */ #define TIMEOUT 01 /* Delay timeout in progress */ #define WOPEN 02 /* Waiting for open to complete */ #define ISOPEN 04 /* Device is open */ #define TBLOCK 010 #define CARR_ON 020 /* Software copy of carrier-present */ #define BUSY 040 /* Output in progress */ #define OASLP 0100 /* Wakeup when output done */ #define IASLP 0200 /* Wakeup when input done */ #define TTSTOP 0400 /* Output stopped by ctl-s */ #define EXTPROC 01000 /* External processing */ #define TACT 02000 #define CLESC 04000 /* Last char escape */ #define RTO 010000 /* Raw Timeout */ #define TTIOW 020000 #define TTXON 040000 #define TTXOFF 0100000 /* l_output status */ #define CPRES 0100000 /* device commands */ #define T_OUTPUT 0 #define T_TIME 1 #define T_SUSPEND 2 #define T_RESUME 3 #define T_BLOCK 4 #define T_UNBLOCK 5 #define T_RFLUSH 6 #define T_WFLUSH 7 #define T_BREAK 8 #define T_INPUT 9 /* * Terminal flags (set in t_tmflgs). */ #define SNL 1 /* non-standard new-line needed */ #define ANL 2 /* automatic new-line */ #define LCF 4 /* Special treatment of last col, row */ #define TERM_CTLECHO 010 /* Echo terminal control characters */ #define TERM_INVIS 020 /* do not send escape sequences to user */ #define QLOCKB 040 /* high queue locked for base level */ #define QLOCKI 0100 /* high queue locked for interrupts */ #define TERM_BIT 0200 /* Bit reserved for terminal drivers. */ /* Usually used to indicate that an esc*/ /* character has arrived and that the */ /* next character is special. */ /* This bit is the same as the TM_SET */ /* bit which may never be set by a user*/ #endif space_h #endif tty_h 0707070000020025161006660001460001440000010316630352172562100001400000001246sys/types.h/* * S4 @(#)types.h 2.1 3/11/85 */ /* Convergent Technologies - System V - May 1983 */ /* "@(#)types.h 1.2" */ #ifndef types_h #define types_h typedef struct { int r[1]; } * physadr; typedef long daddr_t; typedef char * caddr_t; typedef unsigned int uint; typedef unsigned short ushort; typedef ushort ino_t; typedef short cnt_t; typedef long time_t; typedef int label_t[13]; /* regs d2-d7, a2-a7, pc */ typedef short dev_t; typedef long off_t; typedef long paddr_t; typedef long key_t; typedef int swblk_t; typedef int size_t; typedef unsigned char port_t; /* local TP/CP port numbers */ typedef unsigned char mdev_t; /* minor device type */ #endif types_h 0707070000020025171006660001460001440000010316640352172562200001300000013011sys/user.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)user.h 1.4" */ #ifndef user_h #define user_h #include #include #include #include #include #include #include #include #include #include /* * The user structure. * One allocated per process. * Contains all per process data that doesn't need to be referenced * while the process is swapped. * The user block is USIZE*click bytes long; resides at virtual kernel * loc 0x70000 * contains the system stack per user; is cross referenced * with the proc structure for the same process. */ struct user { label_t u_rsav; /* save info when exchanging stacks */ label_t u_qsav; /* label variable for quits and interrupts */ label_t u_ssav; /* label variable for swapping */ char u_segflg; /* IO flag: 0:user D; 1:system; 2:user I */ char u_error; /* return error code */ ushort u_uid; /* effective user id */ ushort u_gid; /* effective group id */ ushort u_ruid; /* real user id */ ushort u_rgid; /* real group id */ struct proc *u_procp; /* pointer to proc structure */ int *u_ap; /* pointer to arglist */ union { /* syscall return values */ struct { int r_val1; int r_val2; }r_reg; off_t r_off; time_t r_time; } u_r; caddr_t u_base; /* base address for IO */ unsigned u_count; /* bytes remaining for IO */ off_t u_offset; /* offset in file for IO */ short u_fmode; /* file mode for IO */ ushort u_pbsize; /* bytes in block for IO */ ushort u_pboff; /* offset in block for IO */ dev_t u_pbdev; /* real device for IO */ daddr_t u_rablock; /* read ahead block addr */ short u_errcnt; /* syscall error count */ struct inode *u_cdir; /* current directory of process */ struct inode *u_rdir; /* root directory of process */ caddr_t u_dirp; /* pathname pointer */ struct direct u_dent; /* current directory entry */ struct inode *u_pdir; /* inode of parent directory of dirp */ struct file *u_ofile[NOFILE]; /* pointers to file structures of open files */ char u_pofile[NOFILE]; /* per-process flags of open files */ int u_arg[10]; /* arguments to current system call */ /* u_tsize u_dsize u_ssize have copies in the proc table */ unsigned u_tsize; /* text size (clicks) */ unsigned u_dsize; /* data size (clicks) */ unsigned u_ssize; /* stack size (clicks) */ int u_signal[NSIG]; /* disposition of signals */ time_t u_utime; /* this process user time */ time_t u_stime; /* this process system time */ time_t u_cutime; /* sum of childs' utimes */ time_t u_cstime; /* sum of childs' stimes */ int *u_ar0; /* address of users saved R0 */ struct u_prof { /* profile arguments */ short *pr_base; /* buffer base */ unsigned pr_size; /* buffer size */ unsigned pr_off; /* pc offset */ unsigned pr_scale; /* pc scaling */ } u_prof; #ifdef VAX char u_intflg; /* catch intr from sys */ char u_sep; /* flag for I and D separation */ #endif short *u_ttyp; /* pointer to pgrp in "tty" struct */ dev_t u_ttyd; /* controlling tty dev */ struct { /* header of executable file */ short ux_mag; /* magic number */ short ux_stamp; /* stamp */ unsigned ux_tsize; /* text size */ unsigned ux_dsize; /* data size */ unsigned ux_bsize; /* bss size */ unsigned ux_ssize; /* symbol table size */ unsigned ux_entloc; /* entry location */ unsigned ux_unused; unsigned ux_relflg; } u_exdata; #define ux_tstart ux_unused char u_comm[DIRSIZ]; time_t u_start; time_t u_ticks; long u_mem; long u_ior; long u_iow; long u_iosw; long u_ioch; char u_acflag; short u_cmask; /* mask for file creation */ daddr_t u_limit[NLIMITS+1]; /* see */ #ifdef mc68k #ifdef MEGA struct exch *u_exch[NUEXCH]; /* exchange pointers for this proc. */ struct exch *u_childexch; /* used in fork/procdup for new exch */ #endif MEGA struct vtimes u_vm; /* stats for this proc */ struct vtimes u_cvm; /* sum of stats for reaped children */ struct dmap u_dmap; /* disk map for data segment */ struct dmap u_smap; /* disk map for stack segment */ struct dmap u_cdmap, u_csmap; /* shadows of u_dmap, u_smap, for use of parent during fork */ time_t u_outime; /* user time at last sample */ size_t u_odsize, u_ossize; /* for (clumsy) expansion swaps */ size_t u_vrpages[NOFILE]; /* number vread pages hanging on fd */ /* hardware specific stuff */ char u_usize; /* 1 or 2 pages of u structure */ #endif mc68k /* When the process is in memory, * the page table entries for ts+ds+ss * are stored in u in the following * manner: * The page table entries start at * start of u page + PTE_OFFSET = * u + 0x900. u starts at * u page + U_OFFSET (0x900). If the # * of entries is <= 512, only one page * of u structure is allocated. * Otherwise the second page of u is * allocated(pointed to by p_addr[1] * and p_szpt = 1.) * The rest of the page entries continue * in the second page. */ /* kernel stack per user * extends from u * backward not to reach u - 0x900 */ short u_lock; /* process/text locking flags */ }; #ifdef KERNEL extern struct user u; #endif #define u_rval1 u_r.r_reg.r_val1 #define u_rval2 u_r.r_reg.r_val2 #define u_roff u_r.r_off #define u_rtime u_r.r_time /* ioflag values: Read/Write, User/Kernel, Ins/Data */ #define U_WUD 0 #define U_RUD 1 #define U_WKD 2 #define U_RKD 3 #define U_WUI 4 #define U_RUI 5 #define EXCLOSE 01 /* auto-close on exec */ #endif 0707070000020025201006660001460001440000010317310352172562300001600000000630sys/utsname.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)utsname.h 1.3" */ #ifndef utsname_h #define utsname_h struct utsname { char sysname[9]; char nodename[9]; char release[9]; char version[9]; char machine[9]; }; extern struct utsname utsname; #define SYS "UNIX" #ifndef NODE #define NODE "RLS000A" #endif #define REL "SYSTEM5" #ifndef VER #define VER "000a" #endif #define MACH "mc68k" #endif 0707070000020025211006660001460001440000010317320352172562300001600000000660sys/vadvise.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)vadvise.h 1.2" */ #ifndef vadvise_h #define vadvise_h /* * 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. */ #define VA_NORM 0 #define VA_ANOM 1 #define VA_SEQL 2 #endif 0707070000020025311006660001460001440000010317330352172562300001200000001101sys/var.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)var.h 1.2" */ #ifndef var_h #define var_h struct var { int v_buf; int v_call; int v_inode; char * ve_inode; int v_file; char * ve_file; int v_mount; char * ve_mount; int v_proc; char * ve_proc; int v_text; char * ve_text; int v_clist; int v_sabuf; int v_maxup; int v_smap; int v_hbuf; int v_hmask; int v_pbuf; #ifdef MEGA int v_exch; char * ve_exch; int v_rrtsiz; char * ve_reqtab; char * ve_resptab; int v_lreq; char *ve_lreq; int v_heap; #endif MEGA }; extern struct var v; #endif var_h 0707070000020025511006660001460001440000010317340352172562300001500000001112sys/vlimit.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)vlimit.h 1.2" */ #ifndef vlimit_h #define vlimit_h /* * Limits for u.u_limit[i], per process, inherited. */ #define LIM_NORAISE 0 /* if <> 0, can't raise limits */ #define LIM_CPU 1 /* max secs cpu time */ #define LIM_FSIZE 2 /* max size of file created */ #define LIM_DATA 3 /* max growth of data space */ #define LIM_STACK 4 /* max growth of stack */ #define LIM_CORE 5 /* max size of ``core'' file */ #define LIM_MAXRSS 6 /* max desired data+stack core usage */ #define NLIMITS 6 #define INFINITY 0x7fffffff #endif 0707070000020025521006660001460001440000010317350352172562300001100000000442sys/vm.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)vm.h 1.2" */ #ifndef vm_h #define vm_h /* * #include * is a quick way to include all the vm header files. */ #include #include #include #include #endif 0707070000020025531006660001460001440000010317360352172562400001400000011120sys/vmmac.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)vmmac.h 1.2" */ #ifndef vmmac_h #define vmmac_h #include #include /* * Virtual memory related conversion macros */ /* Core clicks to number of pages of page tables needed to map that much */ /* define ctopt(x) (((x)+NPTEPG-1)/NPTEPG) */ /* Virtual page numbers to text|data|stack|kvmem segment page numbers and back */ #define vtotp(p, v) ((int)((v) - SYSPAGE)) #define vtodp(p, v) ((int)((v) - ((p)->p_tpage) - SYSPAGE)) #define vtosp(p, v) ((int)(((PAGES_IN_PROC)-1) - (v))) #define vtovp(v) ((int)((v) - KVMEM_VPAGE0)) #define tptov(p, i) ((unsigned)((i) + SYSPAGE)) #define dptov(p, i) ((unsigned)((i) + ((p)->p_tpage) + SYSPAGE)) #define sptov(p, i) ((unsigned)(((PAGES_IN_PROC)-1) - (i))) #define vptov(i) ((unsigned)((i) + KVMEM_VPAGE0)) /* Tell whether virtual page numbers are in text|data|stack|kvmem segment */ #define isassv(p, v) (((v) < PAGES_IN_PROC) && \ ((v) >= ((PAGES_IN_PROC) - (p)->p_ssize))) #define isatsv(p, v) (((v) - SYSPAGE) < (p)->p_tsize) #define isadsv(p, v) (((v) - SYSPAGE) >= ((p)->p_tpage) && \ ((v) - SYSPAGE - ((p)->p_tpage) < (p)->p_dsize)) #define isavsv(v) (((v) >= KVMEM_VPAGE0) && \ (((v) - KVMEM_VPAGE0) < kv_pages)) /* Tell whether adjusted virtual page numbers are in text|data|stack segment */ /* Adjusted virtual page number = virtual page number - SYSPAGE */ #define validaddr(p, i) ((i < p->p_tsize) || \ ((i - (p->p_tpage) >= 0) && \ (i - (p->p_tpage) < p->p_dsize)) || \ (((i+SYSPAGE) < (KVMEM_VPAGE0+kv_pages)) && \ ((i+SYSPAGE) >= (PAGES_IN_PROC-p->p_ssize)))) /* Tell whether pte's are text|data|stacki|kvmem */ #define isaspte(p, pte) ((int)(pte - (struct mpte *) VPTE_BASE) >= \ ((p)->p_tsize + (p)->p_dsize)) #define isatpte(p, pte) ((pte >= (struct mpte *) VPTE_BASE) && \ ((int)(pte - (struct mpte *) VPTE_BASE) < \ (p)->p_tsize)) #define isadpte(p, pte) (((int)(pte - (struct mpte *) VPTE_BASE) >= \ (p)->p_tsize) && \ ((int)(pte - (struct mpte *) VPTE_BASE) < \ ((p)->p_tsize + (p)->p_dsize))) #define isavpte(pte) ((pte >= kv_mpte) && \ ((pte - kv_mpte) < kv_pages)) /* Text|data|stack|kvmem pte's to segment page numbers and back */ #define ptetotp(p, pte) ((int)(pte - (struct mpte *) VPTE_BASE)) #define ptetodp(p, pte) ((int)(pte - (struct mpte *) VPTE_BASE) \ - (p)->p_tsize) #define ptetosp(p, pte) (((p)->p_tsize + (p)->p_dsize + (p)->p_ssize -1) \ - (int)(pte - (struct mpte *) VPTE_BASE)) #define ptetovp(pte) ((int)(pte - kv_mpte)) #define tptopte(p, i) ((struct mpte *)(((i)<<2) + VPTE_BASE)) #define dptopte(p, i) ((struct mpte *) \ ((((i) + ((p)->p_tsize))<<2) + VPTE_BASE)) #define sptopte(p, i) ((struct mpte *) \ (((((p)->p_tsize + (p)->p_dsize + (p)->p_ssize -1) - (i)) << 2) + VPTE_BASE)) #define vptopte(i) (&kv_mpte[i]) #define ctopt(x) (x) /* Bytes to pages without rounding, and back */ #define btop(x) (((unsigned)(x)) >> PGSHIFT) #define ptob(x) ((caddr_t)((x) << PGSHIFT)) /* Turn virtual addresses into kernel map indices */ /* define kmxtob(a) (usrpt + (a) * NPTEPG) */ /* define btokmx(b) (((b) - usrpt) / NPTEPG) */ /* User area address and pcb bases */ /* define uaddr(p) (&((p)->p_p0br[(p)->p_szpt * NPTEPG - UPAGES])) */ /* define pcbb(p) ((p)->p_addr[0].pg_pfnum) */ /* Average new into old with aging factor time */ #define ave(smooth, cnt, time) \ smooth = ((time - 1) * (smooth) + (cnt)) / (time) /* * 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 H(pte) ((struct hpte *)(pte)) #if KLSIZE==1 #define dirtycl(pte) dirty(pte) #define anycl(pte,fld) ((pte)->fld) #define zapcl(pte,fld) (pte)->fld #define distcl(pte) #endif #if KLSIZE==2 #define dirtycl(pte) (dirty(pte) || dirty((pte)+1)) #define anycl(pte,fld) ((pte)->fld || (((pte)+1)->fld)) #define zapcl(pte,fld) (pte)[1].fld = (pte)[0].fld #endif #if KLSIZE==4 #define dirtycl(pte) \ (dirty(pte) || dirty((pte)+1) || dirty((pte)+2) || dirty((pte)+3)) #define anycl(pte,fld) \ ((pte)->fld || (((pte)+1)->fld) || (((pte)+2)->fld) || (((pte)+3)->fld)) #define zapcl(pte,fld) \ (pte)[3].fld = (pte)[2].fld = (pte)[1].fld = (pte)[0].fld #endif #ifndef distcl #define distcl(pte) zapcl(H(pte),pg_high) #endif #endif vmmac_h 0707070000020025541006660001460001440000010317440352172562500001600000006041sys/vmmeter.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)vmmeter.h 1.2" */ #ifndef vmmeter_h #define vmmeter_h /* * Virtual memory related instrumentation */ struct vmmeter { #define v_first v_swtch unsigned v_swtch; /* context switches */ unsigned v_trap; /* calls to trap */ unsigned v_syscall; /* calls to syscall() */ unsigned v_intr; /* device interrupts */ unsigned v_pdma; /* pseudo-dma interrupts */ unsigned v_pswpin; /* pages swapped in */ unsigned v_pswpout; /* pages swapped out */ unsigned v_pgin; /* pageins */ unsigned v_pgout; /* pageouts */ unsigned v_pgpgin; /* pages paged in */ unsigned v_pgpgout; /* pages paged out */ unsigned v_intrans; /* intransit blocking page faults */ unsigned v_pgrec; /* total page reclaims */ unsigned v_xsfrec; /* found in free list rather than on swapdev */ unsigned v_xifrec; /* found in free list rather than in filsys */ unsigned v_exfod; /* pages filled on demand from executables */ unsigned v_zfod; /* pages zero filled on demand */ unsigned v_vrfod; /* fills of pages mapped by vread() */ unsigned v_nexfod; /* number of exfod's created */ unsigned v_nzfod; /* number of zfod's created */ unsigned v_nvrfod; /* number of vrfod's created */ unsigned v_pgfrec; /* page reclaims from free list */ unsigned v_faults; /* total faults taken */ unsigned v_scan; /* scans in page out daemon */ unsigned v_rev; /* revolutions of the hand */ unsigned v_seqfree; /* pages taken from sequential programs */ unsigned v_dfree; /* pages freed by daemon */ #define v_last v_dfree unsigned v_swpin; /* swapins */ unsigned v_swpout; /* swapouts */ }; #ifdef KERNEL extern struct vmmeter cnt, rate, sum; #endif /* systemwide totals computed every five seconds */ struct vmtotal { short t_rq; /* length of the run queue */ short t_dw; /* jobs in ``disk wait'' (neg priority) */ short t_pw; /* jobs in page wait */ short t_sl; /* jobs sleeping in core */ short t_sw; /* swapped out runnable/short block jobs */ int t_vm; /* total virtual memory */ int t_avm; /* active virtual memory */ short t_rm; /* total real memory in use */ short t_arm; /* active real memory */ int t_vmtxt; /* virtual memory used by text */ int t_avmtxt; /* active virtual memory used by text */ short t_rmtxt; /* real memory used by text */ short t_armtxt; /* active real memory used by text */ short t_free; /* free memory pages */ }; #ifdef KERNEL extern struct vmtotal total; #endif /* * Optional instrumentation. */ #ifdef PGINPROF #define NDMON 128 #define NSMON 128 #define DRES 20 #define SRES 5 #define PMONMIN 20 #define PRES 50 #define NPMON 64 #define RMONMIN 130 #define RRES 5 #define NRMON 64 /* data and stack size distribution counters */ unsigned int dmon[NDMON+1]; unsigned int smon[NSMON+1]; /* page in time distribution counters */ unsigned int pmon[NPMON+2]; /* reclaim time distribution counters */ unsigned int rmon[NRMON+2]; int pmonmin; int pres; int rmonmin; int rres; unsigned rectime; /* accumulator for reclaim times */ unsigned pgintime; /* accumulator for page in times */ #endif #endif 0707070000020025551006660001460001440000010317510352172562600001600000006450sys/vmparam.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)vmparam.h 1.2" */ #ifndef vmparam_h #define vmparam_h #include /* * Virtual memory related constants */ #define MAXVMSIZ 1024 /* max virtual addr (clicks) */ #define MAXTSIZ (1024 - SYSPAGE) /* max text size (clicks) */ #define MAXDSIZ (1024 - SYSPAGE) /* max data size (clicks) */ #define MAXSSIZ (1024 - SYSPAGE) /* max stack size (clicks) */ #if LATER #define YELLOWZONE 1 /* stack auto expansion zone */ #endif #define YELLOWZONE 64 /* stack auto expansion zone */ /* * The size of the clock loop. */ #ifdef NON_UNITY #define LOOPPAGES (maxfree - firstfree + SLOW_FREE) #else #define LOOPPAGES (maxfree - firstfree) #endif NON_UNITY /* * 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 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+KLSIZE 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 SAFERSS 4 /* 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 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 KLSIZE page (cluster-page) * units. Note that KLMAX*KLSIZE must be <= DMMIN in dmap.h. */ #ifdef BERKELEY #define KLMAX (32/KLSIZE) #define KLSEQL (16/KLSIZE) /* in klust if vadvise(VA_SEQL) */ #define KLIN (8/KLSIZE) /* default data/stack in klust */ #define KLTXT (4/KLSIZE) /* default text in klust */ #define KLOUT (32/KLSIZE) #endif #define KLMAX 4 #define KLSEQL 2 /* in klust if vadvise(VA_SEQL) */ #define KLIN 1 /* default data/stack in klust */ #define KLTXT 1 /* default text in klust */ #define KLOUT 4 /* * KLSDIST is the advance or retard of the fifo reclaim for sequential * processes data space. */ #define KLSDIST 3 /* klusters advance/retard for seq. fifo */ #ifdef KERNEL extern int klseql; extern int klsdist; extern int klin; extern int kltxt; extern int klout; extern int kv_pages; extern int kv_poip; extern swblk_t kv_swap; extern struct mpte kv_mpte[]; #endif #endif 0707070000020025561006660001460001440000010317550352172562600001600000002731sys/vmsystm.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)vmsystm.h 1.2" */ #ifndef vmsystm_h #define vmsystm_h /* * Miscellaneous virtual memory subsystem variables and structures. */ #ifdef KERNEL extern unsigned long freemem; /* remaining blocks of free memory */ int avefree; /* moving average of remaining free blocks */ int avefree30; /* 30 sec (avefree is 5 sec) moving average */ int deficit; /* estimate of needs of new swapped in procs */ int nscan; /* number of scans in last second */ extern int multprog; /* current multiprogramming degree */ int desscan; /* desired pages scanned per second */ /* writable copies of tunables */ extern int maxpgio; /* max paging i/o per sec before start swaps */ extern int maxslp; /* max sleep time before very swappable */ extern int lotsfree; /* max free before clock freezes */ extern int minfree; /* minimum free pages before swapping begins */ extern int desfree; /* no of pages to try to keep free via daemon */ extern int saferss; /* no pages not to steal; decays with slptime */ #endif /* * Fork/vfork accounting. */ struct forkstat { int cntfork; int cntvfork; int sizfork; int sizvfork; }; #ifdef KERNEL struct forkstat forkstat; #endif /* * Swap kind accounting. */ struct swptstat { int pteasy; /* easy pt swaps */ int ptexpand; /* pt expansion swaps */ int ptshrink; /* pt shrinking swaps */ int ptpack; /* pt swaps involving spte copying */ }; #ifdef KERNEL struct swptstat swptstat; #endif #endif 0707070000020025571006660001460001440000010317570352172562700001500000001651sys/vtimes.h/* Convergent Technologies - System V - May 1983 */ /* "@(#)vtimes.h 1.2" */ #ifndef vtimes_h #define vtimes_h /* * 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 vtimes { int vm_utime; /* user time (60'ths) */ int vm_stime; /* system time (60'ths) */ /* divide next two by utime+stime to get averages */ unsigned vm_idsrss; /* integral of d+s rss */ unsigned vm_ixrss; /* integral of text rss */ int vm_maxrss; /* maximum rss */ int vm_majflt; /* major page faults */ int vm_minflt; /* minor page faults */ int vm_nswap; /* number of swaps */ int vm_inblk; /* block reads */ int vm_oublk; /* block writes */ }; #ifdef KERNEL struct vtimes zvms; /* an empty (componentwise 0) structure */ #endif #endif 0707070000020025601006660001460001440000010317600352172562700001300000004413sys/wait.h/* Convergent Technologies - System V - Jun 1983 */ /* "@(#)wait.h 1.2" */ #ifndef wait_h #define wait_h /* * 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 wait { int w_status; /* used in syscall */ /* * Terminated process status. */ struct { unsigned short w_Termsig:7; /* termination signal */ unsigned short w_Coredump:1; /* core dump indicator */ unsigned short w_Retcode:8; /* exit code if w_termsig==0 */ } w_T; /* * Stopped process status. Returned * only for traced children unless requested * with the WUNTRACED option bit. */ struct { unsigned short w_Stopval:8; /* == W_STOPPED if stopped */ unsigned short w_Stopsig:8; /* signal that stopped us */ } w_S; }; #define w_termsig w_T.w_Termsig #define w_coredump w_T.w_Coredump #define w_retcode w_T.w_Retcode #define w_stopval w_S.w_Stopval #define w_stopsig w_S.w_Stopsig #define 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 WNOHANG 1 /* dont hang in wait */ #define WUNTRACED 2 /* tell about stopped, untraced children */ #define WIFSTOPPED(x) ((x).w_stopval == WSTOPPED) #define WIFSIGNALED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig != 0) #define WIFEXITED(x) ((x).w_stopval != WSTOPPED && (x).w_termsig == 0) #endif 0707070000020025611006660001460001440000010317630352172563000001100000010356sys/wd.h/* Unix Window System Common Definitions and Structures */ #ifndef WD_H #define WD_H #include "sys/param.h" #include "sys/iohw.h" #include "sys/font.h" #include "sys/window.h" /* Cursor Params */ #define CURONTICKS (HZ/2) /* cursor on time */ #define CUROFFTICKS (HZ/4) /* cursor off time */ #define CURFAIRCNT 2 /* fairness count (see wd.c) */ #define CURFAIRTICKS (HZ/4) /* fairness on time (see wd.c) */ /* Clicks */ #define btopxc(x) (((int)(x)+1) & (~1)) /* ansi interpreter states */ #define NORM 0 /* normal characters */ #define ESC 1 /* received ESC (0x1b) */ #define CSI 2 /* received CSI (ESC [) */ #define PARAM 3 /* parsing parm string */ #define TRUNC 4 /* truncating a long line */ /* ansi flags */ #define ANOWRAP 0x1 /* truncate, don't wrap */ #define ALASTLF 0x2 /* last control char was nl */ /* ansi attributes */ #define ATTRNORM 0x0 /* no attributes */ #define ATTRREV 0x1 /* inverse video */ #define ATTRUNDER 0x4 /* underlined */ #define ATTRSTRIKE 0x8 /* strike-out */ #define ATTRBOLD 0x10 /* bold (one to left) */ #define ATTRDIM 0x20 /* dim (and'ed with half-tone */ /* other ansi parameters */ #define NAPARAM 16 /* max number of parameters */ #define UNDLRATIO 12 /* undline thickness = vs/this */ #define STRKRATIO 2 /* strkline row = baseline/this */ /* system patterns */ #define PATBLACK 0 /* all black */ #define PATWHITE 1 /* all white */ #define PATGRAY 2 /* half-tone */ #define PATLTGRAY 3 /* quarter-tone */ #define PATDKGRAY 4 /* reverse semi 1/4 tone */ #define PATBGROUND PATLTGRAY /* background */ #define PATFGROUND PATBLACK /* foreground */ #define PATCURSE PATWHITE /* cursor pattern */ /* border parameters */ #define BORDTOP 20 #define BORDBOT 20 #define BORDLEFT 6 #define BORDRIGHT 28 /* w_flags */ #define WDOPEN 0x1 /* opened */ #define WDINIT 0x2 /* inited */ /* Generic Rectangle */ struct recdef { unsigned short rec_ulx; /* upper-left x */ unsigned short rec_uly; /* upper-left y */ unsigned short rec_lrx; /* lower-right x (exclusive) */ unsigned short rec_lry; /* lower-right y (exclusive) */ }; typedef int (*fint)(); /* Window Structure */ struct windef { struct recdef w_rec; /* window dimensions */ struct recdef w_inrec; /* rectangle inside borders */ struct oldef *w_ol; /* obscured list */ struct windef *w_back; /* window behind this one */ struct windef *w_front; /* window in front of this one */ struct windef *w_parent; /* parent window */ struct tty *w_tp; /* window teletype pointer */ struct windef *w_outlist; /* list of windows with output */ char w_flags; /* window status flags */ unsigned short w_uflags; /* user settable flags */ unsigned char w_hs; /* horizonal spacing */ unsigned char w_vs; /* vertical spacing */ unsigned char w_baseline; /* baseline */ struct wfont *w_font[8]; /* window font ptrs */ char w_astate; /* ansi parser state */ char w_iparam; /* parameter index */ char w_nparam; /* parameter count */ short w_aparam[NAPARAM];/* parameters */ fint *w_adisp; /* ptr to dispatch table */ unsigned char w_aflags; /* ansi flags */ unsigned char w_attr; /* current attributes */ unsigned short w_cx; /* current x (relative to wdw) */ unsigned short w_cy; /* current y */ struct fntdef *w_cff; /* ptr to current fntdef */ char w_mflags; /* mouse flags */ struct icon w_micon; /* mouse icon */ struct recdef w_mrec; /* mouse motion rectangle */ char *w_text[WTXTNUM];/* window text pointers */ }; /* Obscured Rectangle */ struct oldef { struct recdef ol_rec; /* dimensions of obs. on screen */ struct windef *ol_lobs; /* ptr to frontmost wp */ struct oldef *ol_next; /* next oldef in a chain */ struct oldef *ol_last; /* prev oldef in a chain */ short *ol_base; /* ptr to pixels */ short ol_width; /* bytes wide of pixel map */ }; /* Font Bookkeeping */ struct wfont { struct fntdef *wf_ff; /* ptr to font file header */ short wf_usecnt; /* use count of font, 0=free */ ino_t wf_ino; /* inode number of font file */ time_t wf_mtime; /* modified time of font file */ long wf_size; /* size of font file */ }; #endif WD_H 0707070000020025621006660001460001440000010317700352172563100001500000011212sys/window.h/* Unix Window System User-Level Window Defs */ #ifndef WINDOW_H #define WINDOW_H /* ioctls */ #define WIOC ('W'<<8) #define WIOCGETD (WIOC|1) /* get window data */ #define WIOCSETD (WIOC|2) /* set window data */ #define WIOCLFONT (WIOC|3) /* load window font */ #define WIOCUFONT (WIOC|4) /* unload window font */ #define WIOCSELECT (WIOC|5) /* set keyboard window */ #define WIOCREAD (WIOC|6) /* read whole screen (32k) */ #define WIOCGETTEXT (WIOC|7) /* get window text info */ #define WIOCSETTEXT (WIOC|8) /* set window text info */ #define WIOCGETSYS (WIOC|9) /* get system window slot */ #define WIOCSETSYS (WIOC|10) /* set system window slot */ #define WIOCGETMOUSE (WIOC|11) /* get mouse info */ #define WIOCSETMOUSE (WIOC|12) /* set mouse info */ #define WIOCRASTOP (WIOC|13) /* user-level rastop */ /* files, devices */ #define WDEV "/dev/w" /* individual windows */ #define WFONT "/etc/system.ft"/* system font */ /* WIOCGET/SET TEXT params */ #define WTXTPROMPT 0 /* prompt line */ #define WTXTCMD 1 /* command line */ #define WTXTLABEL 2 /* window label */ #define WTXTUSER 3 /* user-specific text */ #define WTXTSLK1 4 /* first of 2 SLK lines */ #define WTXTSLK2 5 /* second SLK line */ #define WTXTNUM 6 /* there are 6 text slots/win */ #define WTXTLEN 81 /* each can be 80 chars + null */ /* slots in syswin for WIOCGET/SET SYS */ #define SYSWIN 3 /* number of sys wins */ #define SYSWMGR 0 /* window manager */ #define SYSPMGR 1 /* telephony manager */ #define SYSUNIX 2 /* unix process */ /* rastop source operators */ #define SRCSRC 0 /* source */ #define SRCPAT 1 /* pattern */ #define SRCAND 2 /* source & pattern */ #define SRCOR 3 /* source | pattern */ #define SRCXOR 4 /* source ^ pattern */ #define SRCMAX 4 /* rastop destination operators */ #define DSTSRC 0 /* srcop(src) */ #define DSTAND 1 /* srcop(src) & dst */ #define DSTOR 2 /* srcop(src) | dst */ #define DSTXOR 3 /* srcop(src) ^ dst */ #define DSTCAM 4 /* ~srcop(src) & dst */ #define DSTMAX 4 /* w_uflags */ #define NBORDER 0x1 /* borderless */ #define VCWIDTH 0x2 /* variable chr spacing */ #define BORDHSCROLL 0x4 /* border hscroll icons */ #define BORDVSCROLL 0x8 /* border vscroll icons */ #define BORDHELP 0x10 /* border help patch */ #define BORDCANCEL 0x20 /* border cancel patch */ #define BORDRESIZE 0x40 /* border re-size patch */ #define BORDWNUM 0x80 /* border window num */ #define UNCOVERED 0x100 /* uncovered (RO) */ #define KBDWIN 0x200 /* keyboard (RO) */ #define NOSETUFLAGS (UNCOVERED|KBDWIN) /* basic params */ #define WTXTVS 12 /* text line height (sys font) */ #define WLINE(n) ((n-1)*WTXTVS) #define YTXTPROMPT WLINE(26) /* prompts */ #define YTXTCMD WLINE(27) /* command/echo */ #define YTXTSLK1 WLINE(28) /* screen labeled keys #1 */ #define YTXTSLK2 WLINE(29) /* screen labeled keys #2 */ #define WINWIDTH 720 /* logical area (for windows) */ #define WINHEIGHT (348-4*WTXTVS) struct uwdata /* user window information */ { unsigned short uw_x; /* upper-left-corner x (pixels) */ unsigned short uw_y; /* upper-left-corner y (pixels) */ unsigned short uw_width; /* width (pixels) */ unsigned short uw_height; /* height (pixels) */ unsigned short uw_uflags; /* various flags (see above) */ unsigned char uw_hs; /* horizontal size (RO) */ unsigned char uw_vs; /* vertical size (RO) */ unsigned char uw_baseline; /* baseline (RO) */ }; struct utdata /* user text data */ { short ut_num; /* number (see above) */ char ut_text[WTXTLEN]; /* text */ }; #define MSDOWN 0x1 /* when buttons go down */ #define MSUP 0x2 /* when buttons go up */ #define MSIN 0x4 /* when mouse is in rectangle */ #define MSOUT 0x8 /* when mouse is outside rect */ #define MSICON 0x10 /* load new mouse icon */ struct umdata /* user mouse data */ { char um_flags; /* wakeup flags */ short um_x; /* motion rectnalge */ short um_y; short um_w; short um_h; struct icon *um_icon; /* ptr to icon if MSICON=1 */ }; struct urdata /* user rastop data */ { unsigned short *ur_srcbase; /* ptr to source data */ unsigned short ur_srcwidth; /* number bytes/row */ unsigned short *ur_dstbase; /* ptr to dest data */ unsigned short ur_dstwidth; /* number bytes/row */ unsigned short ur_srcx; /* source x */ unsigned short ur_srcy; /* source y */ unsigned short ur_dstx; /* destination x */ unsigned short ur_dsty; /* destination y */ unsigned short ur_width; /* width */ unsigned short ur_height; /* height */ unsigned char ur_srcop; /* source operation */ unsigned char ur_dstop; /* destination operation */ unsigned short *ur_pattern; /* pattern pointer */ }; #endif WINDOW_H 0707070000020025631006660001460001440000010317760352172541000000600000000415clk.c/* static char clk_c[] = "@(#)clk.c 1.1"; */ /* * s4 60 Hz clock Diagnostics * * (1) Test slow clock interrupts */ #include "sys/hardware.h" #include "sys/iohw.h" #include "diag.h" BOOLEAN fSClkTest, fSClkInt; int sec, oldsec, seconds, hertz; int fault(),Int(); 0707070000020025640407550001460001440000020317770353675173200000700000000000mkdiag0707070000020025651007550001460001440000010320000352172765000001400000125356mkdiag/diagRG¯”z ¯ @H2 ž .text@H .data 2 H@.bss 2  2 ž€ OQ.˜/HJ˜fü/H#È 2 N¹,/N¹@&0<N@NVÿäHî.¼ (?Nº`üd @ˆ.¼ (F/< @‰N¹?BX.¼ (N/< @§N¹?BXpÿ#À AÔB¹ AØB¹ B¬Nºø-@ÿèJ®ÿèl`Þ.¹ N¹ .¹ N¹ HnÿìN¹4X.ÿìH€HÀ`2Nº6`¢Nº”`šNºP`’Nº \`ŠNº º`‚NºÀ`~ €AgÿÐ €CgÿÎ €DgÿÌ €MgÿÊ €Rgÿ  €Sgÿ¾ €agÿ” €cgÿ’ €dgÿ €mgÿŽ €rgÿd €sgÿ‚`ÿ2LîN^NuNVÿðHîÿü.¼ÿ/</< (VN¹>þP#À 3D.¹ 3D/< (aNºèX ¹ÿÿÿÿ 3Dfpÿ`Üp-@ÿôp-@ÿø$| 3HJ®ÿøg<.¼/ /9 3DN¹?P-@ÿøJ®ÿôgJ®ÿøf`”B®ÿôÕîÿø`ÿÀ$| 3H.¼†à/ /< @ˆNº2P.¼ @ˆ/< (wNºTXÕü†à.¼#(/ /< NºP.¼ /< (†Nº(XÔü#(.¼°/ /< #0NºÜP.¼ #0/< (•NºþX`LîÿüN^NuNVÿèHîÿü-|®¸ÿôp.€p//9 3DN¹>ìP-@ÿøJ®ÿøl`$| 3H.¼†à/< @ˆ/ NºjP .€/< (£NºŽXÕü†à.¼#(/< / Nº@P .€/< (²NºdXÔü#(.¼°/< #0/ NºP .€/< (ÁNºLîÿüN^NuNVÿðHî.¼ (ÜN¹ -| @ˆÿü nÿüJg¾ nÿüAè.ˆ nÿüAè/ nÿüH€HÀ//< (èN¹ ßü .¼ )N¹ nÿüAèL-Hÿø nÿø ÿÿÿÿgN nÿø.¨ nÿø//< )N¹ P nÿø Ѐ"é€"| Añ.ˆ/< )%N¹ XP®ÿø`ÿ¨.¼ )/N¹ ®(ÿü`ÿ<.¼ )2N¹ B®ÿô ®ÿôlN .ÿôç€"å€Ð"| #0J±g, .ÿôç€"å€Ð"| #0Añ.ˆN¹ .¼ )9N¹ R®ÿô`ÿª.¼ );N¹ `LîN^NuNVýâHî|rÿì.¼ )=N¹ HnÿâN¹4X .rÿìfB.ÿâH€HÀ"| 0#1f*.ÿâH€HÀ"| 0#1f.¼ )‡N¹ `ÿ -| @ˆýî nýîJg, nýî°.ÿâf.¼ )«N¹ `ÿp®(ýî`ÿÎ .ýî€ @ˆ.¼(N¹0².€/< )êNº jX.¼ *N¹ HnÿÀN¹4X.¼ *EN¹ |ÿkB.þ?HnÿpN¹4X ..ÿpf`4J.ÿkf.¼ *Hnþ?N¹?"XB.ÿkHnÿpHnþ?N¹?"P`ÿ¶-| ýö nýöJg pÑ®ýö`ÿîB®ýþ .ýö€ r.N¹0²-@ýò.®ýò/< *†Nº ¨X .ýòR€°¹ B¬o .ýòR€#À B¬.¼ *›N¹ Hnþ!N¹4X .qþ!f` Hnþ!/.ýöN¹?BP.¼ *ÏN¹ HnþN¹4X.þH€HÀ"| 0#1g J.þf.¼ +N¹ `ÿºHnþN¹²X-@ýú-nýþýæ .ýæ".ýþÒ®ýú°l< .ýæçˆ"nýîCéL#®ýò .ýæçˆ"nýîCéLAñ".ýæ’®ýþ!AR®ýæ`ÿ¶ .ýúÑ®ýþ .ýæçˆ"nýîCéL#¼ÿÿÿÿ .ýæçˆ"nýîCéLB± .ýö€ .€Hnþ!/< +Nº `P nýöJg pÑ®ýö`ÿî`þz.¼ +=Nº < nýî®ÿâHnÿÀ nýîAè/N¹?BPHnþ? nýîAè/N¹?BP .rÿìf| nýîH€HÀ"| 0#1g nýîH€HÀr0-@ÿÞ` nýîH€HÀr7-@ÿÞ nýîAè.ˆ/.ÿÞ/< +J .ÿÞç€"å€Ð"| #0Añ/N¹ßü `LîN^NuNVýâHî.¼ +TN¹ HnÿîN¹4X-| @ˆÿü nÿüJg nÿü°.ÿîg®(ÿü`ÿÞ nÿüJf.¼ +‚N¹ `¤ nÿüAèL-Hÿø nÿø ÿÿÿÿgN nÿø. nÿø Ѐ"é€"| Añ//< +Nº ÊP nÿø Ѐ"é€"| B1P®ÿø`ÿ¨.ÿîH€HÀ"| 0#1g.ÿîH€HÀr0-@ÿê`.ÿîH€HÀr7-@ÿê .ÿêç€"å€Ð"| #0B1|rÿÖ.¼ +±N¹ Hnÿ¸N¹4X.¼ +ñN¹ |ÿcB.þ7HnÿhN¹4X ..ÿhf`4J.ÿcf.¼ ,-Hnþ7N¹?"XB.ÿcHnÿhHnþ7N¹?"P`ÿ¶-| ýî nýîJg pÑ®ýî`ÿîB®ýö .ýî€ r.N¹0²-@ýê.®ýê/< ,2NºX .ýêR€°¹ B¬o .ýêR€#À B¬.¼ ,GN¹ HnþN¹4X .qþf` Hnþ/.ýîN¹?BP.¼ ,{N¹ HnýûN¹4X.ýûH€HÀ"| 0#1g J.ýûf.¼ ,®N¹ `ÿºHnýûN¹²X-@ýò-nýöýæ .ýæ".ýöÒ®ýò°l< .ýæçˆ"nÿüCéL#®ýê .ýæçˆ"nÿüCéLAñ".ýæ’®ýö!AR®ýæ`ÿ¶ .ýòÑ®ýö .ýæçˆ"nÿüCéL#¼ÿÿÿÿ .ýæçˆ"nÿüCéLB± .ýî€ .€Hnþ/< ,ÅNºHP nýîJg pÑ®ýî`ÿî`þz.¼ ,éNº$ nÿü®ÿîHnÿ¸ nÿüAè/N¹?BPHnþ7 nÿüAè/N¹?BP .rÿÖf| nÿüH€HÀ"| 0#1g nÿüH€HÀr0-@ÿê` nÿüH€HÀr7-@ÿê nÿüAè.ˆ/.ÿê/< ,ö .ÿêç€"å€Ð"| #0Añ/N¹ßü LîN^NuNVÿæHî.¼ -N¹ HnÿîN¹4X-| @ˆÿü nÿüJg nÿü°.ÿîg®(ÿü`ÿÞ nÿüJf.¼ -.N¹ `ö nÿüAèL-Hÿø nÿø ÿÿÿÿgN nÿø. nÿø Ѐ"é€"| Añ//< - nÿð.¨ nÿð//< -ÅHnûÎN¹ßü HnûÎHnüN¹?"PP®ÿð`ÿ¸.¼ -ÏHnüN¹?"XHnü/.ÿüN¹bP®(ÿô`þÈ.¼ -Ü/.ÿüN¹bXB®ûÊ .ûʰ¹ B¬lN .ûÊЀ"é€"| J1g, .ûÊЀ"é€"| Añ.ˆ/< -ð/.ÿüN¹bPR®ûÊ`ÿ¨.¼ -þ/.ÿüN¹bX.¼ .NºÒB.üB®ûÊ .ûʰ¹ B¬lp .ûÊЀ"é€"| J1g* .ûÊЀ"é€"| Añ.ˆHnüN¹?"X`.¼ .%HnüN¹?"X.¼ .'HnüN¹?"XR®ûÊ`ÿ†Hnü/.ÿüN¹bP.¼ .*/.ÿüN¹bX.¼ .PNº"B®ûÊ ®ûÊlZ .ûÊç€"å€Ð"| #0J±g8 .ûÊç€"å€Ð"| #0Añ.ˆ/.ÿüN¹bX.¼ ._/.ÿüN¹bXR®ûÊ`ÿž.¼ .a/.ÿüN¹bXB®ûÊ ®ûÊlZ .ûÊç€"å€Ð"| #0J±g8 .ûÊç€"å€Ð"| #0Añ.ˆ/.ÿüN¹bX.¼ .v/.ÿüN¹bXR®ûÊ`ÿž.¼ .x/.ÿüN¹bX.®ÿè/< .–/.ÿüN¹bP.¼ .¥/.ÿüN¹bX.®ÿè/< .»/.ÿüN¹bP.¼ .Ê/.ÿüN¹bX.®ÿüN¹6V.¼ .Þ/< .ØN¹4¤X @-Hÿø.¼ .à/.ÿøN¹bX.®ÿøN¹6VN¹2ZJ€fFp.€/< //< / /< /N¹20ßü -@ûÆJ®ûÆl.¼ /N¹ p.€N¹@&p .€N¹Ê`LîN^NuNVÿðHîÿô$n&n .Ió·ÌgÛ`ÿö`LîÿôN^NuNVÿüHîLîN^NuNVÿðHî ÿô$nt&H€HÀ € gX € gN €+g& €-g` Ѐ"å€ÐHHÁÐr0$`RƒRŠ 0m 9oÖJƒg D€Lî ÿôN^NuRŠ`ÿ– `ìNVÿìHî ÿø-nÿðJ¹ 1,n8.¼ 1,N¹Úrÿ°f nÿð±îfª‘È Lî ÿøN^NuS¹ 10R¹ 1,$9 1,.‚p //9 10/.N¹¤ßü @-Hÿôg ®$Õ®•¹ 1,Õ¹ 10J¹ 1,lp` 9 1,&9 19H€HÀåˆ"| 2H 1¹ 10°ƒl .¼ 1,N¹:ÐJ®ÿôgÿ8S® nB nÿð`ÿNNVÿôHîÿüAî -Hÿø.¼ 1://.N¹xP$9 1Fg pÿLîÿüN^Nu `òNVÿôHîÿüAî-Hÿø.®//. N¹xP$ n( g pÿLîÿüN^Nu `ò /o("/ "o oS€вWÈÿúg €ÿÿfB€Nu Nu€`ÞNVÿôHî ÿø$nJªf.ŠN¹9ô* f* gÀê * H€HÀrD€g&&| 1,`+ g.‹N¹6Ú×ü·ù 2Deâ%j* gp`* H€HÀåˆ"| 2H 1ª.€/** H€HÀ/N¹?P$€S’m jRªpLî ÿøN^Nu ’ÿÿÿÿgê `ê * g*þ B’pÿ`ÌNVÿèJ®fpN^Nup.€N¹Ü-@ÿð.¼Âp/N¹2pX @-HÿøB®ÿüB®ÿìJ®ÿðgB .ÿð°®c .‘®ÿðR®ÿü`* .®ÿð-@ÿì-nÿðB®ÿðS®ÿü.®ÿøp/N¹2pX.¼ 2¨N¹öJ€f.®N¹ÜN¹äp.€N¹Ü-@ÿôJ®ÿüm.®ÿøp/N¹2pXJ®ÿün J®ÿülJ®ÿôg .ÿðЮÿô.€N¹Ü .ÿìЮÿô`ÿNVÿüp.€/< 2¨N¹XN^Nu0<N@Nu0<N@dNù@B€Nu o —HèüüB€Nu o /fpLèüü.NuNVÿæHîÿü-|ÿÿÿÿî n-Hÿò-Hÿö|ÿú|ÿûAî-HÿêHnÿî//. N¹xßü $ nÿòB LîÿüN^NuNVþHî<ÿì$n&nB®ÿèB.þG(J`RŠH€HÀ$gp%´€fî Œ-@þ"gtÑ®ÿè ®þ"f&S“m kR«`P.‹p/N¹74X`> + f.®þ"/ /+N¹1HP @Ñîþ"'H`.‹/.þ"p// N¹/Zßü J‚f+ f .ÿèLî<ÿìN^Nup-@ÿÜ-@ÿÄ-@ÿÈ-@ÿÌ-@ÿÐRŠH€HÀ$  € g$ €#g" €+g €-fR®ÿÌ`ÎR®ÿÐ`ÈR®ÿÈ`ÂR®ÿÄ`¼p*´€f$pÑ® n -hÿüÿäl .ÿäD€-@ÿäR®ÿÌRŠ`Bp0´€fR®ÿÜB®ÿä` .ÿäЀ"å€Ð"0Ð-@ÿäRŠH€HÀ$ | 0#0(fÎ .gJ®ÿÜg .ÿä`pÿ-@ÿà`VRŠ *fpÑ® n -hÿüÿàRŠ`8B®ÿà` .ÿàЀ"å€Ð"0Ð-@ÿàRŠH€HÀ$ | 0#0(fÎB®ÿÔH€HÀ €hg €lfR®ÿÔRŠ-| />þLAîþG-HþHp-@ÿØ-@ÿÜH€HÀ$ J€gv €Eg¸ €Ggä €XgT €cg €dgL €egŠ €fg€ €gg¬ €og* €sg¤ €ug €xf´p` pÿ`ýþp`p-@þJ®ÿàlp-@ÿàJ®ÿÔfpd´€pÑ® n -hÿüþ>pd´€fBJ®þ>l-| /?þL ®€þ>g* .þ>D€-@þ>`J®ÿÐg -| /AþL`J®ÿÈg-| /CþLpX´€f | /E` | /V-Hþ*Iîþ\*L`DpÀ®þ>-@þ .þ> ÿÿÿ-@þ>.®þN¹>^ЀЮþ"nþ*1.®þ .þ>N¹0²-@þ>J®þ>f¶ Юÿà-@ÿÜJ®ÿÄgȹÍg  €Xg4 €og €xf¦-| /gþL`š ®ÿÜlŽp-@ÿÜ`„-| /jþL`xJ®ÿàlp-@ÿàpÑ® n -hÿøþ6-hÿüþ:Hnþ.Hnþ2 .ÿàR€r°l .ÿàR€`p//.þ:/.þ6N¹"¼ßü @(HJ®þ.g -| /mþL`J®ÿÐg -| /oþL`J®ÿÈg-| /qþLKîþQJgH€HÀ`p0ÀJ®ÿàfJ®ÿÄgü.-nÿàÿØ`ÜS®ÿØJ®ÿØoJfðIîþQ.¹ /*/9 /& .þ6".þ:N¹'zXJ€gê .þ2S€-@þ"J€l”D€`ÀJ®ÿàlp-@ÿàpÑ® n -hÿøþ6-hÿüþ:Hnþ.Hnþ2 ®<ÿàl .ÿà`p + f.®þ"/ /+N¹1HP @Ñîþ"'H`.‹/.þ"p// N¹/Zßü S®ÿØmVS“m kR«r0`ä.‹p0/N¹74X`Ô kR«"nþHR®þH`.‹ nþHR®þHp/N¹74X nþHJg$S“mÜ` kR«r `.‹p /N¹74XS®ÿä .ÿä°®þ&möŒS“mÞ`ÌJ®þ"g@p .€ .þ"N¹>^0r“®þH"nþH€p .€ .þ"N¹0²-@þ"`Èp‘®þH nþH¼0 nþHCîþE±ÉbæJ®þ2n .¹ /2/9 /. .þ6".þ:N¹'zXJ€fp+`p-r“®þH"nþH€ | 0#0(gpE`per“®þH"nþH€`ý>NVÿüp.€/./././. /.Nº>ßü @ N^NuNVÿüp.€/./././. /.Nºßü @ N^NuNVÿØHî<ÿì$n&| 2Ü ."KIñ .àˆàˆèˆ€ÿ €ÿfp.€N¹;/N¹0žX.¹ /~/9 /z .". N¹'zXJ€lp`p"n"€g .". @-@-A B9 2ÜB’.¹ /†/9 /‚ .". N¹'zXJ€gd*| /ŠR’.¹ /Ö/9 /Ò .". N¹'zXJ€m,`>.­/ .". N¹(âX-@-A -Ñ’`.¹ /Þ/9 /Ú .". N¹'zXJ€m`-y /âÿä-y /æÿè` -nÿÜÿä-nÿàÿè.®ÿè/.ÿä 9 /ê"9 /îN¹*®X-@ÿÜ-Aÿà.® /.".ÿàN¹'zXJ€o¸`´.¹ 0/9 0 .". N¹'zXJ€ln`8.­/ .". N¹*®X-@-A -‘’` MÛü ¨o2.­/ .". N¹*®X.¹ 0/9 0 N¹'zXJ€lÀ`ÿ˜J®gÙÒ¹ü 2Üeйü 3*c(| 3*.¹ 0/9 0 .". N¹'zXJ€g·ü 2íe¼0`T .". N¹,R$ 0€ N¹,./ .". N¹'zX./ 9 0"9 0N¹*®X-@-A ·Ìe$&L 5m0·ü 2Üfü1 2ÜR’J®gRŒ`R‹`ÿR¼0R# 9nÐB | 2Ü Lî<ÿìN^Nu MÛü ¨oþü.­/ .". N¹'zXJ€mÒ`ý¨.®ÿè/.ÿä .". N¹(âXN¹,R$ 0À N¹,.®ÿè/.ÿäN¹*®X./ .". N¹'zX-@-A R’.¹ /ö/9 /ò .ÿä".ÿèN¹'zXJ€oþ^.¹ /þ/9 /ú .ÿä".ÿèN¹(âX-@ÿä-Aÿè`ÿZHç?Lï ` Hç?LïNºü "LßüNuHç? o "($/ &/$NºØ " À LßüNuHç? o/N¹,4X$/ &/$Nº¬//N¹,fP €LßüNuHç?$& /"/ `Hç?$/&/ /$"/(Nºj "LßüNuHç? o$&( / "/$NºF " À LßüNuHç? o/N¹,4X$& / "/$Nº//N¹,fP €LßüNu@ã€UÄã‚UŰ‚cÁBÃCÉEH…¹N¹-:JGf(ˆg~ã‰ãJFf ã‹ã’`0À FÿgržFDGQGmà™àˆfôJfð` ^Gkâˆâ‘QÏÿúJkÖÕ€d â’â“RF Fÿm`L–•€dFEDƒ@‚N¹-jN¹-žãMâ’ ‚€fB‚NuÂN¹-Ì`ä(ˆƒfò¾FfîJjê$<ðBƒ`Ð$<ÿàBƒ`ÂHç?$& /"/ `Hç?$/&/ /$"/(Nºj "LßüNuHç? o$&( / "/$NºF " À LßüNuHç? o/N¹,4X$& / "/$Nº//N¹,fP €LßüNu*µ…B„Nºb:šG8<aê,8<aàᄃgÇãã–$&<FÿN¹-”`ô.€ÿÿHGèOÎDfJ€fJgRGSGã‰ãgôNu8<ÿÅ@ÇANºÿÎÁBÃCÏFg¼DgÂNºÿºg ¾Dg,Àã‰ãNuNºÿ¦J„k&¾Fg"J‚g `J„k6†‚g2$<ÿà`Nºº LßNu"`"/Hç8NºVNº0 LßNu$<ÿð&HCÄ€µ€(ˆ€ãŠf<J„g,<`&HBêJ Bÿf4<`<J„g<`ÀSB<B2Nu m €ãˆ€ÿà`B>ÁBÁFÃCNºBNºr, ÇAãKâNux é¸éºé¹é»,<ÿ.Ì‚½‚(ȃ¹ƒâŠ„„(΀¿€È¹âˆ€„NuJ‚f F m F ÇBJ‚gk ã‹ã’[ÎÿúZÎNu<<÷RNuJ‚kSFã‹ã’JFn FÿËmJDFâŠâ“QÎÿúBFƒd R‚dâ’â“RF Fÿl,(<ÿÿøÆ„È‚¹‚†‚$ãŠe FÿgBFx 軄FèºNuB‚BƒNu$<ÿàBƒNu&HCã‰á™BBf<Jg*<`$ ÿf4<`B<Jg<`<SB<B•â™à‰B€Nu8 m ‚€€ã‰`&J€g PDà™àˆfö gkSDãˆjúDžNº à˜"ãKâ‘NuJ€kSDãˆJDn Dÿèm"DRè¨BD€€dâRD Dÿl ãˆUÀÀNuB€Nu <ÿNuBBvJjDÃB€Nu lNº€BJ€f JkJCjDNu"<€Nux JBk&´Dm J€fD”DÃ@`òå¸å¹xå¤S„$Ä„f.ȹ€„`$DB´Dm"B€”D`ôxå¤S„F„„Ȁ¹€‚€ä¼ä¹ B‚NuNuNVÿäHîÿè$nJ® oLJ®oF* H€HÀrÀr°f"Jªg j±êf J’f* H€HÀrD€f.ŠN¹98J€f`pg pLîÿèN^Nu* H€HÀåˆ"| 2H(q.® .N¹1Î$&j ‹&n,.ŠN¹8Œrÿ°fæ Ю S€.® N¹?Z".’€ `ÿœ´ƒd ` &.ƒ/./ N¹1HP—’תJ’lp` (* H€HÀåˆ"| 2H 1ª°„l.ŠN¹:Дƒf* H€HÀrD€g.ŠN¹8Œ .`ÿ(×®`ÿN0<%N@dNù@B€NuNVHç<zJ€lD€D…&".l&DD…` NVHç<z .lD€D…&". lDD…( lB@H@€Á40€ÁH@0H@`*â€â lô€Á€ÿÿ$//N¹?ÚP¶€lS‚ J…lD€LßþP(mB’ @ J‚g <€`‘È LîÿðN^Nu n rfp`p@ ‘È%H%H J`ÒNVÿøHîÿü$| 1,`µù 2De‘È LîÿüN^NuÕü* H€HÀ@ƒfÖ J`ÜNVÿøHîÿü$| 1,` .ŠNºÕüµù 2DeìLîÿüN^NuNVÿôHîÿø$ntÿ gd* H€HÀ@ƒg2* gp`.ŠNºP$* H€HÀ.€N¹>J€l tÿp#À 2¤* g.ªN¹<ìBªB* B’%j LîÿøN^NuNVÿøHîÿü$n* fB’pLîÿüN^Nu.ŠNºŠ* f* gJªg j±êbÚ* gpÿ`Äp`ÀNVÿöHîÿü$n * H€HÀrRÀrB°fT* H€HÀåˆ"| 2H q"j³ÈdØ jRª.   fZ.ŠNºrÿ°f LîÿüN^Nup. `î* H€HÀrÀr°f:n ÿûp.€Hnÿû* H€HÀ/N¹@ Pr°f p. `ÿ®ê `Š* H€HÀrÀr°f"Jªg j±êfJ’f* H€HÀrD€f .ŠNº J€fJ`pfD* H€HÀrD€fþü.ŠNº@S’m jRª. `.Šp. /NºþÄX* gpÿ`ÿp. `ÿ NVÿìHî ÿð$n&j *‹$%K* H€HÀrD€gp`* H€HÀåˆ"| 2H 1ª$€J€lp` &* H€HÀåˆ"| 2H 1ª°ƒl.ŠNºÎJ‚o,.‚/ * H€HÀ/N¹@ P´€gê pÿLî ÿðN^Nup`òNVÿôHîÿø$n* H€HÀrÀr°g** H€HÀ@‚f pÿLîÿøN^Nu* ï@ Jªf.ŠNºh j±êfV* H€HÀrD€fH* H€HÀåˆ"| 2H 1ª$€J€lp` $* H€HÀåˆ"| 2H 1ª°‚l.ŠNºäp`ÿvNVÿìHîÿð$n* H€HÀ$p´€l. åˆ"| 1$ q%HAè&H* H€HÀåˆ"| 2H#‹`f.¼N¹;@ @%Hg&ê * H€HÀåˆ"| 2HAñ"jCé ‰`, çˆ"|ÇìAñ%HAè(H* H€HÀåˆ"| 2H#Œ%j.‚N¹>"J€g* fê LîÿðN^NuNVÿôHîÿø$n* H€HÀåˆ"| 2H 1ª$l* H€HÀåˆ%qLîÿøN^Nu´’lò$‚`î0<N@Nu opÿJWÈÿüg€`ðR€D€NuNVÿðHî ÿôJ¹ 3,f4p€ 30 @#È 3,p€ 3, @#È 30#ü 30 38#ü 3, 34 .^€"ä‰$$y 34B¹ 3@`(·ù 38fòµü 3,fèR¹ 3@ ¹ 3@n„*f,`#Ê 34$“&R+gî åˆAò·Èe åˆAò±Êd&JpþÀ’ @$HµËcÿ–`º åˆAò#È 34·Èc#Ð 3< y 34 ’p€¹ 34 @$ˆAê Lî ÿôN^Nu €"à‰ áˆ#À 3@p.€N¹=Ì @&H 9 3@åˆAó±Ëe 9 3@åˆ.€N¹=Ì @&H rÿ°f‘È`ÿ  y 38 ‹ y 38Aè·Ègp"y 38€‘ @"ˆ 9 3@åˆAóAèÿü&ˆ#È 38r 3,"A ‰`þ®NVÿôHî ÿø$n&JY‹#Ë 34pþÀ“ @&ˆLî ÿøN^NuNVÿäHî ÿô&n+ÿÿg.®Nºÿº +ÿü‹ä€-@ÿè.® Nºýú @$H gnµËgh-Kÿð-Jÿì . V€"ä‰$´®ÿèd-Bÿè` nÿìX®ÿì"nÿðX®ÿð ‘ .ÿèS®ÿèJ€fâµËd$ åˆAò±Ëe åˆAò"’‹äå‰%¹ 3< J Lî ÿôN^Nu 9 2œÑ¯0<N@dNù@ 9 2œ#ï 2œNu0<N@dNù@#ï 2œB€Nu0<N@dNù@B€NuNVÿêHnÿî/<T/.N¹>Nßü J€lpN^Nup`ø0<6N@dNù@NuNVHç8B„J€lD€F„$".l"D`NVHç8B„ .lD€F„$". lF lB@H@€Á0€ÁB@H@`,&â€â lô€Á€ÿÿ//N¹?ÚP´€lƒ‚D€J„lD€LßN^Nu0<N@dNù@Nu0<N@dNù@Nu0<N@dNù@Nu o"oJWÈÿüføSˆÙWÈÿüfø /Nu o"opÿÙWÈÿüfö /NuNVHç8&".(`NVHç8 .&". ( lH@€ÿÿ€Á40€ÁH@0H@`2â€â€ lì€Á€ÿÿ$//N¹?ÚP¶€lS‚ LßN^NuNVHç0$.&. B€0ÀÃ2HBÄÃHCÂÃÒ‚HABAÐLß N^Nu0<N@dNù@Nu#À 2¤pÿNuNVÿüN¹6&.®N¹@>N^Nu0<N@Nr 'à (Diagnostic Disk Generator Tool Review, Add, Change, Delete, Make Source, Save (r,a,c,d,m,s)? Entry defaultdefault./diagfileopened diagfile = %d TestList = %d fn_array = %d menu[0] = %s TestList = %d fn_array = %d menu = %s Write problem! Test list: identifier='%c', test='%s', desc = '%s' spec list:{%d,%d} (fn %s), Menu: One-character menu identifier of test (A-Z translated to 10-36 on menu): Command name must be digit or A-Z Identifier already used; try another or use change or delete found good tl, index = %d Name of test that will appear on menu (30 characters or less): Description of test for help requests (enter '.' to quit): \n\ found fn_index = %d Name of function call to execute test (q to quit): Number of subtests associated with this function: Bad number of subtest put fn %s in array = fn_array + %d out of loop %d) %s\n\Enter the identifier of the tests to delete: No such test Deleting function %s (index %d) Name of test that will appear on menu (30 characters or less): Description of test for help requests (enter '.' to quit): \n\ found fn_index = %d Name of function call to execute test (q to quit): Number of subtests associated with this function: Bad number of subtest put fn %s in array = fn_array + %d out of loop %d) %s\n\Enter the identifier of the tests to delete: No such test Deleting function %s (index %d) ./edscriptwCouldn't make source writing testlist e main.c /TestList\[\]/ a { '%c', "%s", "%s", {{%d,%d}, {-1,0} } }, . /fn_array\[\]/ i extern %s(); . /fn_array\[\]/ a writing functions 0, . w newmain.c e msg.c /--menu1/ d i Writing menu: \n\ . /--menu2/ d i \n\ . 1 /Please select.*'#'/ s/'#'/1 - %d/ /Please select.*'#'/ s/'#'/1 - %d/ w newmsg.c q ./edsw/bin/ed < ./edscript > /dev/null /bin/sh/bin/sh./edsexec failed -+ 0123456789ABCDEF0123456789abcdef0x0X-+ -+ F“¸µµn CAÃy7à€A—ׄ@È@Y@$C@@$@$@$@$@$?ð@$@$ ((((( H„„„„„„„„„„‚‚‚‚‚‚ Ȕ̜ÇüÇü 2DÈФ.text,.data .bss 2 XX1 .fileÿþgdiag.c.text,†.data /&.bss 2¨.fileÿþgatoi.c.text²‚.data /&.bss 2¨.fileÿþggets.c.text4ì.data /&.bss 2¨.file'ÿþgprintf.c.text B.data /&.bss 2¨.file8ÿþgfprintf.c.textbB.data /&.bss 2¨.text¤6.data /&.bss 2¨L2ÒL0¸L1Î.file@ÿþgfilbuf.c.textÚð.data /&.bss 2¨.file^ÿþgsleep.c.textÊ .data /&.bss 2¨4slenv 2¨awakeÂ.textÜ.data /&.bss 2Ü.textä.data /&.bss 2Ünoerrorò.textö&.data /&.bss 2ÜL13.filefÿþgsprintf.c.text\.data /&.bss 2Ü.filenÿþgdoprnt.c.textx D/.data /&T.bss 2Ü.fileÿþgecvt.c.text"¼@<.data /z¨.bss 2ÜPcvt#buf 2Ü.text&üæ.data 0".bss 3,add_comm'd_add(sub_comm' d_sub( dadd1("nunfl(Duseln(´gu1(Hshz(tovfl(Àshl(Vshx(hshy(ldiff(Œendas(žgeninf(Ødiff2(˜assgn(¤asexit(¨asbye(²usel(¸.text(âÌ.data 0".bss 3,div_comm)d_div)textrem)Þshsub*rdd4)ždmsign*¨unp)¶unpxit)Üunp2)Îunpl)Ðtopzero)útopbig*botzero* botbig*0isnan*<geninf*(gennan*Zclrbot*lgenzero*jusetop*˜isn2*Bisn4*Hgotnan*fsign*nshs1*tshs7*–dmexit*¬.text*®h.data 0".bss 3,mul_comm*Äd_mul+,eswap+<ofl+Þufl+ôback+Zmsign+Ømexit+Ügennan,signed0,normu+ú.text,D.data 0".bss 3,cvid_com,i_unpk.Îd_pack- fd_comm,8f_unpk.i_pack.àf_pack.Ncvif_com,Šcvfi_com,¦dunp2,Þdunp8-dunp3,údunp9-dpk0-dpksgn-4norm1-~norm-€canceln-Žnormxit-Œdrcpok-´dsgned0-òdenl-ªdrcp1-Ædrcpbig-øusel-Ìdra-èunp2.unp8.Bunp3.8unp9.Fspk0.bspksgn.ˆspk2.pspk1.fspk5.|spk4.vf_rcp.Žrcp1.–rcp2.¨signed0.Ârcp4.´rcpbig.Æiupos.Übigi.ügnsh/ipz.úg_nsh/shr/0ll/ simpl/nshofl/Vnshxit/Tlr/2simpr/>.file-ÿþgfwrite.c.text/ZD .data 0".bss 3,.text0ž.data 0".bss 3,noerror0®.text0²–.data 0".bss 3,XX1000ÄL20òXX10æXX31XX51:XX418XX61@.text1H†.data 0".bss 3,bcp5001”bcp9001†bcp3501bbcp4501|bcp4001jbcp4701Œbcp4601€bcp6001ªbcp6501²bcp6701Æ.file@ÿþgctype.c.text1Î.data 0".bss 3,.text1Îb.data 1$.bss 3,XX01àL22 XX12XX22 XX32(.fileWÿþgexecl.c.text20.data 1$.bss 3,.text2N .data 1$.bss 3,.text2Z.data 1$.bss 3,forkok2hparent2nchild2l.filemÿþgsignal.c.text2pÔ.data 1$.bss 3,.text3DN.data 1$.bss 3,_sigrte4j.text4’.data 1$.bss 3,noerror4¢.filevÿþgfopen.c.text4¤B.data 1$.bss 3,_endopen4ü.file~ÿþgfindiop.c.text5æ@.data 1$.bss 3,.file†ÿþgflsbuf.c.text6&ö.data 1$.bss 3,.fileœÿþgdata.c.text;.data 1$x.bss 3,.text;.data 2œ.bss 3,.text;$.data 2œ.bss 3,L0;*L1;:.file¸ÿþgmalloc.c.text;@Œ!.data 2œ.bss 3,allocs 3,allocp 34alloct 38allocx 3<.text=ÌB.data 2œ.bss 3Dnd 2œnoerr1=änoerr2>.text>.data 2 .bss 3Dnoerror>.fileÿþgisatty.c.text>",.data 2 .bss 3D.text>N.data 2 .bss 3Dnoerror>\.text>^Ž.data 2 .bss 3DXX0>pL2>šXX1>XX2>šXX3>²XX6>ÞXX4>´XX5>ÚXX7>ä.text>ì.data 2 .bss 3Dnoerror>ü.text>þ.data 2 .bss 3Dnoerror?.text?.data 2 .bss 3Dnoerror? .text?" .data 2 .bss 3DL0?*L1?4.text?B.data 2 .bss 3DL0?JL1?L.text?Z€.data 2 .bss 3DL1?€XX1? XX3?ÒXX2?Ð.text?Ú0.data 2 .bss 3DXX3@.text@ .data 2 .bss 3Dnoerror@.text@ .data 2 .bss 3D.file'ÿþgcuexit.c.text@&.data 2 .bss 3D.text@> .data 2 .bss 3Dexit@&environ 2 _startmain,errno 2¤EntryBan Request diagfile 3Dbuf 3HTestList @ˆfn_array menu #0dummyžstrcpy?Bload_dia~printf gets4get_reviadd_entrfchange_e *delete_e >make_sou¤unload_d²open>þread?bcopyjlseek>ìwrite@ close>_ctype 0"ldiv__0²strcat?"atoi²sprintffopen4¤fprintfbfclose6Vfork2Zexecl20sleepÊ_iob 1,_filbufÚmemccpy¤_bufendt 2H_bufsync:Ð_doprntx_findbuf9ôfflush6Ú_lastbuf 2DalarmÜsignal2psetjmpöpauseälongjmp__cerror@_flsbuf74memcpy1Hfwrite/Zlrem__>^ecvt"¼dbsub__'zfcvt"êstrlen;$getpid;kill0ždbdiv__(âdbmul__*®dbtol__,Rltodb__,fadd'afadd' afaddf'Hfsub'Œafsub'®afsubf'Ödbadd__&ü_cvfd,4_cvdf,fd_exte-:d_norm-jd_rcp-žd_usel-Ìfdiv(ôafdiv)afdivf)>d_nrcp-”fmul*ºafmul*Òafmulf*ú_cvid,_cvdi,J_cvif,†_cvfi,¢fltodb__,0fltol__,ždbtofl__,nltofl__,‚ultofl__,‚ultodb__,d_unpk,ºfltused/X_wrtchk98lmul__1Î_xflsbuf8Œuldiv__?Zldiv0Òulmul?Úlmul1ìexecve2N_sigfuncÇhsigtrap4’_sighnd3Dfreopen4È_findiop5æ_cleanup6&free<ì_stdbuf 1$malloc;@_smbufÇìisatty>"_sibufÈ”_sobufÌœsbrk=Ìrealloc=sbrk2=Ì_endФÿÿbrk=ôioctl>Nlrem>|uldiv?l_exit@>_etext@Hÿÿetext@Hÿÿ_edata 2 ÿÿedata 2 ÿÿendФÿÿ0707070000020025661006660001460001440000010320540352172613700001500000036751mkdiag/msg.c/* Convergent Technologies - System V - Jul 1983 */ /*static char msg_c[] = "@(#)msg.c 1.4";*/ /* User Diagnostic Headers */ char *pHdUD1 = "\n\n\n\ UNIX PC DIAGNOSTIC, VER 2.1\n\ ---------------------------\n\n\n\ --menu1--\ To boot UNIX, remove diagnostic disk and reset machine or type 'UNIX'.\n\ Press the Break key to abort any test.\n\n\ Please select test number '#':"; char *pHdUD2 = "\n\n\n\ UNIX PC DIAGNOSTIC, VER 2.1\n\ ---------------------------\n\n\n\ --menu2--\ To boot UNIX, remove diagnostic disk and reset machine or type 'UNIX'.\n\ Press the Break key to abort any test.\n\n\ Please select test number '#':"; char *pVid_test_msg = "\n\n\n\ UNIX PC VIDEO TEST \n\ ------------------\n\n\ 0) All Black\n\ 1) All White\n\ 2) Half Tone\n\ 3) Vertical Bars\n\ 4) Horizontal Bars\n\ 5) Mosquito Net\n\ 6) Black pattern\n\ 7) White pattern\n\ 8) All w's\n\ 9) Exit.\n\n\n\n\n\n\n\n\ At the end of a test, press any key to get back to this menu.\n\n\ Please select test number 0 - 9 :(Return is 0) "; #ifdef FCC char *pFcc_msg = "\n\n\n\ S4 FCC TEST \n\ ***********\n\n\n\ 1) LOW BAND TRANSMITTING MARK \n\n\ 2) LOW BAND TRANSMITTING SPACE\n\n\ 3) HIGH BAND TRANSMITTING MARK\n\n\ 4) HIGH BAND TRANSMITTING SPACE\n\n\ 5) TOGGLE BETWEEN LINE1&2\n\n\ 6) DTMF TEST \n\n\n\n\n\n\n\ Configure the test by typing the appropriate number:\n\n\n"; #endif /* FCC */ char *pHeader = "\nS4 DIAGNOSTICS - V"; char *pHdMem = "\nMEMORY TEST"; char *pEHdMem= "\nEXPANSION MEMORY TEST"; char *pHdMap = "\nMAP TRANSLATION TEST"; char *pHdPF = "\nPAGE FAULT TEST"; char *pHdClk = "\nCLOCK TEST"; char *pHdPar = "\nPARITY TEST"; char *pHdMRM = "\nMAP RAM TEST"; char *pHdUIE = "\nUSER I/O INTERRUPT TEST"; char *pHdPrt = "\nPAGE PROTECTION TEST"; char *pHdLP = "\nLINE PRINTER TEST"; char *pHDVid = "\nVIDEO TEST"; /* Help Header */ char *pHdHelp = "Commands formatted as follows:\n\ \t[][L | C] or\n\ \t[]:[,][L | C]\n\ \t\tML [0 - 16] displays [modifies] Message Level\n\ \t\tP[E | M] toggles Parity Enable | Page Mode\n\ \t\tMultiple commands may be separated by ;\n"; /* Line Printer test */ char *pLPhd1 = "\n\tLINE PRINTER SUBTEST 1, Status Test."; char *pLPhd2 = "\n\tLINE PRINTER SUBTEST 2, Transfer Test."; /* Memory test */ char *pAddrError = "\tMemory error at Address %x: Wrote %x; Read Back %x.\n"; char *pMemsize = "\n\tTest will begin at %x, end at %x"; char *pMemE1 = "\tMemory error: Connection on address line %d is bad at bank %d"; char *pMemE2 = "\tMemory error: Connection on address line %d is bad at bank %d.\n\t\Wrote %x to %x, then wrote %x to %x, read back %x from %x."; char *pData = "\n\tDATA TEST"; char *pAddr = "\n\tADDRESS TEST"; char *pRand = "\n\tRANDOM PATTERN TEST"; /* Map test */ char *pSHdMap = "\tMAP TRANSLATION SUBTEST"; char *pDirtyError = "\tPage dirty bit not set for page number"; char *pPageMapError = "\tPage mapping error: map number, logical address, and address read back are"; char *pPMUserErr = "\t**Page Mapping Error**\n"; char *pAccessError = "\tPage access bit not set for page number"; char *pPageAccessError = "\tPage access bits wrong: page number and page bits are "; /* Page Fault test */ char *pPFHd1 = "\n\tSUBTEST 1, CPU ACCESSING INVALID PAGE"; char *pPFHd3 = "\n\tSUBTEST 2, USERS ACCESSING BELOW 512K"; char *pPFHd4 = "\n\tSUBTEST 3, USERS WRITING TO WRITE DISABLED PAGE"; char *pPFE12 = "\tBSR incorrect after %s error at location %x\n\tBSR0 = %x\n\tBSR1 = %x"; /* Page Protection Test */ char *pPrErr1 = "\tNo page fault received on write"; char *pPrErr2 = "\tNo page fault received on read"; char *pPrErr5 = "\tBus Error when none expected"; char *pPrErr6 = "\tNo Bus Error received on write, after page write being disabled"; char *pPrErr7 = "\tDisabled Ram Writing failed at mem loc %x"; char *pPrErr8 = "\tNo Bus error detected, while user accessing below 512K memory.\n\tMem addr = %x"; /* Parity test */ char *pParHd1= "\n\tPARITY TEST - READ/WRITE TEST"; char *pParHd2= "\n\tPARITY TEST - EXECUTION TEST"; char *pParE1 = "\tNo Parity Interrupt at location %x"; char *pParE2 = "\tBSR incorrect after parity error at location %x\n\tBSR0 = %x\n\tBSR1 = %x"; char *pParE3 = "\tUnexpected parity error at location %x\n\tBSR0 = %x\n\tBSR1 = %x"; /* Clock test */ char *pHdSClk = "\tSubtest 1 - Timer 1/Counter 2 TEST"; char *pClkE1 = "\n\tTime out while waiting for 60Hz interrupt."; /* User I/O Errors */ char *pSHdUIE = "\tUSER I/O INTERRUPT SUBTEST"; char *pUIEnoInt = "\tNo bus error when user access I/O address %x"; /* Trap handling */ char *pDoubleB = "\n\tDouble Bus Error"; char *pTrapdb = "\tType = %d, GSR = %x, BSR0 = %x, BSR1 = %x.\n"; /* char *pPErr0 = "\tRepeated fault."; char *pPFErr1 = "\tBad GSR after page fault."; char *pPFEErr1 = "\tBad GSR after execution page fault."; char *pPFErr3 = "\tBSR not correctly set after Page Fault:\n\ \t\tBSR0 = %x, should be %x\n\tBSR1 = %x, should be %x\n"; */ char *pBusStrayInt = "\tUnexpected bus error, GSR = %x, PC = %x, RPS = %x\n "; char *pNMIStray = "\tUnexpected NMI, PC = %x, RPS = %x\n\ \t\tGSR = %x BSR0 = %x BSR1 = %x\n"; char *pIntStray = "\tUnexpected interrupt from level %d, PC = %x, RPS = %x\n\ \t\tGSR = %x BSR0 = %x BSR1 = %x\n"; char *pSpurInt = "\tSpurious interrupt from level %d, PC = %x, RPS = %x\n\ \t\tGSR = %x BSR0 = %x BSR1 = %x\n"; char *pTrapError = "\t%s Interrupt level %d, PC = %x, RPS = %x\n\ \t\tGSR = %x BSR0 = %x BSR1 = %x\n"; char *pStrayStatus = "\tPC = %x, RPS = %x\n"; /* char *pUIEerr0 = "\tUser I/O flag in GSR not set during User I/O test"; char *pUIEerr1 = "\tLWT in GSR set during user I/O fault"; char *pUIEerr2 = "\tBus Grant set to DMA cycle during USER I/O fault"; char *pUIEerr3 = "\tBSR not correctly set after User I/O fault:\n\ \t\tBSR0 = %x, should be %x\n\t\tBSR1 = %x, should be %x\n"; */ /* DISK MESSAGES */ char *pHdDSK = "DISK TEST"; /* Disk test */ char *pdskBBTEnt = "The Bad Block Table contains %d entries.\n"; char *pFormatErr = "%s:Error during Disk Format:Response = %x\n"; char *pBadCyl = "%s:Not on Cylinder zero after Recal:Maybe on %d,Response = %x\n"; char *pBadRecal = "%s:Can't Recal:Response = %x\n"; char *pCantWrVHB = "%s:Can't Write the new VHB:Response = %x\n"; char *pCantWrBBT = "%s:Can't Write the new Bad Block Table:Response = %x\n"; char *pDSKd1 = "\tRECAL DISK\n"; char *pDSKd2 = "\tFORMAT DISK\n"; /* char *pDSKd3 = "\tWRITE & READ TEST\n"; */ char *pDSKd4 = "\tDISK READ TEST.\n"; char *pDSKd5 = "\tRANDOM SEEK TEST\n"; char *pDSKd6 = "\tNON DESTRUCTIVE SURFACE TEST.\n"; /* char *pDSKd7 = "\tDisk Read function.\n"; */ char *pDSKd8 = "\tMODIFY BAD BLOCK TABLE\n"; /* char *pDSKd9 = "\tForce DMA Faults.\n"; */ char *pDSKd10 = "\tInitialize VHB and BBT.\n"; /* char *pDSKd11 = "\tWrite VHB and BBT after aborted Test 3.\n"; */ char *pDSKd12 = "\tPRINT VHB.\n"; /* char *pDSKd13 = "\tDownload to Disk.\n"; char *pDSKd14 = "\tToggle Alien Disk mode.\n"; char *pDSKd15 = "\tFloppy Read Track.\n"; char *pDSKd18 = "\tInstall partition from floppies.\n"; char *pDSKd19 = "\tCreate floppy archive of a partition.\n"; */ char *pDSKd23 = "\tSURFACE TEST\n"; /* char *pDSKd25 = "\tSort Bad block table.\n"; char *pDSKd27 = "\tFormat disk, no surface test.\n"; */ char *pDSKTest = "\t(DiskTest 001) Illegal subtest number for Disk test: %d.\n"; char *pDSKWriteError = "\t%s:Error on Write:Response = %x,Start Block = %d\n"; char *pDSKReReadError = "\t%s:Error on Re-Read:Response = %x,Start Block = %d\n"; char *pDSKDataReRead = "\t%s:Re-Read Data miscompared :Start Block = %d,\n\t\tByte =%d,Received %x, Expected %x\n"; char *pDSKCheckReadError = "\t%s:Error on Check-Read:Response = %x,Start Block = %d\n"; char *pDSKChDataError = "\t%s:Check-Read Data miscompared :Start Block = %d,\n\t\tByte =%d,Received %x, Expected %x\n"; char *pDSKReadError = "\t%s:Error on Read:Response = %x,Start Block = %d\n"; char *pDSKInitCheckRead = "\t%s:Initiating Check Read for pass %d\n"; char *pDskGiCylinders = "\tGive # of Cylinders (RETURN = default of %d)\t\t:"; char *pDskGiTracks = "\tGive # of Tracks per Cylinder (RETURN = default of %d)\t:"; char *pDskGiSectors = "\tGive # of Sectors per Track (RETURN = default of %d)\t:"; char *pDskCylsTrksSecs = "\n\tCylinders = %d, Tracks = %d, Sectors = %d\n"; char *pDskGiData = "\tGive Data Pattern in hex (RETURN = default of address)\t:"; char *pDskGiBegin = "\tGive start Logical Block (RETURN = default of %d)\t:"; char *pDSKgiszblks = "\tGive size in Blocks (Default = %d)\t:"; char *pDskGiBlocks = "\tGive # of Blocks to transfer (RETURN = default of %d)\t:"; char *pDskGiRepeats = "\tGive # of Times to Repeat (RETURN = default of %d)\t:"; char *pDskGiMaxSize = "\tGive Max transfer size in Blocks (RETURN = default of %d)\t:"; char *pDsk1Display = "\n\tData Pattern = 0X%x, Start Block = %d, # Blocks = %d,\nIncrement = %d, Repeats = %d\n"; char *pDskGiBuffer = "\tGive Buffer Address in hex (RETURN = default of 0X%x)\t:"; char *pDskGiMBlock = "\tGive Maximum Block # (RETURN = default of %d)\t:"; char *pDsk2Display = "\n\tBuffer Address = 0X%x, Start Block = %d, # Blocks = %d\n"; char *pDsk3Display = "\n\tMaximum Block = %d, Repeat count = %d\n"; char *pDskGiName = "\tGive Pack Name (RETURN = default of %s)\t\t:"; char *pDskGiStep = "\tGive Step Rate (RETURN = default of %d)\t:"; char *pDskGiDensity = "\tGive Density (RETURN = default of %d)\t:"; char *pDskGiPartitiion = "\tGive Size of Partition %d (RETURN = default of %d)\t:"; char *pDsk1Error = "\t%d is too large. %d is assumed.\n"; char *pDsk2Error = "\tMust be a track multiple. %d is assumed.\n"; char *pDSKBBTOverflow = "\t%s:Bad Block Table Overflow when adding Sector %d.\n"; char *pDSKBBTDup = "%s:Bad Block Table: Multiple use of alternate %d.\n"; char *pDSKAddBBT = "Added Bad Block: Cylinder %d, Track %d, Sector %d.\n\tUsed Track %d as the Alternate.\n"; char *pDSKDelBBT = "Deleted Bad Block: Cylinder %d, Track %d, Sector %d.\n"; char *pDSKNoBBT = "\tBad sector %d on device with no bad block table."; char *pDSKInvalidDSK = "%s:Disk is not S4 Format: Run the Format Test.\n"; char *pDSKNParErr = "%s:No parity error on disk DMA\n"; char *pDSKBSRBadErr = "%s:Improper BSR after disk DMA parity error. \n\ BSR0 = %x, BSR1 = %x\n"; char *pDSK1BSRBadErr = "%s:Improper BSR after disk DMA page fault.\n\ BSR0 = %x, BSR1 = %x\n"; char *pDSKNPFErr = "%s:No page fault on disk read.\n"; char *pDSKNAccErr = "%s:Page status not = accessed after disk write, reg = %x.\n"; char *pDSKNModErr = "%s:Page status not = modified after disk read, reg = %x.\n"; char *pHD_Type = "\nSelect disk type:(hit RETURN to exit)\n\n\ 0 - Miniscribe ( 10 Megabyte )\n\ 1 - Atasi ( 40 Megabyte )\n\ 2 - Maxtor ( 40 Megabyte )\n\ 3 - Seagate ( 10 Megabyte )\n\ 4 - Miniscribe ( 20 Megabyte )\n\ 5 - Rodime ( 40 Megabyte )\n\ 6 - Others\n\n\ Please select a number:( Current selection is %d ) "; char *pVHBBad = "\nVHB is bad. Disk has to be initialized."; char *pDiskFmt = "\nDo you want to initialize the %s disk ?\n( ALL DATA WILL BE ERASED ! ) Y/N : "; char *pDiskEntBBt = "\nDo you want to modify bad blocks ( Y/N ) ?"; char *pDskNoBB = "\tBad block not found!\n"; char *pBBTLost = "\tBad block table lost!"; char *pDiskStd10 = "\nThe standard internal hard disk is a 10 Megabyte MiniScribe.\nDo you have the standard disk( Y/N ) ?"; #ifdef LATER /* 8274 MESSAGES */ char *pHdRS232 = "DATA COMMUNICATION TEST(8274)"; /* RS232 test */ char *pRS232d1 = "\t(SUBTEST 1) TEST 8274 CONTROL OPTIONS.\n"; char *pRS232d2 = "\t(Subtest 2) DATA TRANSFER TEST.\n"; char *pRS232d3 = "\t(Subtest 3) ERROR CONDITION TEST\n"; char *pRS232Test = "\t\t(RS232Test 001) Illegal subtest number for RS232 test: %d.\n" ; char *pNoFrameErr = "\t\tDidn't receive Frame Error"; char *pRSBadData = "\t\tCorrupted data at specified byte (RX/TX data):"; char *pRSDataNotSent = "\t\tData not transmitted after ~2 seconds for"; char *pRSNoRX = "\t\tNot all the data has been received, so far:"; #endif /* LATER */ char *pRSCarrierNotOn = "\t\tCarrier Not On\n"; /* Video Test */ char *pVidAddr ="\tDMA Address Reg Error, wrote %x, read %x\n"; char *pVidUserErr ="\n\t**Video Memory Error**\n"; char *pVidFill ="\tVideo Map Error, addr %x, wrote %x, read %x (bytes)\n"; /* Keyboard/Mouse Test */ char *pKbdST[] = { "\tKEYBOARD & MOUSE SUBTEST 1, Typing Test", "\tKEYBOARD & MOUSE SUBTEST 2, Mouse + Keyboard Test", "\tKEYBOARD & MOUSE SUBTEST 3, Mouse Drawing" }; /* ----------------------------------------- | Real time clock messages | ----------------------------------------- */ char *pRTC_HEADING = "\nREAL TIME CLOCK TEST"; char *pUnknown = "\n\tUNKNOWN TEST %d !!!"; char *pRTCread_write = "\n\tREAD/WRITE TEST"; char *pRTCoperation = "\n\tOPERATION TEST"; char *pRTCinteractive = "\n\tINTERACTIVE TEST"; char *pRTCRW_ERROR ="\n\tRead/Write error at %s counter."; char *pRTCOP_yrleap ="\n\tLeap year is not recognized. "; char *pRTCOP_handlleap ="\n\tLeap year is not handled correctly. "; char *pRTCOP_updateleap ="\n\tNext leap year is not calculated correctly. "; char *pRTCOP_ERROR ="\n\t%s counter is not maintained correctly. "; char *pRTCIN_timemsg ="\n\tIt is %s %d/%d/%d %d:%d:%d"; /*ex: Tues 1/1/84[ 1:1:1 */ char *pRTCIN_intro ="\n\tThis test allows you to set or read the time and date from the\n\treal time clock.\n\t\ When the '>' prompt appears, enter 't'or 'd' to request the time(date)\n\tand to enter a new time(date).\n\t\ Press 'Return' alone to keep the old time( date ).\n\t\ To exit, enter 'q'.\n"; char *prompt ="\n\t>"; char *pRTCIN_leapmsg ="\n\tWe have a leap year."; char *pRTCIN_dateenter ="\n\tPlease enter a new date?(Ex: Tues 4/12/1984)"; char *pRTCIN_entertime ="\n\tPlease enter a new time?(Ex: 14:17:7)"; char *pRTCenter_error ="\n\tIllegal entry. Sorry!"; char *pRTCyearover ="\n\tYears must be within 1901-2099."; char *pRTCTEST_OK ="\n\tTest succeeded with no errors detected!\n"; #ifdef LATER char *pRTCIN_rwmsg ="\n\tEnter register address and data in decimal(must enter 2 numbers\n\tseparated by a comma:"; char *pRTCINdata ="\n\tAddress = %d Data = %d"; #endif /* LATER */ /* ----------------------------------------- | Line printer messages | ----------------------------------------- */ char *pLP_notprsnt = "\nLine printer not present."; char *pLP_busy = "\nLine printer is busy."; char *pLP_selected = "\nLine printer is selected."; char *pLP_outpaper = "\nLine printer is out of paper."; char *pLP_lperror = "\nDetected error at line printer."; #ifdef LATER /* Expansion bus test */ char *pXpHd = "\nEXPANSION BUS TEST"; char *pXpslot = "\nPlease enter the expansion slot # to be tested(0-2)?"; char *pXpE1 = "\n\tExpansion bus error at slot %x, DMA write %x fail at location %x"; char *pXpE2 = "\n\tExpansion bus error at slot %x, DMA read does not compare.\n\tWrote %x to %x, read back %x"; char *pXpE3 = "\n\tNo interrupt acknowledgement on level %x at expansion slot %x"; char *pXpInt = "\n\tEXPANSION BUS INTERRUPT"; char *pXpE4 = "\n\tNo Parity interrupt at expansion slot %x"; char *pXpE5 = "\tExpansion bus error at slot %x, Connection on address line %d is bad at bank %d"; char *pXpE6 = "\tExpansion bus error at slot %x, Connection on address line %d is bad at bank %d.\n\t\DMA Wrote %x to %x, then DMA wrote %x to %x, DMA read back %x from %x."; #endif char *pRecord = "\nPlease record these errors!"; char *pCont = "\nType any key to continue."; 0707070000020025671006660001460001440000010320750352172613500001600000035167mkdiag/main.c/* Convergent Technologies - System V - Jul 1983 */ /*static char main_c[] = "@(#)main.c 1.4";*/ unsigned char TEST_ON = 0; /* if TEST_ON=1 then testing */ unsigned char TEST_STATUS = 0; /* added 05/08 to prevent undesirable test abortion, 0 is OK to abort, 1 is not */ extern unsigned char P2_P3 ; #include "diag.h" #include "sys/hardware.h" #define CMD_SIZE 50 #define USER_CMD_SIZE 10 /* The various predefined tests are maintained in the data * structure TestList. This structure consists of the command * letter, an alphanumeric description and the list of test, * subtest pairs to be executed. The list of pairs must end * with the pair {-1,0} which is the termination signal. * The whole structure must end with the command '\0'. * * The functions for various tests are kept in the array * fn_array. The size of fn_array should be kept in FN_ARRAY_SIZE. */ struct { char command_name; char *briefDesc; char *description; struct { int test,subtest } specs[27]; } TestList[] = { { 'd', "default", "default", {{-1,0} } }, }; /* extern MemDriver(), Map(), TPTest(), ParityCheck(), Clock(), UIEtest(); extern HDTest(),FDTest(),trap14(),MapRAMDriver(); extern ProtTest(),LPTest(),VidTest(),KbdTest(); extern ModemTest(), DialerTest(), ExpTest(),dtest(); extern TestRS232() ,RTCTestDriver(); extern Version(); extern int Pause() ; */ extern test1(); extern dsktst(); int (*fn_array[])() = { 0, }; int CurrentTest, CurSubtest; int pass = 0; /* pass is incremented by 1 for each repetition. if non zero the pass number is displayed on error. Disktests 3,4 and 23 also increment pass. */ ushort GCR_save; char ComBuf[256],ShortBuf[64]; extern char *pHdUD1, *pHdUD2, *pHdHelp; BOOLEAN fPageMode=FALSE, fParityOn=FALSE, fLPEOn=FALSE, fDskIgn, fTestSeq; BOOLEAN fUser=TRUE, fExpert=FALSE, fremote=FALSE; msglevel_t MsgLevel=USER; extern int PMCount; /* ExecutionMode is the global variable which keeps track of the * current mode in which the diagnostic is executing. Its value * is one of the following: * INTERACTIVE: normal processing with immediate error * determination. Uses the command loop. * LONG: This is the heavy testing mode; doesn't * terminate on error, but maintains statistics. * UNATTENDED: The no terminal mode. An error causes * the machine to display an error code in the * LEDs and waits for a terminal to be connected. * CONTINUOUS: The test runs to completion, printing errors * as it finds them. */ execution_t ExecutionMode; /* The help subroutine processes requests for help using the '?' * command from the terminal. It does so by looking up the description * of the command for which help was requested in the form '?c'. * '?' alone prints all the descriptions along with their command * names. */ help(CommandString) char *CommandString; { int i; if (CommandString[1] < ' ') { printf(pHdHelp); for (i=0; TestList[i].command_name != '\0'; i++) { if ((TestList[i].command_name >= '0') && (TestList[i].command_name <= '9')) printf("'"); printf("%c\t%s\r\n",TestList[i].command_name, TestList[i].briefDesc); } } else for (i=0; ; i++) { if (TestList[i].command_name == CommandString[1]) { printf("%s\r\n",TestList[i].description); break; } else if (TestList[i].command_name == '\0') { printf("(help 001) unrecognized command.\r\n"); break; } } } #ifdef MANUFACTURE /* This function performs the default tests . * It is assumed that the first test in the table * is the default sequence. */ default_test() { int j; ushort Led_counter=0; ExecutionMode = UNATTENDED; fTestSeq = TRUE; fExpert = TRUE; MsgLevel = ALL_MSG; while (TRUE) { printf("\n\t\tUNIX PC DIAGNOSTIC(NON DESTRUCTIVE) VER 2.1"); printf("\n\t\t*******************************************\n"); for (j=0; (CurrentTest=TestList[0].specs[j].test) != -1; j++) { LedDisplay( Led_counter); Led_counter++; if ( Led_counter>15 ) Led_counter = 0; pass = j; TEST_ON = 1 ; /* sub test starts */ (*fn_array[TestList[0].specs[j].test]) (TestList[0].specs[j].subtest); TEST_ON = 0 ; } } } #endif /* MANUFACTURE */ char RealBuf[CMD_SIZE+CMD_SIZE]; /* line storage buffer */ char *RealPtr; /* current buffer location */ char *RealCom; /* location of first character of command */ int RealCount = 0; /* repeat count for entire line. */ /* * getinput reads a command line into RealBuf when RealCount = 0 * otherwise it copies from RealPtr upto (but not including) * a ; or null then null terminates the string. * When the end of the buffer is reached RealCount is reset to * 0. This resetting is also done in initialization. * RealCount is decremented every time the command line is executed. * It is originally set by the number which comes before the * vertical bar character on the command line. */ getinput(ptr, sz) char *ptr; int sz; { int i; char ch; char *begin = ptr; if ( RealCount == 0 ) { ClearBuf(RealBuf,CMD_SIZE+CMD_SIZE); if (fExpert) printf("\r\n\command> "); input(RealBuf,CMD_SIZE+CMD_SIZE); RealCount = atoi(RealBuf); i = 0; SkipNumeric(RealBuf, i); if ((i == 0) || (*(RealBuf+i) != '|')) { RealCount = 1; i = 0; } else { ++i; } RealCom = RealBuf+i; RealPtr = RealCom; } for (i=0; i<(sz-1);i++) { ch = *RealPtr++; if ( !ch ) { RealPtr = RealCom; --RealCount; break; } if ( ch == ';' ) { break; } *ptr++ = ch; } } /* The main command loop processes commands input from the * terminal repetitively until the 'q' command is given. * The user can pick either predefined test sequences or * else pick a particular test and subtest number. In addition, * the user can set the mode of diagnostics to either interactive * short or interactive long depending on the type of testing * being done. * * The command format comes in two flavors. For predefined test * sequences the following structure is used: * [][L] * The test-name is a single character. The repeat-count defaults * to 1. A repeat count of 0 indicates that the test is to be * repeated until the user interupts with break. If an 'L' is * appended to the end of the command, long mode is entered and * error reporting is suspended. Errors will be accumulated and * an overall report delivered at the end of the command. * * To choose a particular test, use this format: * [][,][L] * A subtest number of 0 will perform all the subtests of a * particular test. This is also the default for subtest if * no value is entered. */ command_loop() { char CommandString[CMD_SIZE], Command; char *p=CommandString; int i,j, cnt_in, cnt, RepeatCount, Test, Subtest; int CommandIndex; if ( fExpert ) { goto ExpertMenu; } else { goto UserMenu ; } /* USER DIAGNOSTIC MENU LOOP */ UserMenu: for ( ; ; ) { ExecutionMode = INTERACTIVE; PrintMenu: if ( !fremote ) { printf(pHdUD1); } else { printf(pHdUD2); } ClearBuf(CommandString,CMD_SIZE); cnt_in = input(p + USER_CMD_SIZE,USER_CMD_SIZE); #ifdef DEBUG printf("cnt_in = %d, CommandString = %x %x %x\n", cnt_in, CommandString[10], CommandString[11], CommandString[12]); #endif /* remove leading and trailing blanks */ cnt=i=0; while (i '0') && (CommandString[0] <= '9')) i = CommandString[0] - '0'; else { switch(CommandString[0]) { case 'R': case 'r': fremote = TRUE; break; case 'L': case 'l': fremote = FALSE; break; case 'Q': case 'q': MsgLevel = USER; break; case 'V': case 'v': MsgLevel = EXP_ERR; break; default: break; } } break; case 2: if ((CommandString[0] == '1') && ((CommandString[1] == '0') || (CommandString[1] == '1') || (CommandString[1] == '2'))) i = 10 + CommandString[1] - '0'; break; case 4: if( !strcmp( CommandString,"UNIX" ) || !strcmp( CommandString,"unix" ) ) trap14(); break; case 6: /* Escape into Expert Mode if "S4TEST" or "s4test" Entered" */ if ( !strcmp( CommandString,"S4TEST" ) || !strcmp( CommandString,"s4test" ) ) { fUser = FALSE; fExpert = TRUE; MsgLevel = ALL_MSG; goto ExpertMenu; } break; default: break; } if (i) { #ifdef DEBUG printf("Test # %d selected.\n",i); #endif if (i < 10) Command = '0' + i; else Command = 'A' + i - 10; #ifdef DEBUG printf("Command = %x %c\n",Command, Command); #endif for (j=0; ; j++) { if (TestList[j].command_name == Command) break; if (TestList[j].command_name == '\0') break; } if (TestList[j].command_name == '\0') { printf("**Internal User Command Error**: %s\n", p + USER_CMD_SIZE); continue; } CommandIndex = j; fTestSeq = TRUE; RepeatCount = 1; for (i=0; i= '0' && CommandString[i] <= '9';i++); if (i==cnt) j = -1; if (j >= 0 && j <= 16) { MsgLevel = j; printf("New MsgLevel = %d\n",MsgLevel); } continue; } if (CommandString[0] == 'P') { if (CommandString[1] == 'M') { fPageMode = (BOOLEAN) !fPageMode; PMCount = 0; printf("Page mode %s\n", fPageMode ? "enabled" : "disabled"); continue; } else if (CommandString[1] == 'E') { fParityOn = (BOOLEAN) !fParityOn; if (fParityOn) { *PE_INT_GCR_ADDR = PE_INT_ENABLE; } else { *PE_INT_GCR_ADDR = PE_INT_DISABLE; } printf("Parity interrupts %s\n", fParityOn ? "enabled" : "disabled"); continue; } } if ((CommandString[0] == 'L') && (CommandString[1] == 'E')) { fLPEOn = (BOOLEAN) !fLPEOn; printf("Line Printer Echo %s\n", fLPEOn ? "Enabled" : "Disabled"); continue; } if ((CommandString[0] == 'D') && (CommandString[1] == 'I')) { fDskIgn = (BOOLEAN) !fDskIgn; printf("Ignore tests for nonexistant disks is %s\n", fDskIgn ? "Enabled" : "Disabled"); continue; } RepeatCount = atoi(CommandString); if (RepeatCount < 0) { printf("(command_loop 001) repeat count must be positive\n"); continue; } i = 0; SkipNumeric(CommandString,i); if (i==0) RepeatCount = 1; if (CommandString[i] == '\'') i++; if (CommandString[i] == ':') { i++; Test = atoi(&CommandString[i]); if (Test < 0) { printf("(command_loop 002) test number must be \ positive\r\n"); continue; } SkipNumeric(CommandString,i); if (CommandString[i] == ',') { i++; Subtest = atoi(&CommandString[i]); if (Subtest < 0) { printf("(command_loop 003) subtest number must be positive\n"); continue; } SkipNumeric(CommandString,i); } else Subtest = 0; if (CommandString[i] == 'L') { ExecutionMode = LONG; ClearErrors(); } if (CommandString[i] == 'C') ExecutionMode = CONTINUOUS; CurrentTest = Test; fTestSeq = FALSE; for (i=0; (i= '0' && pc[i] <= '9'; i++) #define ClearBuf(pBuf,Count) {int i; for (i=0; i 0) loop = loop - 1; } } writedialer(dialctl) ushort dialctl; { * (DIALER_LOWER +((dialctl & 0x00ff) << 1)) = 0; * (DIALER_HIGHER+((dialctl & 0xff00) >> 7)) = 0; } 0707070000020027041006440001460001440000010330640353675436300000600000003266Files./Size ./Makefile ./Makeincludes ./atoi.c ./sys ./sys/acct.h ./sys/buf.h ./sys/callo.h ./sys/cmap.h ./sys/conf.h ./sys/dialer.h ./sys/dir.h ./sys/dmap.h ./sys/elog.h ./sys/erec.h ./sys/err.h ./sys/errno.h ./sys/fblk.h ./sys/file.h ./sys/filsys.h ./sys/font.h ./sys/gdioctl.h ./sys/gdisk.h ./sys/gdisk.m ./sys/gtape.h ./sys/hardware.h ./sys/hardware.m ./sys/hw.h ./sys/i8274.h ./sys/init.h ./sys/ino.h ./sys/inode.h ./sys/iobuf.h ./sys/ioctl.h ./sys/iohw.h ./sys/iohw.m ./sys/ipc.h ./sys/kbd.h ./sys/lapbtr.h ./sys/lock.h ./sys/lprio.h ./sys/map.h ./sys/modem.h ./sys/mount.h ./sys/mouse.h ./sys/msg.h ./sys/opt.h ./sys/param.h ./sys/ph.h ./sys/phone.h ./sys/proc.h ./sys/pte.h ./sys/reg.h ./sys/rtc.h ./sys/sem.h ./sys/shm.h ./sys/signal.h ./sys/space.h ./sys/st.h ./sys/stat.h ./sys/stermio.h ./sys/sysinfo.h ./sys/sysmacros.h ./sys/systm.h ./sys/target.h ./sys/termio.h ./sys/text.h ./sys/times.h ./sys/trace.h ./sys/trap.h ./sys/ttold.h ./sys/tty.h ./sys/types.h ./sys/user.h ./sys/utsname.h ./sys/vadvise.h ./sys/var.h ./sys/vlimit.h ./sys/vm.h ./sys/vmmac.h ./sys/vmmeter.h ./sys/vmparam.h ./sys/vmsystm.h ./sys/vtimes.h ./sys/wait.h ./sys/wd.h ./sys/window.h ./clk.c ./mkdiag ./mkdiag/diag ./mkdiag/msg.c ./mkdiag/main.c ./diag.h ./dialer.c ./Files ./disk.c ./kbd.c ./disktst.c ./Install ./error.c ./Name ./exp.c ./main1.o ./font.c ./mch.o ./gdtest.c ./gdtest.h ./math.o ./gtape.c ./Remove ./i8274.c ./i8274sub.c ./cdtutor ./ifile.0410 ./init.c ./disktool.nr ./input.c ./README ./kpic.h ./lp.c ./main1.s ./math.s ./mch.s ./mem.c ./modem.c ./mouse.c ./newdisk.c ./newtest1.c ./odump.c ./page.c ./parity.c ./printf.c ./prot.c ./rastop.m4 ./showdate.c ./sprintf.c ./trap.c ./version.c ./vid.c ./MAKEflop ./MAKEcpio 0707070000020025731006660001460001440000010321230352172541100000700000003337disk.c/* This is a driver for the s4. Author: Bo Sjosten Date: 1984-06-07 */ #include "sys/hardware.h" #include "sys/iohw.h" #include "sys/gdisk.h" #include "./diag.h" #define LOGICAL 0 #define PHYSICAL 1 #define FALSE 0 #define TRUE 0xffff #define MAXRESTORE 1 int dfrd(), dfwt(), dhrd(), dhwt(); /* Drive parameters obtained from reading vhb */ struct dparam { ushort cyls; /* Cylinders / disk */ ushort trks; /* Tracks / cylinder ( = # of heads ) */ ushort secs[2]; /* Sectors / track */ /* Physical sectors/track */ ushort secsz; /* Bytes / sector */ ushort secoff; /* First sector number */ char steprt; /* Step rate to give to controller */ }; struct dfunc { int (*rd)(); /* Pointer to disk read function */ int (*wt)(); /* Pointer to disk write function */ }; ushort dcr_save = 0; ushort mcr_save = 0; ushort dma_flag = FALSE; int diskretries; int diskrestores; int disktype; char *bbt = 0; struct dparam fdparam = { 40, 2, 8, 8 , 512, 1, 0 }; struct dparam hdparam = { 612, 2, 16, 17, 512, 0, 0 }; struct dfunc fdfunc; /* Function pointers for the floppy disk */ struct dfunc hdfunc; /* Function pointers for the hard disk */ unsigned char HDFint = 0; unsigned char FDFint = 0; ushort Disk_status,HDisk_err; dfreset() { *DISK_CNTRL = dcr_save &= ~NOT_FDRST; sdel(); *DISK_CNTRL = dcr_save |= NOT_FDRST; sdel(); } dhreset() { *DISK_CNTRL = dcr_save &= ~NOT_HDRST; sdel(); *DISK_CNTRL = dcr_save |= NOT_HDRST; sdel(); } dfmtron() { *DISK_CNTRL = dcr_save |= FDMTR; } dfmtroff() { *DISK_CNTRL = dcr_save &= ~FDMTR; } dfdeselect() { *DISK_CNTRL = dcr_save &= ~FDR0; } dhselect() { *DISK_CNTRL = dcr_save |= HDR0; } dhdeselect() { *DISK_CNTRL = dcr_save &= ~HDR0; } sdel() { int i; for( i = 0; i < 1000; i++ ) ; } 0707070000020025741006660001460001440000010321250352172543000000600000015273kbd.c#include "diag.h" #include "sys/wd.h" #define GEN_KT #include "sys/kbd.h" #include "sys/mouse.h" #include "kpic.h" unsigned char kstate = 0; #define KNORM 0 #define KMOUSE 1 #define KQUOTE 2 unsigned short keyold[16]={0}, keynew[16]={0}; char knumlock=0, kcaplock=0, kshift=0, kctrl=0; char kdown[128]; char kbdiag=0, msdiag=0, kbdone=1; int lastkey = -1; extern unsigned short *syspat[]; #define MAXSUBTEST 3 #define KMAR 1 /****************************************************************************** The S4 keyboard is a dual-ported device: it can generate data to the S4 when keys are depressed or release, and it can "pass through" data from the mouse. The control bytes are as follows: Hex Name Meaning 0xCE BEGMOUSE indicates subsequent bytes are from mouse 0xDF BEGKBD indicates subsequent bytes are from kbd 0xCF BEGEMOUSE same as BEGMOUSE but data was lost The keyboard quotes imbedded DF's by sending them twice. The variable KSTATE keeps track of the fsm to parse this stream: Value Name Meaning 0 KNORM bytes are from kbd 1 KMOUSE bytes are from mouse 2 KQUOTE bytes are from mouse but last was DF ******************************************************************************/ /****************************************************************************** KLOW(c) - process a bytes received from the kbd/mouse Dispatch to KSCAN or MSCAN with the byte. ******************************************************************************/ klow(c) register unsigned char c; { switch (kstate) { case KNORM: switch (c) { case BEGEMOUSE: /* panic("lost mouse byte (N)"); */ case BEGMOUSE: kstate = KMOUSE; return; default: kscan(c);return; } case KMOUSE: switch (c) { case BEGKBD: kstate = KQUOTE; return; default: mscan(c);return; } case KQUOTE: switch (c) { case BEGKBD: kstate = KMOUSE; mscan(BEGKBD);return; case BEGEMOUSE:/* panic("lost mouse byte (Q)"); */ case BEGMOUSE: kstate = KMOUSE; return; default: kstate = KNORM;kscan(c);return; } } return 1; } /****************************************************************************** KSCAN(c) - process keyboard scan code "c" Calls KUPDN(c') where c' is the parsed keyboard stream. ******************************************************************************/ kscan(c) unsigned char c; { register unsigned char cand = c & 0x7F; register unsigned short i,j; register unsigned short xor, new; /* If the key code is KALLUP (all up), clear the new map and process it against the old one. If it is a legit scan code, then light the correct bit in the new map. If the code is the last one from the keyboard, process the new map against the old. Note that the else clause in the following state really doesn't need to be here: it covers the case where the kbd sends scan codes followed by an all up in one sequence (e.g. 61 62 C0). */ if ( cand != KALLUP ) { i = cand / 16; keynew[i] |= 1<<(cand%16); if ( !(c & KLAST) ) return; } else for (i=0 ; i<8 ; i++) keynew[i] = 0; /* Go through the two maps (new and old) looking for differences. For each differnce, call KEY with the key number and a flag for down or up. As the maps are compared, copy the new map into the old map. */ for (i=0 ; i<8 ; i++) { new = keynew[i]; xor = keyold[i] ^ new; keyold[i] = new; keynew[i] = 0; if ( xor ) { for (j=0 ; j<16 ; j++) { if ( xor & 1 ) kupdn(16*i+j, new & 1); xor = xor >> 1; new = new >> 1; } } } } /****************************************************************************** KUPDN(c',down) - process an up/down transition c' is the keyboard code, down is true if the key is being depressed, false if being released. Calls KHIGH( c'' ) with a short (c'') which has the 16-bit code for the character. *****************************************************************************/ kupdn(c,down) register unsigned char c; int down; { register struct keydef *kt; short code; char flags; if ( !kbdone && kbdiag ) kdiag(c,down); /* if ( !kbdone && msdiag ) return; */ switch (c) { case KSHIFT1: case KSHIFT2: if (down) kshift++; else kshift--; return; case KCTRL1: case KCTRL2: if (down) kctrl++; else kctrl--; return; } /* If the key is not special, throw away up transitions. If its an up transition, find the keys keymap entry and decode it. */ if ( !down ) { lastkey = -1; return; } if ( c == KCAPLCK ) { kcaplock ^= 1; kout(CAPLED+kcaplock); return; } if ( c == KNUMLCK ) { knumlock ^= 1; kout(NUMLED+knumlock); return; } kt = &keymap[c]; flags = kt->kt_flags; /* If the character is a numeric lock, decode the 12 numeric keys by hand (its not worth having another column in the keymap struct). Also light the REPT flag since all numeric keys repeat. */ if ( (flags & NUMLCK) && knumlock ) { switch (c) { case KPRINT: code = '7'; break; case KRFRSH: code = '8'; break; case KPAGE: code = '9'; break; case KBEG: code = '4'; break; case KHOME: code = '5'; break; case KEND: code = '6'; break; case KPREV: code = '1'; break; case KUP: code = '2'; break; case KNEXT: code = '3'; break; case KLEFT: code = '-'; break; case KDOWN: code = '0'; break; case KRIGHT: code = '.'; break; default: panic("bad keymap"); } flags |= REPT; } else if ( kctrl ) code = kt->kt_codes[2]; else if ( kshift || (kcaplock && (flags & CAPLCK))) code = kt->kt_codes[1]; else code = kt->kt_codes[0]; /* if ( code == ILLK ) return; */ if( !kbdone && kbdiag ) return; else khigh( lastkey = code ) ; } kdiag(c,down) register unsigned char c; int down; { if ( kdown[c] == down ) return; if ( kdown[KCTRL1] && kdown[KCTRL2] ) { if( kbdiag ) { kbdone = 1; kbdiag = 0; if( msdiag ) msdiag = 0; } return; } #ifdef PRINTSCR if ( kdown[KPRINT] && kdown[KSHIFT1] ) lpdump(); #endif xorkey(c); kdown[c] = down; } xorkey(c) register unsigned char c; { register struct kvdef *kv = &kvid[c]; rastop( VIDMEM, VIDBYTES, VIDMEM, VIDBYTES, 0,0, kv->kv_x+KMAR, kv->kv_y+KMAR, kv->kv_w-2*KMAR, kv->kv_h-2*KMAR, SRCPAT, DSTXOR, syspat[PATWHITE] ); } panic(s) char *s; { printf("diagnostic panic:%s\n", s); while (1) {}; } kout(c) char c; { while ( putkbd(c) == -1 ) {} } krepeat() { static int lastchar = 0; static int rptrate = 0; static int rptdelay = 0; if( lastkey == -1 ) { rptdelay = 0; rptrate = 0; return; } if( lastkey == lastchar ) { rptdelay++; if( rptdelay >= REPTDLAY ) { rptrate++; if( rptrate >= REPTRATE ) { rptrate = 0; khigh( lastkey ); } } } else { lastchar = lastkey; rptrate = 0; rptdelay = 0; } } 0707070000020025751006660001460001440000010321350352172541200001200000012077disktst.c/* Convergent Technologies - System V - Jun 1983 */ /*static char disktst_c[] = "%W%";*/ #include "diag.h" #include "sys/hardware.h" #include "sys/iohw.h" #include "sys/pte.h" #include "sys/gdisk.h" #define SECSIZ 512 #define BLKSIZ 1024 #define SWAPSIZ3 3000 #define SWAPSIZ4 4000 #define LDBBVHBSIZ 27 #define STANDARDDSK 9792 #define DSK_MAX_SUBTESTS 27 /* added 1 more by H.N 05/9 to auto-format */ #define LOGICAL 0 #define PHYSICAL 1 #define FGAPSZ 54 #define FFUDGE 80 #define FSECSZ (628+FGAPSZ) #define FUDGE 10 #define SECSZ (555+GAPSZ) #define ESC 27 /* ascii escape char */ #define SZALTMAP 1024 #define MINI10 0 #define ATASI 1 #define MAXSTOR 2 #define SEAGATE 3 #define MINI20 4 #define RODIME 5 #define OTHERS 6 #define MAXRETRY 10 #define MINRETRY 0 #define MAXRESTORE 1 #define MINRESTORE 0 #ifdef lint #define register #endif #ifdef LATER /* Messages used by this module */ char *pHdDSK = "DISK TEST"; char *pdskBBTEnt = "\nThe Bad Block Table contains %d entries.\n"; char *pFormatErr = "%s:Error during Disk Format:Response = %x\n"; char *pBadCyl = "%s:Not on Cylinder zero after Recal:Maybe on %d,Response = %x\n"; char *pDSKd1 = "\tRECAL DISK\n"; char *pDSKd2 = "\tFORMAT DISK\n"; char *pDSKd3 = "\tWRITE&READ TEST\n"; char *pDSKd4 = "\tDisk Read test.\n"; char *pDSKd5 = "\tRANDOM SEEK TEST\n"; char *pDSKd6 = "\tDisk Write function.\n"; char *pDSKd7 = "\tDisk Read function.\n"; char *pDSKd8 = "\tMODIFY BAD BLOCK TABLE\n"; char *pDSKd9 = "\tForce DMA Faults.\n"; char *pDSKd10 = "\tInitialize VHB and BBT.\n"; char *pDSKd11 = "\tWrite VHB and BBT after aborted Test 3.\n"; char *pDSKd12 = "\tPrint VHB.\n"; char *pDSKd13 = "\tDownload to Disk.\n"; char *pDSKd14 = "\tToggle Alien Disk mode.\n"; char *pDSKd15 = "\tFloppy Read Track.\n"; char *pDSKd18 = "\tInstall partition from floppies.\n"; char *pDSKd19 = "\tCreate floppy archive of a partition.\n"; char *pDSKd23 = "\tSurface test.\n"; char *pDSKd25 = "\tSort Bad block table.\n"; char *pDSKd27 = "\tFormat disk, no surface test.\n"; char *pDSKTest = "\t(DiskTest 001) Illegal subtest number for Disk test: %d.\n"; char *pDSKWriteError = "\n%s:Error on Write:Response = %x,Start Block = %d\n"; char *pDSKReReadError = "\n%s:Error on Re-Read:Response = %x,Start Block = %d\n"; char *pDSKDataReRead = "\n%s:Re-Read Data Fail:Start Block = %d,\n\t\tByte = %d, Received %x, Expected %x\n"; char *pDSKCheckReadError = "\n%s:Error on Check-Read:Response = %x,Start Block = %d\n"; char *pDSKChDataError = "\n%s:Check-Read Data Fail:Start Block = %d,\n\tByte = %d, Received %x, Expected %x\n"; char *pDSKReadError = "\n%s:Error on Read:Response = %x,Start Block = %d\n"; char *pDSKInitCheckRead = "\n%s:Initiating Check Read for pass %d\n"; char *pDSKInvalidDSK = "%s:Disk is not S4 Format: Run the Format Test.\n"; char *pDSKNParErr = "%s:No parity error on disk DMA\n"; char *pDSKNPFErr = "%s:No page fault on disk read.\n"; char *pDSKNAccErr = "%s:Page status not = accessed after disk write, reg = %x.\n"; char *pDSKNModErr = "%s:Page status not = modified after disk read, reg = %x.\n"; char *pHD_Type = "\nSelect disk type (hit RETURN to exit): \n\n\ 0 - Miniscribe ( 10 Megabyte internal, standard drive )\n\ 1 - Atasi ( 40 Megabyte external )\n\ 2 - Maxtor ( 40 Megabyte external )\n\ 3 - Seagate ( 10 Megabyte internal )\n\ 4 - Others\n\n\ Please select a number: "; #endif char *pdiskstartsat = " starts at Block %d (size=%d Blocks).\n"; char *pDiskAlien = "%s: Alien mode disabled\n"; char *pdiskretries = "%d Retries during Subtest %d.\n"; char *pWinTest = "WINCHESTER DISK TEST\n"; char *pFdTest = "FLOPPY DISK TEST\n"; char *DiskName; /* pointer to disk name for this test */ char *win= "WINCHESTER"; char *syq= "SYQUEST"; char *flpy= "FLOPPY"; int maxretries,maxrestores; BOOLEAN fDSK=FALSE, fDSKTest=FALSE; BOOLEAN fDSKPFTest=FALSE, fDSKPFInt=FALSE; int *initdbuf; /* disk buffer address for dinit */ int *initdtbl; /* disk table area for dinit */ int *vhbbuf; /* buffer for VHB + BBT in format */ int *bbtbuf; /* buffer for BBT in format */ int *scndbuf; /* buffer for surface test in format */ int *ourbuf; /* a buffer we can use */ int *tranbuf; /* buffer for floppy disk archiving. */ int chksum; int DiskType = HD; /* type of disks for test */ int HdType = 0; /* default is Miniscribe 10MB */ char recald[3] = {0,0,0}; char alienmode[3] = {0,0,0}; struct bbcell *bbc; struct fdarhdr { /* floppy archive header record */ int seq, flast, nblks; } *fdhdr; static long randx=1; void srand(x) unsigned x; { randx = x; } int rand() { return(((randx = randx * 1103515245L + 12345)>>16) & 0x7fff); } /* * Tidy up after the disk test. Restore vectors. Disable interrupts * and reset the drives. */ DiskDisable() { /* ------------------------------------------------- | Autovector level 2 is used for the Floppy | | Disk, Hard Disk and DMA. All interrupt | | decoding is done at that interrup routine. | ------------------------------------------------- */ /**(int *) (4*26) = (int) IntFDHDDMA;*/ dfreset(); dhreset(); dfmtroff(); dfdeselect(); dhdeselect(); fDSKTest = FALSE; fDSK = FALSE; } 0707070000020025761007550001460001440000010321430353460731300001000000002363Install# Diagnostic Disk Generator Install Script # # This script expects to be run with the current directory set to # the diagnostic disk generator distribution directory (whatever that is). # Remove any existing $ROOT/u/tutor/diag_gen directory and make a new one if test ! -d $ROOT/u/tutor/diag_gen then echo "Creating $ROOT/u/tutor/diag_gen Directory ... \c" set -e mkdir $ROOT/u/tutor/diag_gen chmod 777 $ROOT/u/tutor/diag_gen set +e echo "Done" fi # # Next move all relevant files to their destination. # Assume we're in the directory with the good stuff. # echo "Installing DIAGNOSTIC DISK GENERATOR files" find . ! -name Files ! -name Install ! -name Size ! -name Remove ! -name Name -print | cpio -pdm /u/tutor/diag_gen # # Now update the user agent special files # echo "Updating special Office files" echo "Name=Diagnostic Disk Generator" > /tmp/t echo "Default=Run" >> /tmp/t echo "Run = SH -dw /u/tutor/diag_gen/cdtutor" >> /tmp/t echo "Help = EXEC -d /usr/bin/uahelp -h /usr/lib/ua/ua.hlp -t \"UNIX System\"" >> /tmp/t echo "Prompt = Press Ctrl-D to exit" >> /tmp/t uaupd -r "Diagnostic Disk Generator" -a /tmp/t Office rm -f /tmp/t echo "DIAGNOSTIC DISK GENERATOR installation complete" echo "Files reside in /u/tutor/diag_gen" sleep 10 0707070000020025771006660001460001440000010321450352172541300001000000010547error.c/* Convergent Technologies - System V - Jul 1983 */ /*static char error_c[] = "@(#)error.c 1.3";*/ #include "diag.h" /* In the ExecutionMode LONG, errors are counted in a table by test * and subtest. There is also a buffer which contains as many * descriptions as will fit in the specified size. */ #define NULL 0 #define ErrBufSize 5400 /* total of 5400 chars in error messages */ #define ErrorListSize 270 /* 270 error messages */ extern main1(); extern BOOLEAN fPageMode; extern int pass; int ErrorCount; static struct { int error_count; int desc_list; int sub_error_count[MaxSubtests]; } ErrorTable[FN_ARRAY_SIZE]; /* variables for maintaining buffer usage and linked list of strings. */ static int NextDesc; static int NextBuf; static int DescTable[ErrorListSize]; static int DescLink[ErrorListSize]; static char ErrBuf[ErrBufSize]; /* ExecutionMode actually lives in main.c */ extern execution_t ExecutionMode; extern int CurrentTest; /* The ClearErrors subroutine reinitializes the error table and error * count. This routine must be called before the table is used. */ ClearErrors() { int i,j; ErrorCount = 0; for (i=0; iErrorListSize || NextBuf > ErrBufSize - 20 || desc == NULL) return; if (ErrorTable[Test].desc_list == 0) ErrorTable[Test].desc_list = NextDesc; else { NextEntry = ErrorTable[Test].desc_list; for (;DescLink[NextEntry] != 0; NextEntry = DescLink[NextEntry]) ; DescLink[NextEntry] = NextDesc; } DescTable[NextDesc++] = NextBuf; for (i=0; desc[i] != 0 && NextBuf < ErrBufSize-1; i++,NextBuf++) ErrBuf[NextBuf] = desc[i]; ErrBuf[NextBuf++] = '\0'; } /* PrintErrorTable prints a summary of the errors on the terminal */ PrintErrorTable() { int Test, Subtest, NextEntry; printf("\nTotal number of errors is %d\r\n", ErrorCount); for (Test=0; Test #include extern char ComBuf[]; extern char *pMemsize; extern int CurSubtest; extern char *pAddrError, *pUnknown,*pMemE1,*pMemE2; extern *pData,*pRand,*pAddr; BOOLEAN noMem(); int E1tmaxMem, E1tminMem,E2tmaxMem,E2tminMem,E3tmaxMem,E3tminMem,E4tmaxMem, E4tminMem; extern long tmaxMem,tminMem; static char bankavail[7] = {1,1,1,1,1,1,1};/* bank 0 = 0x80000-0xfffff*/ /* The memory driver subroutine acts as a dispatcher to the various * subtests or all of them if the argument is 0. */ SizeEMemory() { if ( !noMem( 0x200000 ) ) { E1tminMem= 0x200000; E1tmaxMem= 0x27ffff; } else { E1tminMem = E1tmaxMem = 0x200000; } if ( !noMem( 0x280000 ) ) { E2tminMem= 0x280000; E2tmaxMem= 0x2fffff; } else { E2tminMem = E2tmaxMem = 0x280000; } if ( !noMem( 0x300000 ) ) { E3tminMem= 0x300000; E3tmaxMem= 0x37ffff; } else { E3tminMem = E3tmaxMem = 0x300000; } if ( !noMem( 0x380000 ) ) { E4tminMem= 0x380000; E4tmaxMem= 0x3fffff; } else { E4tminMem = E4tmaxMem = 0x380000; } } BOOLEAN noMem( addr_start ) int addr_start; { ushort *i; ushort temp; for ( i=(ushort *)addr_start; i<(ushort *)(addr_start+0xa) ; i++ ) /* test in incr of word */ { *i = (ushort) i; temp = *i; if ( (ushort) i == temp ) { return( FALSE ); } } return( TRUE ); } /* ----------------------------------------------------------------- | EAddrTest is a routine that check for the short and | | open of the address lines on the S4 mother board and | | expansion memory. EtminMem is the lower and EtmaxMem is | | the upper limit. Address lines that are greater or equal| | to the most significant address lines of the limits are | | not tested. | ----------------------------------------------------------------- */ EAddrTest(EtminMem,EtmaxMem) int EtminMem,EtmaxMem; { register unsigned char k,data_ref; register int pMem; unsigned int testlin1, /* address line currently testing */ testlin2, mRef; /* reference mem loc. */ ushort cnt1,cnt2,bank; if (EtmaxMem<=EtminMem+1) { return; } else { printf(pAddr); printf( pMemsize, EtminMem,EtmaxMem ); } /* -------------------------------------------------- | Because of S4 memory lay-out, A0,A3-21 has to | | be tested on every 64K bank of 512K | -------------------------------------------------- */ for ( bank = 0x0; bank <=0x3; bank++ ) { /* printf("\nBank= %x\n",bank<<1); */ /* -------------------------------------------------- | Start at lowest loc., turn-on address line one| | at a time use it as ref. loc | -------------------------------------------------- */ for ( testlin1 = 0x0,cnt1 = 0; /* shift ref. mem. loc. */ testlin1 <= 0x200000; testlin1 = ( (testlin1) ? testlin1 << 1 : 1 ), cnt1 = ( (testlin1 == 1) ? 0 : cnt1+1 ) ) { mRef = EtminMem | testlin1; /* -------------------------------------------------- | mask off bits below the adrress line to be on | -------------------------------------------------- */ mRef =( mRef & ( 0x3fffff << cnt1 ) | (bank<<1) ) ; /* -------------------------------------------------- | Ref. loc at low and hi order byte | -------------------------------------------------- */ for (mRef &= 0x3ffffe; mRef != 0xffffff; mRef = ((mRef&0x1) ? 0xffffff : mRef | 0x1) ) { /* ---------------------------------------------------- | ref. loc must be within the testing memory range| ---------------------------------------------------- */ if ( ((mRef == EtminMem) && testlin1 )||(mRef > EtmaxMem) || (mRef < EtminMem) ) continue; /* printf("\nRef= %x",mRef); */ /* -------------------------------------------------- | Test pattern is byte-wise, alternate between | | 0xAA and 0x55 | -------------------------------------------------- */ for ( data_ref = 0x55; data_ref != 0xaa; data_ref = ( (data_ref == 0x55) ? 0xaa : 0xff ) ) { /*printf("\ndata_ref = %x",data_ref);*/ /* --------------------------------------------------- | ref. loc is verified after writing a complement| | pattern to every tsting loc Testing loc is ref | | loc with one addr line turnes on going from | | right to left( for hi & lo order byte ) | --------------------------------------------------- */ for ( testlin2 = 0x1, cnt2 = 0; /* starting at A0 */ testlin2 <= 0x200000 ; /* until A21 */ testlin2 <<= 1 , /* shift left 1 */ cnt2++ ) { /* the location to be tested */ pMem = EtminMem | testlin2 ; /* mask off bits below testlin2 */ pMem = pMem & ( 0x3fffff << cnt2 ); /* -------------------------------------------------- | hi byte | -------------------------------------------------- */ pMem = pMem & 0x3ffffe; if ((pMem == mRef) || (pMem > EtmaxMem) || (pMem < EtminMem) ) goto L1; *(unsigned char *)mRef = data_ref; *(unsigned char *)(pMem ) = ~data_ref ; /*printf("\npMem= %x ~data_ref= %x",pMem ,~data_ref);*/ if( (k = *(unsigned char *)mRef) != data_ref ) goto L2; L1: /* -------------------------------------------------- | lo byte | -------------------------------------------------- */ pMem = pMem | 0x1; if ((pMem == mRef) || (pMem > EtmaxMem) || (pMem < EtminMem) ) continue ; *(unsigned char *)mRef = data_ref; *(unsigned char *)(pMem ) = ~data_ref ; /*printf("\npMem= %x ~data_ref= %x",pMem ,~data_ref);*/ if( (k = *(unsigned char *)mRef) != data_ref ) goto L2; continue; L2: if ( k != ~data_ref ) sprintf( ComBuf,pMemE2,cnt2,bank, data_ref, mRef, ~data_ref, (int)pMem , k, mRef ); if ( k == ~data_ref ) sprintf( ComBuf,pMemE1,cnt2,bank ); error( ComBuf,CurSubtest,ComBuf ); /*printf(" k= %x",k); */ } /* for testlin2 */ } /* for data_ref */ } /* for mRef */ } /* for testlin1 */ } /* for bank */ } /* --------------------------------------------------------- | Random pattern address test | --------------------------------------------------------- */ ERand( minMem,maxMem ) int minMem,maxMem; { ushort seed,fseed; ushort *pMem,k; int count,tmp; if ( minMem >= maxMem ) return; printf(pRand); minMem = ( minMem & 0x1 ) ? minMem + 1 : minMem ; printf( pMemsize,minMem,maxMem ); seed = rand(); fseed = seed; srand( seed ); /* seed */ /* ------------------------------------------------- | Write random pattern to memory | ------------------------------------------------- */ for ( pMem = (ushort *)minMem,count=0; pMem <= (ushort *)maxMem; pMem++, count +=2 ) { if ( count >= 0xffff ) /* every 64K */ { count = 0; seed = rand(); srand( seed ); /*reseed */ } *pMem = rand(); /* random pattern */ } /* ------------------------------------------------- | Read back to verify | ------------------------------------------------- */ srand( seed=fseed ); for ( pMem = (ushort *)minMem,count=0; pMem <= (ushort *)maxMem; pMem++, count +=2 ) { if ( count >= 0xffff ) /* every 64K */ { count = 0; seed = rand(); srand( seed ); /*reseed */ } if ( *pMem != (k = rand()) ) { tmp = VMemtoPMem( (int)pMem ); sprintf(ComBuf,pAddrError,tmp,k,*pMem); error(ComBuf,CurSubtest,ComBuf); } } } VMemtoPMem( Vmem ) int Vmem; { int map; map = *(ushort *)(2*(Vmem >> PAGESHIFT) + (int)PG_BASE) & PG_PFNUM; map <<= PAGESHIFT; Vmem = (Vmem & 0xfff) | map; return( Vmem ); } 0707070000020026021006440001460001440000010321640352420027000001000000000672main1.oRQ¸ô .text6ŒÂ .data66@.bss66€Nú3ü€ä0 |N` | .H#ù#ùN¹(2.text6.data6.bss6mainmain1_endGCR_saveent0707070000020026031006660001460001440000010321650352173016500000700000014347font.c#include "sys/wd.h" /* * new system font from BSI tape - 11/5/84 */ unsigned short font[] = { 0x0,0x18e,0x9,0xc0a,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x90c,0xf6,0x900,0x2fa,0x209,0x4f7,0x900,0x30a, 0x504,0x2f7,0x900,0x314,0x708,0x1f7,0x900,0x314, 0x709,0x1f7,0x900,0x31c,0x809,0x1f7,0x900,0x326, 0x809,0x1f7,0x900,0x330,0x204,0x4f7,0x900,0x33a, 0x40a,0x3f7,0x900,0x33a,0x40a,0x2f7,0x900,0x346, 0x705,0x1f9,0x900,0x352,0x807,0x1f8,0x900,0x354, 0x304,0x3fe,0x900,0x35a,0x701,0x1fb,0x900,0x35a, 0x302,0x3fe,0x900,0x354,0x60a,0x2f7,0x900,0x350, 0x709,0x1f7,0x900,0x35c,0x609,0x2f7,0x900,0x366, 0x709,0x1f7,0x900,0x370,0x709,0x1f7,0x900,0x37a, 0x809,0x1f7,0x900,0x384,0x709,0x1f7,0x900,0x38e, 0x709,0x1f7,0x900,0x398,0x709,0x1f7,0x900,0x3a2, 0x709,0x1f7,0x900,0x3ac,0x709,0x1f7,0x900,0x3b6, 0x306,0x3fa,0x900,0x3c0,0x308,0x3fa,0x900,0x3c4, 0x609,0x1f7,0x900,0x3cc,0x703,0x1fa,0x900,0x3d6, 0x609,0x2f7,0x900,0x3d4,0x709,0x1f7,0x900,0x3de, 0x709,0x1f7,0x900,0x3e8,0x709,0x1f7,0x900,0x3f2, 0x709,0x1f7,0x900,0x3fc,0x709,0x1f7,0x900,0x406, 0x709,0x1f7,0x900,0x410,0x609,0x2f7,0x900,0x41a, 0x609,0x2f7,0x900,0x424,0x709,0x1f7,0x900,0x42e, 0x709,0x1f7,0x900,0x438,0x409,0x3f7,0x900,0x442, 0x709,0x1f7,0x900,0x44c,0x809,0x1f7,0x900,0x456, 0x609,0x2f7,0x900,0x460,0x709,0x1f7,0x900,0x46a, 0x709,0x1f7,0x900,0x474,0x709,0x1f7,0x900,0x47e, 0x709,0x1f7,0x900,0x488,0x70a,0x1f7,0x900,0x492, 0x809,0x1f7,0x900,0x49e,0x709,0x1f7,0x900,0x4a8, 0x809,0x1f7,0x900,0x4b2,0x709,0x1f7,0x900,0x4bc, 0x709,0x1f7,0x900,0x4c6,0x709,0x1f7,0x900,0x4d0, 0x709,0x1f7,0x900,0x4da,0x809,0x1f7,0x900,0x4e4, 0x709,0x1f7,0x900,0x4ee,0x50a,0x3f7,0x900,0x4f8, 0x60a,0x2f7,0x900,0x504,0x50a,0x1f7,0x900,0x510, 0x704,0x1f7,0x900,0x51c,0x901,0x0,0x900,0x51c, 0x504,0x2f7,0x900,0x516,0x806,0x1fa,0x900,0x516, 0x709,0x1f7,0x900,0x51a,0x706,0x1fa,0x900,0x524, 0x709,0x1f7,0x900,0x528,0x706,0x1fa,0x900,0x532, 0x709,0x2f7,0x900,0x536,0x708,0x1fa,0x900,0x540, 0x709,0x1f7,0x900,0x548,0x709,0x1f7,0x900,0x552, 0x60b,0x1f7,0x900,0x55c,0x709,0x1f7,0x900,0x56a, 0x709,0x1f7,0x900,0x574,0x706,0x1fa,0x900,0x57e, 0x706,0x1fa,0x900,0x582,0x706,0x1fa,0x900,0x586, 0x708,0x1fa,0x900,0x58a,0x708,0x1fa,0x900,0x592, 0x706,0x1fa,0x900,0x59a,0x706,0x1fa,0x900,0x59e, 0x708,0x1f8,0x900,0x5a2,0x706,0x1fa,0x900,0x5aa, 0x706,0x1fa,0x900,0x5ae,0x706,0x1fa,0x900,0x5b2, 0x706,0x1fa,0x900,0x5b6,0x708,0x1fa,0x900,0x5ba, 0x706,0x1fa,0x900,0x5c2,0x60a,0x2f7,0x900,0x5c6, 0x20b,0x4f7,0x900,0x5d2,0x60a,0x1f7,0x900,0x5e0, 0x803,0x1fa,0x900,0x5ec,0x90c,0xf6,0x900,0x5ea, 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0,0x3,0x3,0x3,0x3, 0x3,0x3,0x0,0x3,0x3,0x1b,0x1b,0x1b, 0x1b,0x22,0x22,0x7f,0x22,0x22,0x7f,0x22, 0x22,0x8,0x3e,0x6b,0xb,0x3e,0x68,0x6b, 0x3e,0x8,0x6,0xc9,0x69,0x36,0x18,0x6c, 0x96,0x93,0x60,0x1e,0x33,0x33,0x1e,0xce, 0x5b,0x33,0x63,0xde,0x3,0x3,0x3,0x3, 0xc,0x6,0x6,0x3,0x3,0x3,0x3,0x6, 0x6,0xc,0x3,0x6,0x6,0xc,0xc,0xc, 0xc,0x6,0x6,0x3,0x22,0x14,0x7f,0x14, 0x22,0x18,0x18,0x18,0xff,0x18,0x18,0x18, 0x7,0x6,0x6,0x3,0x7f,0x7,0x7,0x30, 0x30,0x18,0x18,0xc,0xc,0x6,0x6,0x3, 0x3,0x3e,0x63,0x63,0x73,0x6b,0x67,0x63, 0x63,0x3e,0xc,0xe,0xf,0xc,0xc,0xc, 0xc,0xc,0x3f,0x3e,0x63,0x63,0x60,0x30, 0x1c,0x6,0x3,0x7f,0x3e,0x63,0x60,0x60, 0x3c,0x60,0x60,0x63,0x3e,0x60,0x70,0x58, 0x6c,0x66,0x63,0xff,0x60,0x60,0x7f,0x3, 0x3,0x3f,0x60,0x60,0x60,0x63,0x3e,0x38, 0xc,0x6,0x3,0x3f,0x63,0x63,0x63,0x3e, 0x7f,0x60,0x60,0x30,0x18,0xc,0x6,0x6, 0x6,0x3e,0x63,0x63,0x63,0x3e,0x63,0x63, 0x63,0x3e,0x3e,0x63,0x63,0x63,0x7e,0x60, 0x30,0x18,0xe,0x7,0x7,0x0,0x0,0x7, 0x7,0x7,0x7,0x0,0x0,0x7,0x6,0x6, 0x3,0x30,0x18,0xc,0x6,0x3,0x6,0xc, 0x18,0x30,0x7f,0x0,0x7f,0x3,0x6,0xc, 0x18,0x30,0x18,0xc,0x6,0x3,0x3e,0x63, 0x63,0x30,0x18,0x18,0x0,0x18,0x18,0x1e, 0x21,0x39,0x25,0x25,0x25,0x79,0x1,0x1e, 0x1c,0x36,0x63,0x63,0x63,0x7f,0x63,0x63, 0x63,0x1f,0x33,0x33,0x33,0x3f,0x63,0x63, 0x63,0x3f,0x3e,0x63,0x63,0x3,0x3,0x3, 0x63,0x63,0x3e,0x1f,0x33,0x63,0x63,0x63, 0x63,0x63,0x33,0x1f,0x3f,0x3,0x3,0x3, 0x1f,0x3,0x3,0x3,0x3f,0x3f,0x3,0x3, 0x3,0x1f,0x3,0x3,0x3,0x3,0x3e,0x63, 0x63,0x3,0x3,0x73,0x63,0x63,0x5e,0x63, 0x63,0x63,0x63,0x7f,0x63,0x63,0x63,0x63, 0xf,0x6,0x6,0x6,0x6,0x6,0x6,0x6, 0xf,0x60,0x60,0x60,0x60,0x60,0x63,0x63, 0x63,0x3e,0x63,0x33,0x1b,0xf,0xf,0x1b, 0x33,0x63,0xc3,0x3,0x3,0x3,0x3,0x3, 0x3,0x3,0x3,0x3f,0x41,0x63,0x77,0x6b, 0x6b,0x6b,0x63,0x63,0x63,0x63,0x67,0x6d, 0x5b,0x73,0x63,0x63,0x63,0x63,0x3e,0x63, 0x63,0x63,0x63,0x63,0x63,0x63,0x3e,0x3f, 0x63,0x63,0x63,0x63,0x3f,0x3,0x3,0x3, 0x3e,0x63,0x63,0x63,0x63,0x63,0x6f,0x3b, 0x3e,0x60,0x3f,0x63,0x63,0x63,0x3f,0x1b, 0x33,0x63,0xc3,0x3e,0x63,0x63,0x6,0x1c, 0x30,0x63,0x63,0x3e,0xff,0x18,0x18,0x18, 0x18,0x18,0x18,0x18,0x18,0x63,0x63,0x63, 0x63,0x63,0x63,0x63,0x63,0x3e,0x63,0x63, 0x63,0x63,0x63,0x63,0x36,0x1c,0x8,0x63, 0x63,0x63,0x6b,0x6b,0x7f,0x77,0x63,0x41, 0x63,0x63,0x63,0x36,0x1c,0x36,0x63,0x63, 0x63,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x18, 0x18,0x18,0x7f,0x60,0x30,0x18,0xc,0x6, 0x3,0x3,0x7f,0x1f,0x3,0x3,0x3,0x3, 0x3,0x3,0x3,0x3,0x1f,0x3,0x3,0x6, 0x6,0xc,0xc,0x18,0x18,0x30,0x30,0x1f, 0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18, 0x1f,0x8,0x1c,0x36,0x63,0x1ff,0x3,0x6, 0xc,0x18,0x3e,0x60,0x7e,0x63,0x63,0xde, 0x3,0x3,0x3,0x3b,0x67,0x63,0x63,0x63, 0x3f,0x3e,0x63,0x3,0x3,0x63,0x3e,0x60, 0x60,0x60,0x7e,0x63,0x63,0x63,0x73,0x6e, 0x3e,0x63,0x7f,0x3,0x63,0x3e,0x3c,0x66, 0x6,0x6,0x3f,0x6,0x6,0x6,0xf,0x7e, 0x63,0x63,0x73,0x6e,0x60,0x63,0x3e,0x3, 0x3,0x3,0x3b,0x67,0x63,0x63,0x63,0x63, 0x18,0x18,0x0,0x1e,0x18,0x18,0x18,0x18, 0x7f,0x30,0x30,0x0,0x3c,0x30,0x30,0x30, 0x30,0x30,0x33,0x1e,0x3,0x3,0x3,0x63, 0x33,0x1b,0x1f,0x33,0x63,0x1e,0x18,0x18, 0x18,0x18,0x18,0x18,0x18,0x7f,0x37,0x6b, 0x6b,0x6b,0x6b,0x6b,0x3b,0x67,0x63,0x63, 0x63,0x63,0x3e,0x63,0x63,0x63,0x63,0x3e, 0x3b,0x67,0x63,0x63,0x63,0x3f,0x3,0x3, 0x7e,0x63,0x63,0x63,0x73,0x6e,0x60,0x60, 0x37,0x6e,0x66,0x6,0x6,0xf,0x3e,0x63, 0xe,0x38,0x63,0x3e,0x4,0x6,0x3f,0x6, 0x6,0x6,0x66,0x3c,0x63,0x63,0x63,0x63, 0x73,0x6e,0x63,0x63,0x63,0x36,0x1c,0x8, 0x63,0x63,0x6b,0x6b,0x77,0x63,0x63,0x36, 0x1c,0x1c,0x36,0x63,0x63,0x63,0x63,0x63, 0x36,0x1c,0xc,0x7,0x3f,0x18,0xc,0x6, 0x3,0x7f,0x38,0xc,0xc,0xc,0x7,0x4, 0xc,0xc,0xc,0x38,0x3,0x3,0x3,0x3, 0x3,0x0,0x3,0x3,0x3,0x3,0x3,0x7, 0xc,0xc,0xc,0x38,0x8,0xc,0xc,0xc, 0x7,0xce,0xdb,0x73,0x1ff,0x1ff,0x1ff,0x1ff, 0x1ff,0x1ff,0x1ff,0x1ff,0x1ff,0x1ff,0x1ff,0x1ff, }; 0707070000020026041006440001460001440000010321740352420030100000600000001710mch.oRQÁš.textðŒ| .dataðð@.bssðð€NºNsBgHçÿÿNh/H<0/H䈀ÿ/N¹X o>8) >= ' ' && ((*buf)>>8) <= 0x7f ) printf("%c", (*buf)>>8 ); else printf("."); if( ((*buf)&0xff) >= ' ' && ((*buf)&0xff) <= 0x7f ) printf("%c", *buf); else printf("."); buf++; } } printf("\n"); } strcmp(s, t) char *s, *t; { for( ; *s == *t; s++, t++) if( *s == '\0' ) return( 0 ); return( *s - *t ); } strcat(s,t) char s[], t[]; { int i, j; i = j = 0; while( s[i] != '\0' ) i++; while(( s[i++] = t[j++] ) != '\0' ) ; } strcpy(s,t) char *s, *t; { while( *s++ = *t++ ); } issep(c) char c; { if( c == ';' ) return( 1 ); else return( 0 ); } char *gets(line) char *line; { register char *cp; register int i; cp = line; while ((i = getchar()) != EOF && i != '\n') *cp++ = i; *cp = 0; if (i == EOF && cp == line) return NULL; return ( line ); } atoh(cp) register char *cp; { register unsigned i; register sign; sign = 0; if ( *cp == '-' ) { ++cp; sign = 1; } else if ( *cp == '+' ) ++cp; for ( i = 0 ; ishex(*cp) ; ) if( *cp <= '9' ) i = i*16 + *cp++ - '0'; else i = i * 16 + *cp++ - 'A' + 10; return sign ? -i : i; } ishex(c) char c; { if( ( c >= '0' && c <= '9' ) || ( c >= 'A' && c <= 'F' ) ) return( 1 ); else return( 0 ); } flush() { } isspace(c) char c; { if( c==' ' || c=='\t' ) return( 1 ); else return( 0 ); } kbhit() { if( checkchar() == -1 ) return( 0 ); else return( -1 ); } 0707070000020026071006660001460001440000010322000352172542100001100000014433gdtest.h /* First some 'equates' */ #define FLOPPY 0 #define HARDDISK 1 #define TAPE 2 #define LINSIZ 512 #define TRKLEN 512*14 /* Number of bytes on floppy track */ #define F_COMMANDREG 0x00 #define F_STATUSREG 0x00 #define F_TRACKREG 0x01 #define F_SECTORREG 0x02 #define F_DATAREG 0x03 #define H_ERRFLAGS 0x01 #define H_PRECOMP 0x01 #define H_SECCNT 0x02 #define H_SECNUM 0x03 #define H_CYLLOW 0x04 #define H_CYLHIGH 0x05 #define H_SDH 0x06 #define H_COMMANDREG 0x07 #define H_STATUSREG 0x07 #define FROM_DEVICE 0x01 #define TO_DEVICE 0x00 #define F_RDCMD 0 #define F_WTCMD 1 #define F_RSTCMD 2 #define F_SEEKCMD 3 #define F_HELPCMD 4 #define F_QUITCMD 5 #define F_RDIDCMD 6 #define F_RDTRACKCMD 7 #define F_WTTRACKCMD 8 #define F_STEPCMD 9 #define F_FORMATCMD 10 #define F_FICMD 11 #define F_REGISTERSCMD 12 #define F_STATCMD 13 #define F_CMDREGCMD 16 #define F_TKREGCMD 17 #define F_SECTRGCMD 18 #define F_DTREGCMD 19 #define F_RADIXCMD 20 #define F_HEADCMD 21 #define F_SECTBUFFERCMD 22 #define F_TRACKBUFFERCMD 23 #define F_IDBUFFERCMD 24 #define F_RESETCMD 25 #define F_MTRONCMD 26 #define F_MTROFFCMD 27 #define F_INITCMD 28 #define F_REPEATCMD 29 #define H_RDCMD 100 #define H_WTCMD 101 #define H_RSTCMD 102 #define H_SEEKCMD 103 #define H_HELPCMD 104 #define H_QUITCMD 105 #define H_STEPCMD 109 #define H_FORMATCMD 110 #define H_REGISTERSCMD 112 #define H_STATCMD 113 #define H_CMDREGCMD 116 #define H_RADIXCMD 120 #define H_HEADCMD 121 #define H_SECTBUFFERCMD 122 #define H_RESETCMD 125 #define H_INITCMD 128 #define H_REPEATCMD 129 #define H_SECTCNTCMD 130 #define H_SECTNUMCMD 131 #define H_CYLOWCMD 132 #define H_CYHIGHCMD 133 #define H_SDHCMD 134 /* added 12/84 */ #define H_DRDSEC 135 #define H_DWRSEC 136 #define DRIVECMD 200 #define H_NULLCMD 201 #define F_NULLCMD 202 #define T_NULLCMD 203 /* Tape commands 1/85 */ #define T_INITCMD 300 #define T_SELECT 301 #define T_POS_BEGIN 302 #define T_POS_ERASE 303 #define T_POS_INIT 304 #define T_WR_DATA 305 #define T_WR_FLMK 306 #define T_WR_MULT_FLMK 307 #define T_RD_DATA 308 #define T_RD_FDATA 309 #define T_RD_RDATA 310 #define T_RD_FLMK 311 #define T_RD_EOD 312 #define T_RD_RFLMK 313 #define T_RD_MULT_FLMK 314 #define T_RD_STAT 315 #define T_REPEATCMD 316 #define T_QUITCMD 317 #define T_HELPCMD 318 #define T_SBUF 319 #define T_RD5_DATA 320 #define T_WR5_DATA 321 #define T_WR_SEND 322 #define T_RD_SEND 323 #define T_WAIT 324 #define T_SET_DMA 325 #define T_START_DMA 326 #define T_STOP_DMA 327 #define T_SBUF_CONT 328 struct key { char *keyword; char *keyshort; int keycase[3]; } keytab[] ={ "READ", "RD", F_RDCMD, H_RDCMD, T_RD_DATA, "WRITE", "WR", F_WTCMD, H_WTCMD, T_WR_DATA, "READDID", "RI", F_RDIDCMD, H_NULLCMD, T_NULLCMD, "READTRACK", "RT", F_RDTRACKCMD, H_NULLCMD, T_NULLCMD, "WRITETRACK", "WT", F_WTTRACKCMD, H_NULLCMD, T_NULLCMD, "RESTORE", "RS", F_RSTCMD, H_RSTCMD, T_POS_INIT, "RECAL", "RC", F_RSTCMD, H_RSTCMD, T_POS_INIT, "HOME", "H", F_RSTCMD, H_RSTCMD, T_POS_BEGIN, "SEEK", "S", F_SEEKCMD, H_SEEKCMD, T_NULLCMD, "STEP", "", F_STEPCMD, H_NULLCMD, T_NULLCMD, "FORMAT", "FM", F_FORMATCMD, H_FORMATCMD, T_NULLCMD, "FORCEINT", "FI", F_FICMD, H_NULLCMD, T_NULLCMD, "REGISTERS", "RG", F_REGISTERSCMD, H_REGISTERSCMD, T_NULLCMD, "STATUS", "ST", F_STATCMD, H_STATCMD, T_RD_STAT, "COMMANDREG", "CR", F_CMDREGCMD, H_CMDREGCMD, T_NULLCMD, "TRACKREG", "TR", F_TKREGCMD, H_NULLCMD, T_NULLCMD, "SECTREG", "SR", F_SECTRGCMD, H_NULLCMD, T_NULLCMD, "DATAREG", "DR", F_DTREGCMD, H_NULLCMD, T_NULLCMD, "HELP", "?", F_HELPCMD, H_HELPCMD, T_HELPCMD, "RADIX", "", F_RADIXCMD, H_RADIXCMD, T_NULLCMD, "QUIT", "Q", F_QUITCMD, H_QUITCMD, T_QUITCMD, "HEAD", "HD", F_HEADCMD, H_HEADCMD, T_NULLCMD, "SECTORBUFFER", "SB", F_SECTBUFFERCMD,H_SECTBUFFERCMD, T_SBUF, "TRACKBUFFER", "TB", F_TRACKBUFFERCMD, F_TRACKBUFFERCMD, T_NULLCMD, "IDBUFFER", "IB", F_IDBUFFERCMD, H_NULLCMD, T_NULLCMD, "RESET", "", F_RESETCMD, H_RESETCMD, T_NULLCMD, "MTRON", "", F_MTRONCMD, H_NULLCMD, T_NULLCMD, "MTROFF", "", F_MTROFFCMD, H_NULLCMD, T_NULLCMD, "INITIALIZE", "I", F_INITCMD, H_INITCMD, T_INITCMD, "REPEAT", "R", F_REPEATCMD, H_REPEATCMD, T_REPEATCMD, "SECCNTREG", "SC", F_NULLCMD, H_SECTCNTCMD, T_NULLCMD, "SECNUMREG", "SN", F_NULLCMD, H_SECTNUMCMD, T_NULLCMD, "CYLLOWREG", "CL", F_NULLCMD, H_CYLOWCMD, T_NULLCMD, "CYLHIGHREG", "CH", F_NULLCMD, H_CYHIGHCMD, T_NULLCMD, "SDHREG", "SDH", F_NULLCMD, H_SDHCMD, T_NULLCMD, "DRIVE", "DR", DRIVECMD, DRIVECMD, DRIVECMD, "DREAD", "DRD", H_DRDSEC, H_DRDSEC, T_NULLCMD, "DWRITE", "DWR", H_DWRSEC, H_DWRSEC, T_NULLCMD, "SELECT", "SL", F_NULLCMD, H_NULLCMD, T_SELECT, "POSBEGIN", "PB", F_NULLCMD, H_NULLCMD, T_POS_BEGIN, "ERASE", "ER", F_NULLCMD, H_NULLCMD, T_POS_ERASE, "WRSEND", "WRS", F_NULLCMD, H_NULLCMD, T_WR_SEND, "WRFLMK", "WF", F_NULLCMD, H_NULLCMD, T_WR_FLMK, "RDSEND", "RDS", F_NULLCMD, H_NULLCMD, T_RD_SEND, "RDFLMK", "RF", F_NULLCMD, H_NULLCMD, T_RD_FLMK, "WAIT", "W", F_NULLCMD, H_NULLCMD, T_WAIT, "SETDMA", "SDMA", F_NULLCMD, H_NULLCMD, T_SET_DMA, "BEGDMA", "BDMA", F_NULLCMD, H_NULLCMD, T_START_DMA, "ENDDMA", "EDMA", F_NULLCMD, H_NULLCMD, T_STOP_DMA, "SBCONT", "SBC", F_NULLCMD, H_NULLCMD, T_SBUF_CONT #ifdef LATER "WRMFLMK", "WMF", F_NULLCMD, H_NULLCMD, T_WR_MULT_FLMK, "RDDATF", "RDF", F_NULLCMD, H_NULLCMD, T_RD_FDATA, "RDDATR", "RDR", F_NULLCMD, H_NULLCMD, T_RD_RDATA, "RDMFLMK", "RMF", F_NULLCMD, H_NULLCMD, T_RD_MULT_FLMK, "RDEOD", "EOD", F_NULLCMD, H_NULLCMD, T_RD_EOD, "READ5", "RD5", F_NULLCMD, H_NULLCMD, T_RD5_DATA, "WRITE5", "WR5", F_NULLCMD, H_NULLCMD, T_WR5_DATA, "RDFLMKR", "RFR", F_NULLCMD, H_NULLCMD, T_RD_RFLMK, #endif }; #define NKEYS (sizeof(keytab) / sizeof(struct key)) #define MAXARG 64 /* maximum command line arguments */ struct param { int nparams; int drive; char devcmd; char dmadir; int dmacnt; int param1; int param2; int param3; } cmd; char sbuf[528]; /* Sector buffer */ char tbuf[TRKLEN]; /* Track buffer */ char ibuf[6]; /* ID buffer */ int fdstat = 0; /* Last floppy status */ int hdstat = 0; /* Last hard disk status */ int head = 0; /* Current head */ int drive = FLOPPY; int hdcyl = 0; /*char sbuf1[528],sbuf2[528],sbuf3[528],sbuf4[528],sbuf5[528];*/ /*char *tapebuf[5] = { sbuf1,sbuf2,sbuf3,sbuf4,sbuf5 };*/ #define INT_REG ((unsigned short *)0x45000a) #define FD_BASE ((unsigned short *)0xE10000) /* R/W */ #define HD_BASE ((unsigned short *)0xE00000) /* R/W */ 0707070000020026111006440001460001440000010322070352420031000000700000003176math.oRQÈ0/.text¤Œ .data¤¤@.bss¤¤€NVHç8B„$lD‚F„&.l$DƒF„`NVHç8B„$.lD‚F„&. lDƒF„B€0ÀÃ2HBÄÃHCÂÃÒ‚HABAÐJ„lD€LßN^NuNVHç<zJ€lD€D…&".l&DD…` NVHç<z .lD€D…&". lDD…( lB@H@€Á40€ÁH@0H@`(â€â lô€Á€ÿÿ$//Nº˜P¶€lS‚ J…lD€Lßtp_regs.tp_hcreg; if( ((hcreg_save & TP_INTRQ) == 0) || ( ((hcreg_save & TP_EXCPTN) == 1) && ((hcreg_save & TP_NRDY) == 1) ) ) { printf("Spurious interrupt level 1\n"); return; } if( (hcreg_save & TP_EXCPTN) == 0 ) { printf("Tape exeption!\n"); cmd->tape_excptn = 1; } else if( (hcreg_save & TP_NRDY) == 0 ) { cmd->tapeint = 1; } hcreg_save = *cmd->tp_regs.tp_chsml; } 0707070000020026131007550001460001440000010322120353460731400000700000000400Remove echo "Removing DIAGNOSTIC DISK GENERATOR files" rm -fr /u/tutor/diag_gen # # Now update the user agent special files # echo "Updating special Office files" uaupd -r "Diagnostic Disk Generator" Office echo "DIAGNOSTIC DISK GENERATOR removal complete" 0707070000020026141006660001460001440000010322130352172542300001000000031624i8274.c /* Convergent Technologies - System V - Jul 1983 */ extern unsigned char TEST_ON ; /* added 05/4 to stop test,defined in 'main.c' */ extern unsigned char TEST_STATUS ; /* if 1, test can not be interrupted */ extern char putc; /* * I8274 serial driver * Based on the System V DZ driver. */ #include "sys/param.h" #include "sys/types.h" #include "sys/hardware.h" #include "sys/iohw.h" #include "sys/i8274.h" #include "diag.h" extern BOOLEAN fPageMode, fLPEOn, fremote; extern ushort mcr_save; int PMCount; extern struct device sertty0, sertty1, *ser_addr[]; extern int init_68010(); extern int initkbd(); extern ResetModem(); char *pKbdIn, *pKbdGet; char KbdBuf[200]; char fKbdTest; int lastkey; int prncol = 1; /* Current print column (for tab expansion) */ static int WAIT_ABORT = 0; #define kbdbufsiz 128 int inp = 0; int outp = 0; int kbdbuf[kbdbufsiz]; char rs232buf[10]; char *putptr = &rs232buf[0]; char *getptr = &rs232buf[0]; /* * return zero if charcters still being sent by 8274. */ int serchkallsnt(adr) ushort *adr; { *adr = 1; /* select RR1 */ return( (int)((ushort)*adr & ALL_SENT)); } /* * Initialize the 8274. */ serparam(dev) { register int lpr; register struct device *seraddr; register unsigned short *cmdad; seraddr = ser_addr[dev]; cmdad = seraddr->cmdad; /* get the command addr for this port */ /* wait for any output to complete */ /* while ( ! i ) {*/ /* this waits until the last \r is sent */ /* i = serchkallsnt(cmdad); printf("%d ",i); } */ *cmdad = RST_CHNL; *cmdad = RST_CHNL; *cmdad = ERR_RESET | RST_TX_URUN; *cmdad = 4; /* select WR4 */ lpr = X16; lpr |= STOP1; *cmdad = seraddr->wr4 = lpr; *cmdad = 1; /* select WR1 */ /* serial port will be polled *cmdad = seraddr->wr1 = RX_INT_ALLPE | VEC_TYPE ; */ *cmdad = seraddr->wr1 = VEC_TYPE ; *cmdad = 2; /* select WR2 */ if ( seraddr->bprt ) { /* 0 since vectored mode is not used */ *cmdad = seraddr->wr2 = 0; } else { *cmdad = seraddr->wr2 = INTA_INTB; } *cmdad = 3; /* select WR3 */ lpr = 0; lpr = RX_ENAB; lpr |= RX8; *cmdad = seraddr->wr3 = lpr; *cmdad = 5; /* select WR5 */ lpr &= RX_SIZE; lpr = lpr >> 1; /* lpr = TX char size */ *cmdad = seraddr->wr5 = lpr | TX_ENABLE | DTR | RTS; /* set to 9600 baud */ seraddr->clkcnt = (ushort *) ((char *)A_BAUD_ADDR + 4); *seraddr->clkcnt = 0; *cmdad = ERR_RESET | RST_TX_URUN; *cmdad = RST_EX_INT; } getkbd() { register char c; if ( ! ((ushort)*C_CMND_ADDR & 0x0100) ) { return (-1); } c = ((ushort)*C_DATA_ADDR >> 8); return (c & 0xff); } putkbd (c) /* ----------------------------------------------------------------- | This procedure is called to write a character to the | | keyboard or mouse. -1 is returned the byte cannot | | be sent right away. | ----------------------------------------------------------------- */ register int c; { if ( ! ((ushort)*C_CMND_ADDR & 0x0200) ) return (-1); *C_DATA_ADDR = (ushort) (c << 8); return (0); } getintkbd() /* ----------------------------------------------------------------- | This procedure is called to get a character from the | | keyboard or mouse. -1 is returned if no character | | is available. | ----------------------------------------------------------------- */ { char c; if (pKbdIn == pKbdGet) return (-1); c = *pKbdGet++; c &= 0xFF; if (pKbdGet == KbdBuf+200) pKbdGet = KbdBuf; return (c); } /* * Dedicated console serial port handler RS-232 port A. */ putchar (c) register int c; { int LPReg; switch((char)( c )) { case '\n': prncol = 0; putchar ('\r'); if (fPageMode) { if (PMCount++ > 21) { fPageMode = FALSE; printf(""); (void) get1char(); putchar('\n'); PMCount = 0; fPageMode = TRUE; } } break; case '\t': do { putchar( ' ' ); } while( (prncol & 0x07) != 0 ); break; case '\b': --prncol; break; default: if ( c >= ' ' && c < 0x80 ) ++prncol; break; } if( fremote ) { while ( ! ((ushort)*A_CMND_ADDR & TX_EMPTY) ) ; *A_DATA_ADDR = (ushort)c; } else vputc( c ); LPReg = *LP_STATUS_ADDR & 0xf0; if (fLPEOn ) { if ( LPReg & LP_SELECTED && LPReg & LP_BUSY && LPReg & LP_OUT_PAPER && LPReg & LP_ERR ) { fLPEOn = FALSE; printf("\nLine printer not present!\n"); return; } while ((*LP_STATUS_ADDR&0xf0) & LP_BUSY) ; *LP_DATA_ADDR = (ushort)c; *MCR_ADDR = mcr_save &= ~LPSTB; /* strobe printer */ *MCR_ADDR = mcr_save |= LPSTB; mcr_save |= 0x0; *MCR_ADDR = mcr_save &= ~LPSTB; } return; } /* putchar ends */ get1char() { register char c; if( fremote ) { /* while ( putptr == getptr) ; s = spl7(); c = *getptr++; if (getptr >= &rs232buf[10]) getptr = &rs232buf[0]; splx(s); */ while ( ! ((ushort)*A_CMND_ADDR & RX_IN) ) ; c = (ushort)*A_DATA_ADDR; } else { while((c = kgetchar()) == 0 ); } c &= 0xff; if (c == (char)'\r') c = (char)'\n'; putchar (c); return c; } getchar() { static char s[128]; static char *p, *q; register char c; if (p < q) done: return *p++; freshline: p = q = s; lineloop: switch (c = get1char()) { case '\n': if (q < s + sizeof(s)) *q++ = c; goto done; case '\b': if (q > s) q--; putchar(' '); if (q>=s) putchar('\b'); goto lineloop; case '\177': putchar ('\n'); goto freshline; default: if (q < s + sizeof(s)) *q++ = c; goto lineloop; } } checkchar() { if( fremote ) { if (((ushort)*A_CMND_ADDR & RX_IN) == 0 ) return(-1); else return( 0 ); } else { if( inp == outp ) return( -1 ); else return( 0 ); } } /* * Ask if want to abort test. Enter 'y' or 'Y' and '\n' to abort (return 0), * enter any other character and '\n' to continue (return -1). * If abort selected, print Test Aborted message. */ checkabort() { register char c; printf("\tEnter y [Y] to Abort, Return to continue: "); if ( (c = getchar()) != '\n') { while ( getchar() != '\n' ) ; } if ( (c == 'y') || (c == 'Y') ) { printf("\n\t\t\t**TEST ABORTED**\n"); return( 0 ); } else { return( -1); } } khigh( c ) int c; { static char second = 0; if ( WAIT_ABORT ) { putchar( c ); if( second ) { WAIT_ABORT = 0; putchar('\n'); lastkey = -1; user_menu(); } if ( c == 'y' || c == 'Y' ) { second = 1; } else { WAIT_ABORT = 0; putchar('\n'); } } else { if (TEST_ON) /* if TEST is ON then check for test abortion */ { if ( ok_to_abort( c,TEST_STATUS ) ) /* if the test can be aborted */ { WAIT_ABORT = 1; /* set flag, wait for a 'Y' */ second = 0; get_abort_key(); /* routine gets next key, will call khigh(), recursively */ } else fill_kbdbuf( c ) ; /* save the cahr. in buffer */ } /* end if TEST_ON */ else fill_kbdbuf( c ) ; } } /* end khigh */ fill_kbdbuf( c ) int c; { if( inp != (outp - 1)) { kbdbuf[inp++] = c; if( inp == kbdbufsiz ) inp = 0; } } /* end 'fill_kbdbuf' */ /* ----------------------------------------- | | | GET_ABORT_KEY | | | ----------------------------------------- */ get_abort_key() { char c; while ( (c = getkbd()) != -1 ) { } /* remove all chars from kbd */ #ifdef MANUFACTURE printf("\nPrint error listing?(Y/N)"); #else printf("\nDo you want to abort testing( Y/N ) ? "); #endif for ( ; ; ) { if ( !WAIT_ABORT ) break; /* as soon as khigh reset WAIT_ABORT, stop waiting */ if (( c= getkbd() ) != -1 ) klow( c ); } } /* ----------------------------------------- | | | USER_MENU | | | ----------------------------------------- */ user_menu() { #ifdef MANUFACTURE int s; BOOLEAN lpMode; lpMode = fLPEOn; TEST_ON = 0; fLPEOn = TRUE; printf("\nPrint Error table!\n"); s = spl2(); PrintErrorTable(); splx( s ); fLPEOn = lpMode; TEST_ON = 1; #else TEST_ON = 0 ; /* no test */ TEST_STATUS = 0 ; /* OK to interrupt */ putc = 0; kflush(); ResetModem(); initkbd(); main1(); #endif } /* ----------------------------------------- | | | DUMPERRORTABLE | | | ----------------------------------------- */ DumpErrorTable() { } /* ----------------------------------------- | OK_TO_ABORT | | | | c: must match ABORTKEY to cancel test | | testing: must be 0 to cancel test | | | ----------------------------------------- */ #define ABORTKEY -1 ok_to_abort( c,testing ) char c; int testing; { if ( c == ABORTKEY ) { switch ( testing ) { case 0 : return(1) ; /* ok to abort */ case 1 : printf("\nUnsafe to abort!\n"); return(0) ; /* can not abort */ default: return(0) ; } } else return( 0 ); } /* end 'ok_to_abort' */ int kgetchar() { int c; if( outp != inp ) { c = kbdbuf[ outp++ ]; if( outp == kbdbufsiz ) outp = 0; return( c ); } else return( 0 ); } kflush() { char c; while( !checkchar() ) c = get1char(); } initkbd() /* ----------------------------------------------------------------- | The keyboard port is initialized to 8 bits per character | | with no parity at 1200 baud. | ----------------------------------------------------------------- */ { register ushort *kbd_cmnd; /* The 6850 has only one control byte, set to 0x95 which */ /* sets for divide by 16 (b0, b1), 8 data bits with 1 stop */ /* bit (b2, b3, b4), transmit interrupt disabled (b5, b6), */ /* and receive interrupt enabled (b7). */ kbd_cmnd = C_CMND_ADDR; *kbd_cmnd = 0x0300; /* master reset */ *kbd_cmnd = 0x9500; } 0707070000020026251006660001460001440000010322310352172542500001300000010122i8274sub.c/* Convergent Technologies - System V - Jul 1983 */ /*static char i8274sub_c[] = "@(#)i8274sub.c 1.2";*/ /* * I8274 serial driver * Based on the System V DZ driver. */ #define defined_io 1 /* to get the defines from termio.h */ #include "diag.h" #include "sys/types.h" #include "sys/tty.h" #include "sys/termio.h" #include "sys/hardware.h" #include "sys/iohw.h" #include "sys/i8274.h" #ifdef lint #define register #endif #ifndef NULL #define NULL 0 #endif /* * Configuration information */ #define DISK_0 1 #define I8274_0 3 #define S2651_0 2 #define PLP_0 1 #define PRF_0 1 #define MEMORY_0 1 #define TTY_0 1 #define ERRLOG_0 1 #define N_TTYS 1 #define N_PTS (S2651_0 * 8) #define NBUF 32 #define NINODE 120 #define NFILE 115 #define NMOUNT 4 #define SMAPSIZ 50 #define NSWAP 1250 #define NCALL 30 #define NPROC 100 #define NTEXT 50 #define NCLIST 150 #define NSABUF 0 #define POWER 0 #define MAXUP 25 #define NSWBUF 24 #define NSERBUF 200 #define SERHI 20 #define NHBUF 64 #define NPBUF 4 #define CSIBNUM 20 #define MESG 1 #define STIBSZ 8192 #define STOBSZ 8192 #define STIHBUF (ST_0*4) #define STOHBUF (ST_0*4) #define STNPRNT (ST_0>>2) #define RDBUFSZ 4096 char *serrdbuf[N_TTYS]; /* address of read buffers initialized by RS232Enable */ char serchip[N_TTYS]; ushort sererror[N_TTYS]; int ser_cnt = N_TTYS; struct tty ser_tty[N_TTYS]; /* data associated with the low level RS-232 input routine in ml/i8274.s */ struct device sertty0 = { 0, NULL, A_CMND_ADDR, A_DATA_ADDR, A_CMND_ADDR, 0,0,0,0,0,0,A_BAUD_ADDR,0 }; struct device *ser_addr[] = { &sertty0, &sertty0 }; #define SZSERBUF (N_TTYS * NSERBUF) unsigned short serbuf[SZSERBUF]; unsigned short *inptr = serbuf; /* addr of next char to put in buffer */ unsigned short *outptr = serbuf; /* address of next char to take from buffer */ int serbufcnt = 0; /* count of characters in buffer */ int serbufful = SZSERBUF; /* max characters that can be put in buffer */ int serhiwater = (SZSERBUF - (N_TTYS*SERHI)); /*hi water mark, when serbufcnt exceeds -xoff */ int serlowater = ((SZSERBUF / 4) * 1); /*low water mark, when serbufcnt falls below -xon */ char serinprogress = 0; /* =1 means C serrint is running */ char serxoff = 0; /* XOFF from RX blocking TX */ char serinxoff = 0; /* received XOFF blocking TX */ char serrqstxoff = 0; /* RX requests TX to send XOFF */ char sercd = 0; /* state of CD for each line */ char sercts = 0; /* state of CTS for each line */ char sertxblkd =0; unsigned short *eserbuf = &serbuf[SZSERBUF]; /* first address past end of serbuf */ short ser_ports[ N_TTYS ] = {0}; /* preserves extended control bits per 8274 port */ /* * 8253 counts for specified baud rates. * Input clock is 1228800 HZ. 8274 is programmed with 16X. * count=0 means hangup. a negative count means external clocking. */ short serspdtbl[] = { 0, /* 0 baud = hangup */ 510, /* 50 baud */ 510, /* 75 baud */ 348, /* 110 baud (110.03) */ 284, /* 134.5 baud (skewed)*/ 256, /* 150 baud */ 192, /* 200 baud */ 128, /* 300 baud */ 64, /* 600 baud */ 32, /* 1200 baud */ 24, /* 1800 baud (1785.05) */ 16, /* 2400 baud */ 8, /* 4800 baud */ 4, /* 9600 baud */ 2, /* 19200 baud */ -1 /* external clock */ }; static char ser_xon = CSTART; static char ser_xoff = CSTOP; /* bits in the dev parameter to the sertint procedure */ #define CHCD 0x10 /* change in carrier detect (CD) */ #define CHCTS 0x20 /* change in CTS */ #define TX_URUN 0x40 /* TX underrun/EOM */ #define BREAK 0x80 /* break/abort */ #define ON 0 /* set controls in sermodem */ #define OFF 1 /* turn off controls in sermodem */ #define SERCSCAN 2 /* clock ticks for character scan */ #define SERMSCAN 20 /* scan loops for modem scan */ #define SER_CHAR 01 /* character arrived flag (ser_work) */ #define SER_ACT 02 /* character in buffer flag (ser_work) */ char ser_work[64]; /* call list for line discipline */ /* needs to be made by config */ short ser_scan; /* * Based on io/tty.c */ char ttcchar[NCC] = { CINTR, CQUIT, CERASE, CKILL, CEOF, 0, 0, 0 }; 0707070000020026271007770001460001440000010322360353460731400001000000000142cdtutorcd /u/tutor/diag_gen echo Documentation is located in ./README suitable for printing. exec $SHELL 0707070000020026301006660001460001440000010322370352172542600001300000002070ifile.0410/* ifile.0410 "@(#)ifile.0410 1.1" for diagnostic */ /* * Loader directives file for magic 0410 -n option. * * Produces a file with text and data/bss in separate segments, * so that the text can be marked non-writeable and shared. * * The directives result in: * Specifying that virtual memory has its origin at 0x00000, * and extends for another 0x37ff000 bytes. * Specifying that the text & data be loaded so that: * text virtual address relocated (bonded) to 0x00000 origin. * data virtual address relocated to next 65536 boundary * bss appearing right after data in file and in virtual memory * * This directives file is used with the Common Object File loader * that is shipped with Unix System V, with a few minor changes. * The target processor is the Convergent Technologies MegaFrame, * a virtual process multiple-processor 68010 implementation * with demand paging. * * Convergent Technologies * 20 June 83 * Paul Jackson */ MEMORY { user_mem : origin = 0x1000 , length = 0x37ff000 } SECTIONS { .text 0x1000 : {} .data : {} .bss : {} } 0707070000020026311006660001460001440000010322420352172542600000700000014651init.c/* Convergent Technologies - System V - Jul 1983 */ /*static char init_c[] = "@(#)init.c 1.2";*/ /* init.c contains the various functions for system initialization. * These are for the main cpu only; peripheral initialization is * taken care of by the individual peripheral tests. */ #include "diag.h" #include "sys/hardware.h" #include "sys/pte.h" #include "sys/iohw.h" #include "sys/i8274.h" #include "sys/dialer.h" #include "sys/gdisk.h" extern char *pVidUserErr,*pRecord,*pCont; extern execution_t ExecutionMode; extern BOOLEAN fPageMode; extern int ErrorCount; extern long tminMem,tmaxMem,tminPage,tmaxPage,initkbd(); extern int E1tminMem,E1tmaxMem,E2tminMem,E2tmaxMem,E3tminMem,E3tmaxMem,E4tminMem,E4tmaxMem; extern int end, edata, fault(), Int8274A(), Int6850(), IntFDHDDMA(), Int(); extern char *pNMIStray; extern ushort GSR, BSR0, BSR1; extern int RealCount; extern ushort mcr_save; unsigned char P2_P3 = 0; /* true = P2, false = P3 */ init_68010() { int i; int adr; spl7(); /* no interrupt yet */ *MCR_ADDR = mcr_save |= 0x0f00; for (i=8; i<1024; i += 4) /* ------------------------------------------------- | If debugger prom then trap #14 to debugger | | else trap #14 to start of bootrom | ------------------------------------------------- */ if (i == 4*46) { adr = *(int *)0x800008; if (!adr) *(int *) i = *(int *)0x800004; else *(int *) i = adr; } else * (int *) i = (int) fault; for (i=25; i<31; i ++ ) * (int *) (i*4) = (int) Int; /* ------------------------------------------------- | Autovector level 3 and 4 is used for the | | two 8274s. All interrupt decoding is done | | at those interrupt routines. | ------------------------------------------------- */ /* ------------------------------------------------- | Autovector level 2 is used for the Floppy | | Disk, Hard Disk and DMA. All interrupt | | decoding is done at that interrup routine. | ------------------------------------------------- */ initkbd(); while ( putkbd(0x92) == -1) {}; chipinit(); /* init 8274 */ DiskDisable(); FindVersion(); /* find hardware prototype version */ *CSR_ADDR = 0; /* Clear Error Status */ *SYSERR_GCR_ADDR = SYSERR_ENABLE; RealCount = 0; /* forget prestored commands */ srand((unsigned) tmaxMem); ResetModem(); Init_telephony(); /* ------------------------------------------------- | Lower interrupt level to allow LP,HD,FD, | | keyboard,8274 interrupt( disable all interrupt| | at chip level ). | | If P2 then allow 8274 extern interrupt, no | | interrupt on HD,FD | | Reset 60 hz interrupt | ------------------------------------------------- */ *MCR_ADDR = mcr_save |= 0x8000; *MCR_ADDR = mcr_save &= 0x7fff; *MCR_ADDR = mcr_save |= 0x8000; /* all 8274 interrupts are disabled at chip level */ if ( P2_P3 ) /* if P2 */ { *A_CMND_ADDR = RST_EX_INT; *A_CMND_ADDR = 1; *A_CMND_ADDR = 0x1; /* extern interrupt enabled */ } else /* if P3 */ { i = (int)FD_BASE[ F_STATUSREG ] ; i = (int)HD_BASE[ H_STATUSREG ] ; *LP_DATA_ADDR = (ushort) 0x0; } ClearParity(); /* parity interrupt disabled */ spl0(); /* no HD,FD,LP interrupt */ } SetS4Map () { register ushort *pMap; register int i; pMap = (ushort *) PG_BASE; for(i = 0; i < TOTAL_PAGES; i++) #ifndef NON_UNITY *pMap++ = (i | PG_PRESENT) & PG_IN; #else NON_UNITY *pMap++ = ((i+0x20) | PG_PRESENT) & PG_IN; #endif NON_UNITY } ResetAccess() { register ushort *pMap; register int i; pMap = (ushort *) PG_BASE; for(i = 0; i < TOTAL_PAGES; i++) { *pMap = (*pMap | P_ACCESS_CHECK) & PG_IN; pMap++; } } SetMemLimits() { tminMem = (((int) &end)+0x1900) & (~0xfff); SizeMemory(); /* detect 256K chips */ SizeEMemory(); /* detect expansion mem */ tminPage = (tminMem >> PAGESHIFT) + 1; tmaxPage = (tmaxMem >> PAGESHIFT); } chipinit() /* ----------------------------------------------------------------- | Initialize the 8274s, update control register 2 for both | | channels, subsequent parameter changes should not include | | these registers. | ----------------------------------------------------------------- */ { *A_CMND_ADDR = RST_CHNL; *B_CMND_ADDR = RST_CHNL; *A_CMND_ADDR = 2; *B_CMND_ADDR = 2; *A_CMND_ADDR = INTA_INTB; *B_CMND_ADDR = 0; serparam(0); *B_CMND_ADDR = 5; /* select async mode using DTR */ *B_CMND_ADDR = 0x00; *B_CMND_ADDR = 1; /* write COND AFFEC STATUS for both chips */ *B_CMND_ADDR = 4; } /* * Check if communications expansion board with RS232+RS422 is there. * It writes a known pattern to the interrupt mask register on the * 8259B, then reads it back to determine if the board is there. */ BOOLEAN commexpbrd() { return(FALSE); } /* LedDisplay accepts an integer and displays the lower 4 bits of * it in the LEDs on the back of the Miniframe. The low order bit * is on the bottom. */ LedDisplay(value) ushort value; { mcr_save = (mcr_save & 0xf0ff) | ( (~value<<8) & 0x0f00); *MCR_ADDR = mcr_save; } /* LedToggle changes the state of led #3 */ LedToggle() { } Init_telephony() { *HNDSET_RELAY = ENB_HNDSET; /* hand set enabled */ *LINE_SELECT = 0x4000; /* select line 1 */ if ( *TEL_STATUSREG & ON_HOOK ) /* if on hook */ { *HOOK1_RELAY = OPENRELAY; /* hook relay off */ *A_LEAD1_RELAY = OPENRELAY; /* A-lead disconnect */ } *LINE1_ACTIVE = 0x0; /* not on hold */ *LINE2_ACTIVE = 0x0; *HOOK2_RELAY = OPENRELAY; *A_LEAD2_RELAY = OPENRELAY; writedialer(0x0); /*reset dialer */ } FindVersion() { ushort flag; P2_P3 = 0xff; /* default is P2 */ /* Parity enabled */ *PE_INT_GCR_ADDR = PE_INT_ENABLE; flag = *GSR_ADDR & 0x8000 ; *PE_INT_GCR_ADDR = PE_INT_DISABLE; if ( (*GSR_ADDR & 0x8000) != flag ) /* D15 must flip to be P3 */ P2_P3 = 0x00 ; /* P3 version */ } config() { execution_t Xmode; BOOLEAN pMode; static char before = 0; if( !before ) { SetMemLimits(); /* spare program's memory from diagnostic */ before = 0xff; Xmode = ExecutionMode; ExecutionMode = LONG; vidregs(); ExecutionMode = Xmode; vidblack(); if( ErrorCount ) { *MCR_ADDR = mcr_save &= 0xf0ff; printf(pVidUserErr); pMode = fPageMode; fPageMode = TRUE; PrintErrorTable(); ClearErrors(); fPageMode = pMode; printf(pRecord); } printf("\n%d bytes On-board memory.",tmaxMem); printf("\n%d bytes Expansion memory.",(E1tmaxMem - E1tminMem) + (E2tmaxMem - E2tminMem) + (E3tmaxMem - E3tminMem) + (E4tmaxMem - E4tminMem) ); } Identify(); if( !before ) { kflush(); printf( pCont ); get1char(); vidblack(); } } 0707070000020026321006660001460001440000010322510353442406400001400000021565disktool.nr.AF "AT&T Information Systems" .TL The Diagnostic Disk Generator--Help for the IHVs .AU "M. E. Smith" MES FJ 1F-101A 5804 01311 .MT "Memorandum for Record" .SA 1 .PM G .H 1 "INTRODUCTION" IHVs who develop hardware as an adjunct to the UNIX PC need to be able to provide diagnostic tests specific to their devices. It is desirable that these vendors be able to create these diagnostics with minimal effort. Furthermore, it is desirable that the diagnostics present a consistent interface with respect to the official diagnostic disk that is a member of the UNIX PC foundation set. .P This memo will describe the installation and use of a tool that allows vendors to create a customized diagnostic disk quickly while requiring that they only know the internals of their devices. The memo will also describe a set of interrupt handling routines and stdio routines provided by the generation environment to make it easier for users to write their hardware-specific diagnostic routines. .H 1 "INSTALLATION OF THE DIAGNOSTIC DISK GENERATOR" The user should go to an empty directory, insert the first floppy disk containing the diagnostic disk source, and use the command .sp .in +4 cpio -iBcdu < /dev/rfp021 .in -4 .sp to install the source. The cpio command will put the source files and Makefile (see Section 5 below) in the empty directory. It will also create a subdirectory named "mkdiag." This directory will contain the diagnostic disk generator files. The user should change directory to mkdiag before proceeding to generate diagnostic disk source. .H 1 "THE DIAGNOSTIC DISK GENERATOR" An example of a diagnostic disk generator session is given in Appendix 1. .P The diagnostic disk generator is invoked by typing the name .sp .in +4 diag .in -4 .P The diagnostic disk generator first asks the user whether he/she wants to add, change, delete, review, make source code, or save. .H 2 "Add command" The generator prompts the user for the following: .BL .LI A one-character identifier of the set of tests. This character should be a small number that will correspond to the index into the menu for this set of tests. .LI An entry in a menu associated with a particular set of tests. .LI A description used for help requests. .LI The list of tests, including the names of function calls that implement the tests. .LI The number of "subtests" within each test. .LE .P At this point the generator creates an internal entry containing the data just entered. .H 2 "Change/Delete command" In both cases the generator prompts the user for the one-character identifier of the set of tests. If "Delete" was requested, the generator deletes the entry from its internal buffer. If "Change" was requested, the user is allowed to re-enter data for this set of tests. .H 2 "Review command" This command causes the generator to dump its internal buffer to the screen using some simple formatting so that the user may review what he/she has entered so far. .H 2 "Make Source command" This command instructs the generator to create source files from the contents of the generator's internal buffer. The result is two files, newmain.c and newmsg.c, that can be compiled (using the Makefile) into a diagnostic executable suitable for copying onto a disk (see below). .H 2 "Save command" The save command instructs the generator to write its internal buffer to disk. In this way a generation session can be restarted at a later date. .H 1 "CREATING THE SPECIFIC FUNCTIONS" The user is responsible for creating source files that carry out the tests on his/her hardware. These functions may have one argument: the subtest number. A function may contain a switch on this number if the user wants that function to execute more than one test. Note that the generator creates subtests in the range 0 to n-1, where n is the number of subtests specified for this test. .H 1 "CREATING THE EXECUTABLE" After the user has executed a "Make Source" command, the files newmain.c and newmsg.c are resident in the mkdiag directory. These files should be copied to the parent directory with the names main.c and msg.c; i.e. .sp .in +4 cp newmain.c ../main.c .br cp newmsg.c ../msg.c .in -4 .sp Also, the files that the user has created to carry out specific diagnostic tests on his/her hardware should be moved to mkdiag's parent directory. All the source files should then be compiled, preferably using the packaged Makefile (see make(1) in the UNIX System V User's Manual) with additions for the user's source files. (The Makefile included with the diagnostic disk source contains "hooks" for names of user-defined source and object files. Those user-defined file names should be substituted for those "hooks.") .P After compilation, the executable should be copied (using "mount(7)" and "cp(1)") to a floppy disk. The executable (whose name is "s4diag" if the packaged Makefile is used) must be named "unix" or linked to an executable with that name in order for the boot rom to load the diagnostic disk code into memory at boot time. .H 1 "THE STANDARD ENVIRONMENT" Certain standard UNIX routines are provided with the source files that are compiled along with the user's hardware diagnostics. Thus the user can call these routines from his/her hardware specific diagnostic code in order to save development time. Synopses of these routines can be found in Appendix 3. .H 1 "CONCLUSION" The diagnostic disk generator provides a simple way to create a diagnostic disk without knowing the internals of the diagnostic disk software. The resulting executable will NOT contain any of the official diagnostic disk tests; if the desire of the IHV is to integrate his/her tests with the official tests, the IHV will have to understand the inner workings of the diagnostic disk source (as briefly described in Appendix 2 below). .SG mes .NS Department 01311 Supervision Members of Produce Development Group Members of Product Software Group W. L. Aranquren R. B. Brandt H. O. Burton A. H. Chien E. V. Courte E. B. Jarrett J. R. Levchuk L. K. Pederson W. Stockman J. K. Wanner .NE .SK .DS Appendix 1: An Example of a Diagnostic Disk Generation Session .DE .SK 1 .DS Appendix 2: Internal Design of the Official Diagnostic Disk Software .DE .P There are five outstanding parts of the diagnostic disk software: .AL 1 .LI The menu entries, all of which are displayed when the diagnostic disk is executed. The entries are defined in the structures pHdUD1 and pHdUD2 in the source file msg.c. .LI For each menu entry, the set of tests executed. The set of tests is defined in the TestList structure in main.c. .LI For each set of tests, the names of functions that define the set. These function names are defined in the fn_array structure in main.c. .LI The code in each of those functions. The code is located in separate files; usually all the functions defining a test are located in the same source file. .LI For each function, a set of subtests. A subtest is a number which is passed as the argument to the testing function. A switch statement in the function interprets the argument and executes the associated subtest. .LE .P Thus, when the diagnostic disk user requests an item from the menu, the software executes a list of (function, subtest) pairs. That list defines the test (actually, the set of tests) that the user requested. .SK .DS Appendix 3: Standard Environment Interface .DE .AL A .LI Interrupt Handling Routines .AL 1 .LI spl0(), spl1(), spl2(), spl3(), spl4(), spl5(), spl6(), spl7(): .P These routines, which have no arguments, reset the hardware priority to zero through seven respectively. They return an integer indicating what the hardware priority was before the spl call. .LI splhi(): .P This routine is identical to spl6(). .LI splx(pri): .P This routine resets the priority to the integer pri. It returns the an integer indicating what the hardware priority was before the splx call. .LE .LI Standard IO Routines .AL 1 .LI getchar(): .P Return the next character read from the console. .LI inflag(): .P Read Y or N from the console and return TRUE or FALSE. .LI innum(pnum, snum, radix): .P Read a number from the console of size snum into an integer *pnum with the given radix. .LI input(pbuff, sbuff): .P Read sbuff characters from the console into the character buffer pbuff, or until EOL ('\\r' or '\\n') or ESC ('\\033'). .LI printf(ctl, arg0, arg1, ...): .br sprintf(buf, ctl, arg0, arg1, ...): .P These routines work as described in printf(3S) in the UNIX System V User's Manual except only the following escape control sequences are allowed. .BL .LI %nd: Single precision signed decimal. .LI %nD: Double precision signed decimal. .LI %no: Single precision unsigned octal. .LI %n): Double precision unsigned octal. .LI %nx: Single precision unsigned hexadecimal. .LI %nX: Double precision unsigned hexadecimal. .MT 3 .LI %ns: String. .LI %c: Character. .LI %%: Percent. .LE .P In the above, "n" can be an integer or "v," whence the field width comes from the argument list. .LI putchar(c): .P Print the given character on the console. .LE 0707070000020026351006660001460001440000010322620352172542700001000000004702input.c/* Convergent Technologies - System V - Jul 1983 */ /*static char input_c[] = "@(#)input.c 1.1";*/ /* * input.c release date June 29, 1983 initial release * * * Input routines used by standalone diagnostics. * Created 10/18/82 RH * * input(pbuff, sbuff) - read into the buff sbuff charaters or * till EOL ('\r' or '\n'), ESC ('\033') * innum(pnum, snum, radix) - read a number of size snum into * an address pnum. * inflag - read in Y or N and return TRUE or FALSE. */ #include "diag.h" #include "sys/iohw.h" #define BELL ('\07') #define DEL ('\177') #define CNTL_C ('\03') extern char getchar(); extern putchar(); input(pBuff, sBuff) char *pBuff; int sBuff; { int i,j; char c, *p; i = 0; p = pBuff; for(;;) { c = getchar(); if ((c >= ' ') && (c < DEL)) { /* putchar(c); */ p[i++] = c; if(i >= sBuff) { putchar('\n'); /* putchar('\r'); */ return(sBuff); } } else { if ((c == '\n') || (c == '\r')) { /* putchar('\n'); */ /* putchar('\r'); */ return(i); } if (c == '\033') { if (i == 0) { printf("\n"); return(ESCAPE); } } j = i; if (c == '\b') { if (j != 0) j = 1; } else if (c != DEL) putchar(BELL); backspace(j); i = i-j; } } } backspace(cnt) int cnt; { for(;cnt > 0; --cnt) { putchar('\b'); putchar(' '); putchar('\b'); } } innum(pNum, sNum, radix) int *pNum; unsigned short sNum; unsigned short radix; { char buff[10], c; int cnt, i, w; for(;;) { *pNum = 0; cnt = input(buff, (int) 10); if (cnt == 0) return(EMPTY); if (cnt == ESCAPE) return(ESCAPE); w = 0; for(i = 0; i < cnt; i++) { c = buff[i]-'0'; if (radix == 16) { if (buff[i] >= 'a') c = buff[i] - 'a' +10; else if (buff[i] >= 'A') c = buff[i] - 'A' + 10; else if (buff[i] > '9') break; } if (c > (radix-1) ) break; w = w*radix + c; } if (i == cnt) { switch (sNum) { case 1: *(char *)pNum = w; case 2: *(short *)pNum = w; case 4: default: *pNum = w; } return(0); } putchar(BELL); backspace(cnt); } } inflag() { char c, buff[4]; int cnt; for(;;) { printf (" \b\b"); cnt = input(buff, (int)4); if (cnt == 0) return( (int)FALSE ); if (cnt == ESCAPE) return(ESCAPE); c = buff[0] & 0x5f; if (c == 'N') return((int)FALSE); if (c == 'Y') return((int)TRUE); if (c == 'n') return((int)FALSE); if (c == 'y') return((int)TRUE); putchar(BELL); backspace(cnt); } } 0707070000020026361006440001460001440000010322650353443331100000700000034501README AAAATTTT&&&&TTTT IIIInnnnffffoooorrrrmmmmaaaattttiiiioooonnnn SSSSyyyysssstttteeeemmmmssss subject: The Diagnostic Disk date: August 27, 1985 Generator--Help for the IHVs from: M. E. Smith FJ 1F-101A 01311 x5804 _M_e_m_o_r_a_n_d_u_m__f_o_r__R_e_c_o_r_d 1. IIIINNNNTTTTRRRROOOODDDDUUUUCCCCTTTTIIIIOOOONNNN IHVs who develop hardware as an adjunct to the UNIX PC need to be able to provide diagnostic tests specific to their devices. It is desirable that these vendors be able to create these diagnostics with minimal effort. Furthermore, it is desirable that the diagnostics present a consistent interface with respect to the official diagnostic disk that is a member of the UNIX PC foundation set. This memo will describe the installation and use of a tool that allows vendors to create a customized diagnostic disk quickly while requiring that they only know the internals of their devices. The memo will also describe a set of interrupt handling routines and stdio routines provided by the generation environment to make it easier for users to write their hardware-specific diagnostic routines. 2. IIIINNNNSSSSTTTTAAAALLLLLLLLAAAATTTTIIIIOOOONNNN OOOOFFFF TTTTHHHHEEEE DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCC DDDDIIIISSSSKKKK GGGGEEEENNNNEEEERRRRAAAATTTTOOOORRRR A STORE user will automatically have the software installed upon request using the Install Software from THE STORE command. The command will put the source files and Makefile (see Section 5 below) in the empty directory. It will also create a subdirectory named "mkdiag." This directory will contain the diagnostic disk generator files. The user should change directory to mkdiag before proceeding to generate diagnostic disk source. AAAATTTT&&&&TTTT IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN SSSSYYYYSSSSTTTTEEEEMMMMSSSS ---- PPPPRRRROOOOPPPPRRRRIIIIEEEETTTTAAAARRRRYYYY No portion of this document shall be used or disclosed outside of AT&T-ISL without the authorization of the Director of the originating organization. - 2 - 3. TTTTHHHHEEEE DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCC DDDDIIIISSSSKKKK GGGGEEEENNNNEEEERRRRAAAATTTTOOOORRRR The diagnostic disk generator is invoked by typing the name diag The diagnostic disk generator first asks the user whether he/she wants to add, change, delete, review, make source code, or save. 3.1 AAAAdddddddd ccccoooommmmmmmmaaaannnndddd The generator prompts the user for the following: o+ A one-character identifier of the set of tests. This character should be a small number that will correspond to the index into the menu for this set of tests. o+ An entry in a menu associated with a particular set of tests. o+ A description used for help requests. o+ The list of tests, including the names of function calls that implement the tests. o+ The number of "subtests" within each test. At this point the generator creates an internal entry containing the data just entered. 3.2 CCCChhhhaaaannnnggggeeee////DDDDeeeelllleeeetttteeee ccccoooommmmmmmmaaaannnndddd In both cases the generator prompts the user for the one- character identifier of the set of tests. If "Delete" was requested, the generator deletes the entry from its internal buffer. If "Change" was requested, the user is allowed to re-enter data for this set of tests. 3.3 RRRReeeevvvviiiieeeewwww ccccoooommmmmmmmaaaannnndddd This command causes the generator to dump its internal buffer to the screen using some simple formatting so that the user may review what he/she has entered so far. AAAATTTT&&&&TTTT IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN SSSSYYYYSSSSTTTTEEEEMMMMSSSS ---- PPPPRRRROOOOPPPPRRRRIIIIEEEETTTTAAAARRRRYYYY No portion of this document shall be used or disclosed outside of AT&T-ISL without the authorization of the Director of the originating organization. - 3 - 3.4 MMMMaaaakkkkeeee SSSSoooouuuurrrrcccceeee ccccoooommmmmmmmaaaannnndddd This command instructs the generator to create source files from the contents of the generator's internal buffer. The result is two files, newmain.c and newmsg.c, that can be compiled (using the Makefile) into a diagnostic executable suitable for copying onto a disk (see below). 3.5 SSSSaaaavvvveeee ccccoooommmmmmmmaaaannnndddd The save command instructs the generator to write its internal buffer to disk. In this way a generation session can be restarted at a later date. 4. CCCCRRRREEEEAAAATTTTIIIINNNNGGGG TTTTHHHHEEEE SSSSPPPPEEEECCCCIIIIFFFFIIIICCCC FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS The user is responsible for creating source files that carry out the tests on his/her hardware. These functions may have one argument: the subtest number. A function may contain a switch on this number if the user wants that function to execute more than one test. Note that the generator creates subtests in the range 0 to n-1, where n is the number of subtests specified for this test. 5. CCCCRRRREEEEAAAATTTTIIIINNNNGGGG TTTTHHHHEEEE EEEEXXXXEEEECCCCUUUUTTTTAAAABBBBLLLLEEEE After the user has executed a "Make Source" command, the files newmain.c and newmsg.c are resident in the mkdiag directory. These files should be copied to the parent directory with the names main.c and msg.c; i.e. cp newmain.c ../main.c cp newmsg.c ../msg.c Also, the files that the user has created to carry out specific diagnostic tests on his/her hardware should be moved to mkdiag's parent directory. All the source files should then be compiled, preferably using the packaged Makefile (see make(1) in the UNIX System V User's Manual) with additions for the user's source files. (The Makefile included with the diagnostic disk source contains "hooks" for names of user-defined source and object files. Those user-defined file names should be substituted for those "hooks.") AAAATTTT&&&&TTTT IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN SSSSYYYYSSSSTTTTEEEEMMMMSSSS ---- PPPPRRRROOOOPPPPRRRRIIIIEEEETTTTAAAARRRRYYYY No portion of this document shall be used or disclosed outside of AT&T-ISL without the authorization of the Director of the originating organization. - 4 - After compilation, the executable should be copied (using "mount(7)" and "cp(1)") to a floppy disk. The executable (whose name is "s4diag" if the packaged Makefile is used) must be named "unix" or linked to an executable with that name in order for the boot rom to load the diagnostic disk code into memory at boot time. 6. TTTTHHHHEEEE SSSSTTTTAAAANNNNDDDDAAAARRRRDDDD EEEENNNNVVVVIIIIRRRROOOONNNNMMMMEEEENNNNTTTT Certain standard UNIX routines are provided with the source files that are compiled along with the user's hardware diagnostics. Thus the user can call these routines from his/her hardware specific diagnostic code in order to save development time. Synopses of these routines can be found in Appendix 2. 7. CCCCOOOONNNNCCCCLLLLUUUUSSSSIIIIOOOONNNN The diagnostic disk generator provides a simple way to create a diagnostic disk without knowing the internals of the diagnostic disk software. The resulting executable will NOT contain any of the official diagnostic disk tests; if the desire of the IHV is to integrate his/her tests with the official tests, the IHV will have to understand the inner workings of the diagnostic disk source (as briefly described in Appendix 1 below). FJ-1F-101A-MES-mes M. E. Smith AAAATTTT&&&&TTTT IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN SSSSYYYYSSSSTTTTEEEEMMMMSSSS ---- PPPPRRRROOOOPPPPRRRRIIIIEEEETTTTAAAARRRRYYYY No portion of this document shall be used or disclosed outside of AT&T-ISL without the authorization of the Director of the originating organization. - 5 - Appendix 1: Internal Design of the Official Diagnostic Disk Software There are five outstanding parts of the diagnostic disk software: 1. The menu entries, all of which are displayed when the diagnostic disk is executed. The entries are defined in the structures pHdUD1 and pHdUD2 in the source file msg.c. 2. For each menu entry, the set of tests executed. The set of tests is defined in the TestList structure in main.c. 3. For each set of tests, the names of functions that define the set. These function names are defined in the fn_array structure in main.c. 4. The code in each of those functions. The code is located in separate files; usually all the functions defining a test are located in the same source file. 5. For each function, a set of subtests. A subtest is a number which is passed as the argument to the testing function. A switch statement in the function interprets the argument and executes the associated subtest. Thus, when the diagnostic disk user requests an item from the menu, the software executes a list of (function, subtest) pairs. That list defines the test (actually, the set of tests) that the user requested. AAAATTTT&&&&TTTT IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN SSSSYYYYSSSSTTTTEEEEMMMMSSSS ---- PPPPRRRROOOOPPPPRRRRIIIIEEEETTTTAAAARRRRYYYY No portion of this document shall be used or disclosed outside of AT&T-ISL without the authorization of the Director of the originating organization. - 6 - Appendix 2: Standard Environment Interface A. Interrupt Handling Routines 1. spl0(), spl1(), spl2(), spl3(), spl4(), spl5(), spl6(), spl7(): These routines, which have no arguments, reset the hardware priority to zero through seven respectively. They return an integer indicating what the hardware priority was before the spl call. 2. splhi(): This routine is identical to spl6(). 3. splx(pri): This routine resets the priority to the integer pri. It returns the an integer indicating what the hardware priority was before the splx call. B. Standard IO Routines 1. getchar(): Return the next character read from the console. 2. inflag(): Read Y or N from the console and return TRUE or FALSE. 3. innum(pnum, snum, radix): Read a number from the console of size snum into an integer *pnum with the given radix. 4. input(pbuff, sbuff): Read sbuff characters from the console into the character buffer pbuff, or until EOL ('\r' or '\n') or ESC ('\033'). AAAATTTT&&&&TTTT IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN SSSSYYYYSSSSTTTTEEEEMMMMSSSS ---- PPPPRRRROOOOPPPPRRRRIIIIEEEETTTTAAAARRRRYYYY No portion of this document shall be used or disclosed outside of AT&T-ISL without the authorization of the Director of the originating organization. - 7 - 5. printf(ctl, arg0, arg1, ...): sprintf(buf, ctl, arg0, arg1, ...): These routines work as described in printf(3S) in the UNIX System V User's Manual except only the following escape control sequences are allowed. o+ %nd: Single precision signed decimal. o+ %nD: Double precision signed decimal. o+ %no: Single precision unsigned octal. o+ %n): Double precision unsigned octal. o+ %nx: Single precision unsigned hexadecimal. o+ %nX: Double precision unsigned hexadecimal. o+ %ns: String. o+ %c: Character. o+ %%: Percent. In the above, "n" can be an integer or "v," whence the field width comes from the argument list. 6. putchar(c): Print the given character on the console. AAAATTTT&&&&TTTT IIIINNNNFFFFOOOORRRRMMMMAAAATTTTIIIIOOOONNNN SSSSYYYYSSSSTTTTEEEEMMMMSSSS ---- PPPPRRRROOOOPPPPRRRRIIIIEEEETTTTAAAARRRRYYYY No portion of this document shall be used or disclosed outside of AT&T-ISL without the authorization of the Director of the originating organization. 0707070000020026371006660001460001440000010323050352172543200000700000012160kpic.h#define NW 29 /* normal width */ #define FW 36 /* function key width */ #define TW 42 /* tab and backspace */ #define RW 50 /* return and caps lck */ #define SW 65 /* shift width */ #define SPW (6*NW+5*IS) /* space width */ #define IS 2 /* inter-key spacing */ #define CS 5 /* inter-column */ #define FS 89 /* function keys */ #define ROW2S 476 /* row 2 */ #define ROW7S (SW+IS+NI) /* row 7 */ #define NI (NW+IS) #define C0 30 /* column 0 */ #define C1 C0 #define C2 (C1+2*NI+CS) #define C3 (C2+ROW2S+CS) #define FI (FW+IS) #define F1 C2 #define F2 (F1+3*FI+FS) #define F3 (F2+FI+FW+FS) #define R0 20 /* row 0 address */ #define NH 26 #define HI (NH+2) #define R1 (R0+0*HI) #define R2 (R0+1*HI) #define R3 (R0+2*HI) #define R4 (R0+3*HI) #define R5 (R0+4*HI) #define R6 (R0+5*HI) #define R7 (R0+6*HI) #define ROWQ(p,s) C2+TW+IS+p*NI,R4,NW,NH,s,0 #define ROWA(p,s) C2+RW+IS+p*NI,R5,NW,NH,s,0 #define ROWZ(p,s) C2+SW+IS+p*NI,R6,NW,NH,s,0 #define BAD 0,0,0,0,0,0 struct kvdef { short kv_x, kv_y; short kv_w, kv_h; char *kv_name1, *kv_name2; } kvid[128] = { /* 0 ILLEGAL */ BAD, /* 1 UP */ C3+NI,R6,NW,NH,"UP",0, /* 2 CLR LIN */ C1,R1,NW,NH,"CLR","LIN", /* 3 RST REF */ C1+NI,R1,NW,NH,"RST","REF", /* 4 EXT */ C3,R1,NW,NH,"EXT",0, /* 5 PRV */ C3,R6,NW,NH,"PRV",0, /* 6 MSG */ C3+NI,R1,NW,NH,"MSG",0, /* 7 CAN */ C3+2*NI,R3,NW,NH,"CAN",0, /* 8 BACK SPC */ C2+13*NI,R3,TW,NH,"BSP",0, /* 9 TAB> . */ C2+SW+IS+8*NI,R6,NW,NH,">",".", /* 2F ? / */ C2+SW+IS+9*NI,R6,NW,NH,"?","/", /* 30 ) 0 */ C2+10*NI,R3,NW,NH,")","0", /* 31 ! 1 */ C2+1*NI,R3,NW,NH,"!","1", /* 32 @ 2 */ C2+2*NI,R3,NW,NH,"@","2", /* 33 # 3 */ C2+3*NI,R3,NW,NH,"#","3", /* 34 $ 4 */ C2+4*NI,R3,NW,NH,"$","4", /* 35 % 5 */ C2+5*NI,R3,NW,NH,"%","5", /* 36 ^ 6 */ C2+6*NI,R3,NW,NH,"^","6", /* 37 & 7 */ C2+7*NI,R3,NW,NH,"&","7", /* 38 * 8 */ C2+8*NI,R3,NW,NH,"*","8", /* 39 ( 9 */ C2+9*NI,R3,NW,NH,"(","9", /* 3A */ BAD, /* 3B : ; */ C2+RW+IS+9*NI,R5,NW,NH,":",";", /* 3C */ BAD, /* 3D + = */ C2+12*NI,R3,NW,NH,"+","=", /* 3E */ BAD, /* 3F */ BAD, /* 40 */ BAD, /* 41 CMD */ C3,R3,NW,NH,"CMD",0, /* 42 CLS OPN */ C3+NI,R3,NW,NH,"CLS","OPN", /* 43 PRI NT */ C3,R4,NW,NH,"PNT",0, /* 44 CLR RFH */ C3+NI,R4,NW,NH,"CLR","RFH", /* 45 CAP LCK */ C2,R5,RW,NH,"CAPS","LOCK", /* 46 PAG */ C3+2*NI,R4,NW,NH,"PAG",0, /* 47 BEG */ C3,R5,NW,NH,"BEG",0, /* 48 */ C2+SW+IS+10*NI,R6,SW,NH,"SHIFT",0, /* 4A HOM */ C3+NI,R5,NW,NH,"HOM",0, /* 4B END */ C3+2*NI,R5,NW,NH,"END",0, /* 4C */ C2+ROW7S+NI+SPW+IS,R7,NW,NH,"CTL",0, /* 4E */ BAD, /* 4F */ BAD, /* 50 */ BAD, /* 51 */ BAD, /* 52 */ BAD, /* 53 */ BAD, /* 54 */ BAD, /* 55 */ BAD, /* 56 */ BAD, /* 57 */ BAD, /* 58 */ BAD, /* 59 */ BAD, /* 5A */ BAD, /* 5B { [ */ C2+TW+IS+10*NI,R4,NW,NH,"{","[", /* 5C | \ */ C2+TW+IS+12*NI,R4,NW,NH,"|","\\", /* 5D } ] */ C2+TW+IS+11*NI,R4,NW,NH,"}","]", /* 5E */ BAD, /* 5F */ BAD, /* 60 ~ ` */ C2+TW+IS+13*NI,R4,NW,NH,"~","`", /* 61 A */ ROWA(0,"A"), /* 62 B */ ROWZ(4,"B"), /* 63 C */ ROWZ(2,"C"), /* 64 D */ ROWA(2,"D"), /* 65 E */ ROWQ(2,"E"), /* 66 F */ ROWA(3,"F"), /* 67 G */ ROWA(4,"G"), /* 68 H */ ROWA(5,"H"), /* 69 I */ ROWQ(7,"I"), /* 6A J */ ROWA(6,"J"), /* 6B K */ ROWA(7,"K"), /* 6C L */ ROWA(8,"L"), /* 6D M */ ROWZ(6,"M"), /* 6E N */ ROWZ(5,"N"), /* 6F O */ ROWQ(8,"O"), /* 70 P */ ROWQ(9,"P"), /* 71 Q */ ROWQ(0,"Q"), /* 72 R */ ROWQ(3,"R"), /* 73 S */ ROWA(1,"S"), /* 74 T */ ROWQ(4,"T"), /* 75 U */ ROWQ(6,"U"), /* 76 V */ ROWZ(3,"V"), /* 77 W */ ROWQ(1,"W"), /* 78 X */ ROWZ(1,"X"), /* 79 Y */ ROWQ(5,"Y"), /* 7A Z */ ROWZ(0,"Z"), /* 7B */ BAD, /* 7C */ BAD, /* 7D */ BAD, /* 7E NUM LCK */ C2+2*ROW7S+2*NI+SPW,R7,NW,NH,"NUM","LCK", /* 7F DEL ETE */ C1,R6,NW,NH,"DEL",0, }; 0707070000020026421006660001460001440000010323130352172543300000500000001561lp.c/* Convergent Technologies - System V - Oct 1984 */ #include "diag.h" #include "sys/hardware.h" #include "sys/iohw.h" /* Test to drive the parallel line printer. ------------------------------------------------------------------------------ | This test has two subtests. The first checks the Line Printer | | register when it is in an idle state to be sure the correct | | combination of bits is set. This subtest reports what it | | believes to be the printer status to the user. | | | | The second subtest prints a page of rotating pattern preceded | | by a form feed. It checks to make sure that the status | | is correct after each interrupt. | ------------------------------------------------------------------------------ */ unsigned char fLPTest = 0; unsigned char LPFint = 0; int LPCount; ushort LPChar; 0707070000020026431006660001460001440000010323140352172543600001000000001125main1.s/* Convergent Technologies - System V - Jul 1983 "@(&)main1.s 1.1" */ #include "sys/hardware.m" set GCR_INIT,0x1000 # disable ROM text global main,main1,_end,GCR_save /* Program must be linked above the vector table. ent must be at the first location and contain a jump to main1. So that it will be copied to zero before calling main. Hence when written to disk there will be jump to main1 at location 0. */ ent: jmp main1 main1: mov.w &ROM_DISABLE, ROM_GCR_ADDR mov.l &_end+0x300, %a0 mov.l %a0,%usp mov.l &_end+0x900, %a0 mov.l %a0,%sp mov.l ent, 0 mov.l ent+4, 4 jsr main 0707070000020026451006660001460001440000010323150352172543700000700000021460math.s #J. Test 1/81 #signed long multiply: c = a * b # PCC1 entry point global lmul # PCC2 entry point global lmul__ text lmul__: link %a6,&0 movm.l &0x3800,-(%sp) #save %d2,%d3,d4 clr.l %d4 #sign of result mov.l %d0,%d2 #d2=a bge.b MM0 neg.l %d2 not.l %d4 MM0: mov.l 8(%a6),%d3 #d3=b bge.b ML2 neg.l %d3 not.l %d4 bra.b ML2 lmul: link %a6,&0 movm.l &0x3800,-(%sp) #save %d2,%d3,d4 clr.l %d4 #sign of result mov.l 8(%a6),%d2 #d2=a bge.b MM1 neg.l %d2 not.l %d4 MM1: mov.l 12(%a6),%d3 #d3=b bge.b MM2 neg.l %d3 not.l %d4 MM2: ML2: clr.l %d0 mov.w %d2,%d0 #d0=alo, unsigned mulu.w %d3,%d0 #d0=blo*alo, unsigned mov.w %d2,%d1 #d1=alo swap.w %d2 #swap alo-ahi mulu.w %d3,%d2 #d2=blo*ahi, unsigned swap.w %d3 #swap blo-bhi mulu.w %d3,%d1 #d1=bhi*alo, unsigned add.l %d2,%d1 #d1=(ahi*blo + alo*bhi) swap.w %d1 #d1= clr.w %d1 # (ahi*blo + alo*bhi)*(2**16) add.l %d1,%d0 #d0=alo*blo + (ahi*blo + alo*bhi)*(2**16) tst.l %d4 #sign of result bge.b MM3 neg.l %d0 MM3: movm.l (%sp)+,&0x1C #restore %d2,%d3,d4 unlk %a6 rts #J. Gula #J. Test 1/81 #signed long division: quotient = dividend / divisor # PCC1 entry point global ldiv # PCC2 entry point global ldiv__ text ldiv__: link %a6,&0 movm.l &0x3C00,-(%sp) #need %d2,%d3,d4,d5 registers mov.l &1,%d5 #sign of result tst.l %d0 #dividend bge.b KK100 neg.l %d0 neg.l %d5 KK100: mov.l %d0,%d3 #save positive dividend mov.l 8(%a6),%d1 #divisor bge.b KL2 neg.l %d1 neg.l %d5 bra.b KL2 ldiv: link %a6,&0 movm.l &0x3C00,-(%sp) #need %d2,%d3,d4,d5 registers mov.l &1,%d5 #sign of result mov.l 8(%a6),%d0 #dividend bge.b KK1 neg.l %d0 neg.l %d5 KK1: mov.l %d0,%d3 #save positive dividend mov.l 12(%a6),%d1 #divisor bge.b KL2 neg.l %d1 neg.l %d5 KL2: mov.l %d1,%d4 #save positive divisor cmp.l %d1,&0x10000 #divisor >= 2 ** 16? bge.b KK3 #yes, divisor must be < 2 ** 16 clr.w %d0 #divide dividend swap.w %d0 # by 2 ** 16 divu.w %d1,%d0 #get the high order bits of quotient mov.w %d0,%d2 #save quotient high mov.w %d3,%d0 #dividend low + remainder * (2**16) divu.w %d1,%d0 #get quotient low swap.w %d0 #temporarily save quotient low in high mov.w %d2,%d0 #restore quotient high to low part of register swap.w %d0 #put things right bra.b KK5 #return KK3: asr.l &0x1,%d0 #shift dividend asr.l &0x1,%d1 #shift divisor # and.l &0x7FFFFFFF,%d0 #insure positive # and.l &0x7FFFFFFF,%d0 # sign bit cmp.l %d1,&0x10000 #divisor < 2 ** 16? bge.b KK3 #no, continue shift divu.w %d1,%d0 #yes, divide, remainder is garbage and.l &0xFFFF,%d0 #get rid of remainder mov.l %d0,%d2 #save quotient mov.l %d0,-(%sp) #call ulmul with quotient mov.l %d4,-(%sp) # and saved divisor on stack jsr ulmul # as arguments add.l &0x8,%sp #restore sp cmp.l %d3,%d0 #original dividend >= lmul result? bge.b KK4 #yes, quotient should be correct sub.l &1,%d2 #no, fix up quotient KK4: mov.l %d2,%d0 #move quotient to d0 KK5: tst.l %d5 #sign of result bge.b KK6 neg.l %d0 KK6: movm.l (%sp)+,&0x3C #restore registers unlk %a6 rts #J. Test 1/81 #unsigned long division: dividend=dividend / divisor # PCC1 entry point global uldiv # PCC2 entry point global uldiv__ text uldiv__: link %a6,&0 movm.l &0x3800,-(%sp) #need %d2,%d3,d4 registers #dividend is already in %d0 mov.l %d0,%d3 #save dividend mov.l 8(%a6),%d1 #divisor mov.l %d1,%d4 #save divisor bra.b SL1 uldiv: link %a6,&0 movm.l &0x3800,-(%sp) #need %d2,%d3,d4 registers mov.l 8(%a6),%d0 #dividend mov.l %d0,%d3 #save dividend mov.l 12(%a6),%d1 #divisor mov.l %d1,%d4 #save divisor SL1: cmp.l %d1,&0x10000 #divisor >= 2 ** 16? bge.b SS1 #yes, divisor must be < 2 ** 16 swap.w %d0 #divide dividend and.l &0xFFFF,%d0 # by 2 ** 16 divu.w %d1,%d0 #get the high order bits of quotient mov.w %d0,%d2 #save quotient high mov.w %d3,%d0 #dividend low + remainder * (2**16) divu.w %d1,%d0 #get quotient low swap.w %d0 #temporarily save quotient low in high mov.w %d2,%d0 #restore quotient high to low part of register swap.w %d0 #put things right bra.b SS3 #return SS1: asr.l &0x1,%d0 #shift dividend asr.l &0x1,%d1 #shift divisor bclr &31,%d0 #assure positive bclr &31,%d1 # sign bit # and.l &0x7FFFFFFF,%d0 #assure positive # and.l &0x7FFFFFFF,%d1 # sign bit cmp.l %d1,&0x10000 #divisor < 2 ** 16? bge.b SS1 #no, continue shift divu.w %d1,%d0 #yes, divide, remainder is garbage and.l &0xFFFF,%d0 #get rid of remainder mov.l %d0,%d2 #save quotient mov.l %d0,-(%sp) #call ulmul with quotient mov.l %d4,-(%sp) # and saved divisor on stack jsr ulmul # as arguments add.l &0x8,%sp #restore sp cmp.l %d3,%d0 #original dividend >= lmul result? bge.b SS2 #yes, quotient should be correct sub.l &1,%d2 #no, fix up quotient SS2: mov.l %d2,%d0 #move quotient to d0 SS3: movm.l (%sp)+,&0x1C #restore registers unlk %a6 rts #J. Test 1/81 #unsigned long multiply: c = a * b global ulmul text ulmul: link %a6,&0 movm.l &0x3000,-(%sp) #save %d2,%d3 mov.l 8(%a6),%d2 #d2=a mov.l 12(%a6),%d3 #d3=b clr.l %d0 mov.w %d2,%d0 #d0=alo, unsigned mulu.w %d3,%d0 #d0=blo*alo, unsigned mov.w %d2,%d1 #d1=alo swap.w %d2 #swap alo-ahi mulu.w %d3,%d2 #d2=blo*ahi, unsigned swap.w %d3 #swap blo-bhi mulu.w %d3,%d1 #d1=bhi*alo, unsigned add.l %d2,%d1 #d1=(ahi*blo + alo*bhi) swap.w %d1 #d1= clr.w %d1 # (ahi*blo + alo*bhi)*(2**16) add.l %d1,%d0 #d0=alo*blo + (ahi*blo + alo*bhi)*(2**16) movm.l (%sp)+,&0xC #restore %d2,%d3 unlk %a6 rts #signed long remainder: a = a % b # PCC1 entry point global lrem # PCC2 entry point global lrem__ text lrem__: link %a6,&0 movm.l &0x3800,-(%sp) #need %d2,%d3,d4 registers clr.l %d4 #sign of result tst.l %d0 #dividend bge.b OO0 neg.l %d0 not.l %d4 OO0: mov.l %d0,%d2 #save positive dividend mov.l 8(%a6),%d1 #divisor bge.b OL2 neg.l %d1 bra.b OL2 lrem: link %a6,&0 movm.l &0x3800,-(%sp) #need %d2,%d3,d4 registers clr.l %d4 #sign of result mov.l 8(%a6),%d0 #dividend bge.b OO1 neg.l %d0 not.l %d4 OO1: mov.l %d0,%d2 #save positive dividend mov.l 12(%a6),%d1 #divisor bge.b OO2 not.l %d1 OO2: OL2: cmp.l %d1,&0x10000 #divisor < 2 ** 16? bge.b OO3 #no, divisor must be < 2 ** 16 clr.w %d0 #d0= swap.w %d0 # dividend high divu.w %d1,%d0 #yes, divide mov.w %d2,%d0 #d0=remainder high + quotient low divu.w %d1,%d0 #divide clr.w %d0 #d0= swap.w %d0 # remainder bra.b OO6 #return OO3: mov.l %d1,%d3 #save divisor OO4: asr.l &0x1,%d0 #shift dividend asr.l &0x1,%d1 #shift divisor # and.l &0x7FFFFFFF,%d0 #assure positive # and.l &0x7FFFFFFF,%d1 # sign bit cmp.l %d1,&0x10000 #divisor < 2 ** 16? bge.b OO4 #no, continue shift divu.w %d1,%d0 #yes, divide and.l &0xFFFF,%d0 #erase remainder mov.l %d0,-(%sp) #call ulmul with quotient mov.l %d3,-(%sp) # and saved divisor on stack jsr ulmul # as arguments add.l &0x8,%sp #restore sp cmp.l %d2,%d0 #original dividend >= lmul result? bge.b OO5 #yes, quotient should be correct sub.l %d3,%d0 #no, fixup OO5: sub.l %d2,%d0 #calculate neg.l %d0 # remainder OO6: tst.l %d4 #sign of result bge.b OO7 neg.l %d0 OO7: movm.l (%sp)+,&0x1C #restore registers unlk %a6 rts #J. Test 1/81 #unsigned long remainder: a = a % b # PCC1 entry point global ulrem # Pcc2 entry point global ulrem__ text ulrem__: link %a6,&0 mov.l %d2,-(%sp) #save d2&d3 on stack mov.l %d3,-(%sp) #use explicit pushes which #are slightly faster than moveml #dividend already in %d0 mov.l %d0,%d2 #save dividend mov.l 8(%a6),%d1 #divisor bra.b TL1 ulrem: link %a6,&0 mov.l %d2,-(%sp) #save d2&d3 on stack mov.l %d3,-(%sp) #use explicit pushes which #are slightly faster than moveml mov.l 8(%a6),%d0 #dividend mov.l %d0,%d2 #save dividend mov.l 12(%a6),%d1 #divisor TL1: cmp.l %d1,&0x10000 #divisor < 2 ** 16? bge.b TT1 #no, divisor must be < 2 ** 16 clr.w %d0 #d0= swap.w %d0 # dividend high divu.w %d1,%d0 #yes, divide mov.w %d2,%d0 #d0=remainder high + quotient low divu.w %d1,%d0 #divide clr.w %d0 #d0= swap.w %d0 # remainder bra.b TT4 #return TT1: mov.l %d1,%d3 #save divisor TT2: asr.l &0x1,%d0 #shift dividend asr.l &0x1,%d1 #shift divisor bclr &31,%d0 #assure positive bclr &31,%d1 # sign bits # and.l &0x7FFFFFFF,%d0 #assure positive # and.l &0x7FFFFFFF,%d1 # sign bit cmp.l %d1,&0x10000 #divisor < 2 ** 16? bge.b TT2 #no, continue shift divu.w %d1,%d0 #yes, divide and.l &0xFFFF,%d0 #erase remainder mov.l %d0,-(%sp) #call ulmul with quotient mov.l %d3,-(%sp) # and saved divisor on stack jsr ulmul # as arguments add.l &0x8,%sp #restore sp cmp.l %d2,%d0 #original dividend >= lmul result? bge.b TT3 #yes, quotient should be correct sub.l %d3,%d0 #no, fixup TT3: sub.l %d2,%d0 #calculate neg.l %d0 # remainder TT4: mov.l (%sp)+,%d3 #restore registers mov.l (%sp)+,%d2 unlk %a6 rts 0707070000020026461006660001460001440000010323260352172544000000600000017570mch.s/* # Convergent Technologies - System V - Jun 1983 # "@(&)mch.s 1.1" # # */ #include "sys/iohw.m" set HIGH,0x2700 #high priority supervisor mode (spl 7) set LOW,0x2000 #low priority, supervisor mode (spl 0) /* # prototype dispatch table entry, this is copied to each word in dispatch */ text global proto,prindex proto: jsr fault prindex: short 0 global rte rte: rte /* # 68000 trap and fault entry, called like: # # jsr fault |leaves ptr to following word on stack # short n |n will be vector number # # 68010 sends all vectors (not explicitly sent elsewhere) # directly to this fault routine. The above interceding jsr # isn't needed since the 68010 leaves the vector offset on the # stack. # # The stacks for a 68000/010 (high addresses to the top) with offsets # from the stack pointer prior to the trap(type) call are: # 68000 68010 # ----- ----- # # sp(74) PC.low # sp(72) PC.high format/vector # sp(70) SR PC.low # sp(68) ptr.low PC.high | `ptr' left by interceding jsr # sp(66) ptr.high SR # sp(64) 0000 0000 | allignment # sp(62) A7.low A7.low | First k%sp, munged to usp # ... ... ... # sp(00) D0.high D0.high */ global fault,trap fault: clr.w -(%sp) #makes SR long alligned movm.l &0xFFFF,-(%sp) #save all registers mov.l %usp,%a0 mov.l %a0,60(%sp) #save usr stack ptr mov.w 72(%sp),%d0 #obtain 68010 vector offset lsr.l &2,%d0 #convert vector offset to vector number and.l &255,%d0 #mask off format stuff XX1: mov.l %d0,-(%sp) #argument to trap jsr trap #C handler for traps and faults add.l &4,%sp global trapend, returnfromint trapend: returnfromint: XX2: mov.l 60(%sp),%a0 mov.l %a0,%usp #restore usr stack ptr movm.l (%sp)+,&0x7FFF #restore all other registers add.l &6,%sp #pop %usp, allignment word rte /* global IntFDHDDMA, FDHDDMA IntFDHDDMA: clr.w -(%sp) #makes SR long alligned movm.l &0xFFFF,-(%sp) #save all registers mov.l %usp,%a0 mov.l %a0,60(%sp) #save usr stack ptr mov.w 72(%sp),%d0 #obtain 68010 vector offset lsr.l &2,%d0 #convert vector offset to vector number and.l &255,%d0 #mask off format stuff mov.l %d0,-(%sp) #argument to trap jsr FDHDDMA #C handler for floppy, hard disk, and DMA #interrupts add.l &4,%sp mov.l 60(%sp),%a0 mov.l %a0,%usp #restore usr stack ptr movm.l (%sp)+,&0x7FFF #restore all other registers add.l &6,%sp #pop %usp, allignment word rte */ global Int, IntLevel Int: clr.w -(%sp) #makes SR long alligned movm.l &0xFFFF,-(%sp) #save all registers mov.l %usp,%a0 mov.l %a0,60(%sp) #save usr stack ptr mov.w 72(%sp),%d0 #obtain 68010 vector offset lsr.l &2,%d0 #convert vector offset to vector number and.l &255,%d0 #mask off format stuff mov.l %d0,-(%sp) #argument to trap jsr IntLevel #C handler for level interrupt autovector add.l &4,%sp mov.l 60(%sp),%a0 mov.l %a0,%usp #restore usr stack ptr movm.l (%sp)+,&0x7FFF #restore all other registers add.l &6,%sp #pop %usp, allignment word rte /* #Bus error entry, this has its stack somewhat different. We will #call a C routine to save the info then fix the stack to look like a trap. #These entries will be called directly from interrupt vector. */ /* global buserr,busaddr buserr: movm.l &0xC0C0,-(%sp) #save registers that C clobbers jsr busaddr #save the info for a bus or address error movm.l (%sp)+,&0x303 #restore registers add.l &8,%sp #pop fcode, aaddr and ireg jsr fault short 2 global addrerr addrerr: movm.l &0xC0C0,-(%sp) #save registers that C clobbers jsr busaddr #save the info for a bus or address error movm.l (%sp)+,&0x303 #restore registers add.l &8,%sp #pop fcode, aaddr and ireg jsr fault short 3 global nmiint nmiint: jsr fault short 31 global fclkint fclkint: jsr fault short 92 global sclkint sclkint: jsr fault short 30 */ # switch to user mode /* global UserMode UserMode: mov.l %sp, tminMem mov.l %a6, tminMem+4 and.w &0xdfff, %sr or.w %d0, %d0 trap &0 rts */ global tminMem global RetrvStk RetrvStk: mov.l tminMem, %a0 mov.l (%a0)+, %sp mov.l (%a0), %a6 rts # switch to supervisor mode /* global SupMode SupMode: trap &0 mov.l %usp, %a0 mov.l (%a0), %d0 mov.l %d0, (%sp) rts global trap0 trap0: or.w &0x2000, (%sp) rte */ global trap14 trap14: or.w &0x700,%sr # disable all interrupt trap &14 rts global stop stop: stop &0x2000 rts /* #ifdef EALIER # Routine to abort the bus error caused by the user i/o test. # The stack must be abandoned since the 68010 will restart the # the instruction and cause the bus error once again. # So the first action after the JSR to get into the User I/O test # is to save the current stack pointer and frame pointer in 0x100100 and # 0x100104. This routine restores them and does an RTS to get back. global abandonuio abandonuio: mov.l 0x100100, %sp mov.l 0x100104, %a6 rts #return to user i/o test. # This routine does the same as the above only for the page # protection tests. Only the addresses are different. global abandprot abandprot: mov.l 0x103100, %sp mov.l 0x103104, %a6 rts #return to page protection test. # Save the stack pointer and frame pointer so that we can back out # of an unfixable situation. global savesp savesp: mov.l %sp, 0x103100 mov.l %a6, 0x103104 rts #endif */ /* #****************************************************************************** # I6850 interrupt routine for keyboard and mouse. # #****************************************************************************** */ /* global Int6850 Int6850: #----------------------------------------------------------------- # This is the interrupt handler for the keyboard. | #----------------------------------------------------------------- clr.w -(%sp) # makes SR long aligned movm.l &0xFFFF, -(%sp) # save all registers mov.w C_DATA_ADDR, %d1 # get the character asr.w &8, %d1 # move byte to lower byte mov.l %d1,-(%a7) # klow(d1) jsr klow add.l &4,%a7 XX4: bra returnfromint # */ global splhi,spl7,spl6,spl5,spl4,spl3,spl2,spl1,spl0,splx spl7: mov.w %sr,%d0 # save previous sr for return value or.w &0x0700,%sr # interrupt mask level 7 rts # returns with old sr in %d0 splhi: #same as splr6 spl6: mov.w %sr,%d0 # save previous sr for return value or.w &0x0700,%sr # up to level 7 and.w &0xFEFF,%sr # then down to level 6 rts # returns with old sr in %d0 spl5: mov.w %sr,%d0 # save previous sr for return value or.w &0x0700,%sr # up to level 7 and.w &0xFDFF,%sr # then down to level 5 rts # returns with old sr in %d0 spl4: mov.w %sr,%d0 # save previous sr for return value or.w &0x0700,%sr # up to level 7 and.w &0xFCFF,%sr # then down to level 4 rts # returns with old sr in %d0 spl3: mov.w %sr,%d0 # save previous sr for return value or.w &0x0700,%sr # up to level 7 and.w &0xFBFF,%sr # then down to level 3 rts # returns with old sr in %d0 spl2: mov.w %sr,%d0 # save previous sr for return value or.w &0x0700,%sr # up to level 7 and.w &0xFAFF,%sr # then down to level 2 rts # returns with old sr in %d0 spl1: mov.w %sr,%d0 # save previous sr for return value or.w &0x0700,%sr # up to level 7 and.w &0xF9FF,%sr # then down to level 1 rts # returns with old sr in %d0 spl0: mov.w %sr,%d0 # save previous sr for return value and.w &0xF8FF,%sr # down to level 0 rts # returns with old sr in %d0 splx: mov.l 4(%sp),%d0 # new level (sr, really) passed as arg to splx and.w &0x0700,%d0 # suppress everything but level (too cautious?) mov.w %sr,%d1 # get current sr, containing level # The adjusting of the level bits in the # sr is done in a copy of sr, so that we # don't momentarily lower the spl.b to 0 # while going to or from 4 or 7. # (Also we can only "or" immediates into sr, # variables must be "mov"'d into sr.) and.w &0xF8FF,%d1 # turn off old level bits or.w %d0,%d1 # turn on new level bits mov.w %sr,%d0 # save previous sr for return value mov.w %d1,%sr # put new level back into sr rts # returns with old sr in %d0 0707070000020026521006660001460001440000010323360352172544100000600000002317mem.c/* Convergent Technologies - System V - Jul 1983 */ /*static char mem_c[] = "@(#)mem.c 1.1";*/ /* ------------------------------------------------------------------------------ | Memory diagnostics | | | | When the program is loaded, the MMU has been initialized to | | unity map for context 0. | | Diagnostics finds end of memory and does the following tests: | | (They are performed in memory between the end of program | | and the end of memory.) | ------------------------------------------------------------------------------ */ #include "diag.h" #include #include #define MEMORY_SUBTESTS 2 BOOLEAN noMMem(); extern long tmaxMem, tminMem; SizeMemory() { if ( !noMMem( 0x80000 ) ) { tmaxMem= 0xfffff; if ( !noMMem( 0x100000 ) ) { tmaxMem = 0x17ffff; if( !noMMem( 0x180000 ) ) tmaxMem = 0x1fffff; } } else tmaxMem = 0x7ffff; } BOOLEAN noMMem( addr_start ) int addr_start; { ushort *i,*j; for ( i=(ushort *)addr_start,j=(ushort *)0x0; i<(ushort *)(addr_start+0xff) ; i++,j++ ) /* test in incr of word */ { if ( *i != *j ) { return( FALSE ); } } return( TRUE ); } 0707070000020026531006660001460001440000010323400352172544100001000000003247modem.c/* ----------------------------------------------------------------- | Modem diagnostics 2/2/84 C. Liu | | | ----------------------------------------------------------------- */ #include "sys/target.h" #include "sys/types.h" #include "diag.h" #include "sys/modem.h" #include "sys/i8274.h" #include "sys/termio.h" #include "sys/tty.h" #include "sys/iohw.h" #include "sys/hardware.h" #include "sys/dialer.h" #define TRUE 0xff #define FALSE 0x00 extern Pause(); char *pModemTest = "\nMODEM TEST( Self-test & Transfer test )\n"; char *pTestFailMsg = "\t\tSELF TEST failure detected. \n"; char *p300B212Msg = "\tSELF TEST (B212 mode) at 300 baud . . "; char *p1200B212Msg = "\tSELF TEST (B212 mode) at 1200 baud . . "; char *p300dataMsg = "\tDATA TRANSFER TEST (B212 mode) at 300 baud . . "; char *p1200dataMsg = "\tDATA TRANSFER TEST (B212 mode) at 1200 baud . . "; char *pParErrMsg = "MODEM TRANSFER TEST, receive error - parity error, expected : "; char *pOverrunMsg= "MODEM TRANSFER TEST, receive error - overrun error, expected : "; char *pFramingMsg= "MODEM TRANSFER TEST, receive error - framing error, expected : "; char *pRxErrMsg = "MODEM TRANSFER TEST, receive error - parity and framing error, expected : "; char fError; ResetModem() /* --------------------------------------------------------- | Procedure resets the modem, leaving it in the B212 | | mode at 300 baud. | --------------------------------------------------------- */ { /**DIALER_ADDR = 0;*/ *L1MD_GCR_ADDR = L1MD_DISCONNECT; *L2MD_GCR_ADDR = L2MD_DISCONNECT; *SCM_0W_Control = SCM_PowerReset_Wr0; Pause(100); *SCM_0W_Control = SCM_ResetDone_Wr0; Pause(10); } 0707070000020026541006660001460001440000010323420352172544200001000000006466mouse.c#include "sys/wd.h" #include "sys/mouse.h" unsigned short tkrast[] = { 0x0003,0, 0x0006,0, 0x001e,0, 0x007c,0, 0x00f8,0, 0x03f8,0, 0x0ff0,0, 0x1ff0,0, 0x7fe0,0, 0xffe0,0, 0x3fc0,0, 0x3fc0,0, 0x3f80,0, 0x7f00,0, 0xe300,0, 0xc200,0x0001, 0x8000,0x0003, 0,0x0007, 0,0x000e, 0,0x001c, 0,0x0038, 0,0x0070, 0,0x00e0, }; #define TKWID 32 /* Track width (pixels) */ #define TKHGT 23 /* Track height */ #define TKBYTES (((TKWID+15)/16)*2) /* number of bytes */ #define BRWID 2 #define BRHGT 2 #define BUTWID 28 #define BUTHGT 40 #define BUTSPACE 5 #define BUTY (VIDHEIGHT-BUTHGT-5) #define BUTLX 0 #define BUTMX (BUTLX+BUTWID+BUTSPACE) #define BUTRX (BUTMX+BUTWID+BUTSPACE) short lastmx,lastmy; unsigned char mstate = 0; short mx,my; short mxscale=MXSCALE, myscale=MYSCALE; unsigned char mdata[3]; unsigned char lastbut = 0; extern unsigned short *syspat[]; extern char msdiag,kbdiag,kbdone; /****************************************************************************** MSCAN(c) - process a mouse byte The mouse bytes come as 3 byte packets: 7 6 5 4 3 2 1 0 Byte 1: 0 0 0 SX SY L M R Byte 2: 0 X6 X5 X4 X3 X2 X1 X0 Byte 3: 1 Y6 Y5 Y4 Y3 Y2 Y1 Y0 Where SX = sign of X data (0 = -x, 1 = +x) SY = sign of Y data (0 = -y, 1 = +y) L,M,R = state of buttons (left, middle, right) Xn, Yn = mouse delta ******************************************************************************/ int mscan(c) unsigned char c; { short dx, dy; if ( !msdiag ) return(1); if ( mstate < 2 ) { if ( c & 0x80 ) { mstate = 0; return(1); } mdata[mstate++] = c; return(1); } mstate = 0; dy = (c & 0x7F)/myscale; dx = (mdata[1])/mxscale; c = mdata[0]; if ( !(c & MSX) ) dx = -dx; if ( !(c & MSY) ) dy = -dy; mx += dx; my -= dy; if ( mx < 0 ) mx = 0; if ( mx > VIDWIDTH-1) mx = VIDWIDTH-1; if ( my < 0 ) my = 0; if ( my > VIDHEIGHT-1) my = VIDHEIGHT-1; return(mouse(c & MBUTALL )); } int mouse(but) unsigned char but; { if ( !kbdiag && msdiag && (but == MBUTALL) ) { kbdone = 1; msdiag = 0; return(0); } if ( but != lastbut ) { register unsigned char xor = but ^ lastbut; if ( xor & MBUTL ) xorbut( BUTLX,2 ); if ( xor & MBUTM ) xorbut( BUTMX,2 ); if ( xor & MBUTR ) xorbut( BUTRX,2 ); lastbut = but; #ifdef PRINTSCR if ( !kbdiag && (xor == (MBUTL|MBUTR))) lpdump(); #endif } xortrack(lastmx,lastmy); xortrack(lastmx=mx, lastmy=my); return(1); } xortrack(x,y) register short x,y; { register int w = TKWID, h = TKHGT; if ( x+w >= VIDWIDTH ) w = VIDWIDTH-x; if ( y+h >= VIDHEIGHT ) h = VIDHEIGHT-y; rastop(tkrast,TKBYTES,VIDMEM,VIDBYTES, 0,0, x,y, w,h, SRCSRC, DSTXOR, 0); w = BRWID; h = BRHGT; if ( x+w >= VIDWIDTH ) w = VIDWIDTH-x; if ( y+h >= VIDHEIGHT ) h = VIDHEIGHT-y; if ( (!kbdiag) && lastbut ) switch ( lastbut ) { case MBUTL: rastop(VIDMEM,VIDBYTES,VIDMEM,VIDBYTES, 0,0, x,y, w,h, SRCPAT, DSTSRC, syspat[PATWHITE] ); break; case MBUTM: rastop(VIDMEM,VIDBYTES,VIDMEM,VIDBYTES, 0,0, x,y, w,h, SRCPAT, DSTSRC, syspat[PATBLACK] ); break; } } xorbut(x,marg) register short x; int marg; { rastop(VIDMEM,VIDBYTES,VIDMEM,VIDBYTES, 0,0, x+marg, BUTY+marg, BUTWID-2*marg, BUTHGT-2*marg, SRCPAT, DSTXOR, syspat[PATWHITE]); } 0707070000020026551006660001460001440000010323460352172544700001200000043451newdisk.c/* This is a driver for the s4. Author: Bo Sjosten Date: 1984-06-07 */ #include "sys/hardware.h" #include "sys/iohw.h" #include "sys/gdisk.h" #include "./diag.h" #define LOGICAL 0 #define PHYSICAL 1 #define FALSE 0 #define TRUE 0xffff #define MAXRESTORE 1 int dfrd(), dfwt(), dhrd(), dhwt(); extern char *pVHBBad,*pBBTLost; extern char ComBuf[]; extern int CurSubtest; extern int maxretries,maxrestores; /* Drive parameters obtained from reading vhb */ struct dparam { ushort cyls; /* Cylinders / disk */ ushort trks; /* Tracks / cylinder ( = # of heads ) */ ushort secs[2]; /* Sectors / track */ /* Physical sectors/track */ ushort secsz; /* Bytes / sector */ ushort secoff; /* First sector number */ char steprt; /* Step rate to give to controller */ }; struct dfunc { int (*rd)(); /* Pointer to disk read function */ int (*wt)(); /* Pointer to disk write function */ }; ushort dcr_save = 0; ushort mcr_save = 0; ushort dma_flag = FALSE; int diskretries; int diskrestores; int disktype; char *bbt = 0; struct dparam fdparam = { 40, 2, 8, 8 , 512, 1, 0 }; struct dparam hdparam = { 612, 2, 16, 17, 512, 0, 0 }; struct dfunc fdfunc; /* Function pointers for the floppy disk */ struct dfunc hdfunc; /* Function pointers for the hard disk */ unsigned char HDFint = 0; unsigned char FDFint = 0; extern unsigned char P2_P3; ushort Disk_status,HDisk_err; /* * Routines intended to be called by other modules. */ dinit( dsktype, dsktbl, dbuf ) int dsktype; char *dsktbl; char *dbuf; { int status; #ifdef DEBUG printf("\ndinit: dsktype = %d", dsktype ); #endif /* Initialize function pointers */ fdfunc.rd = dfrd; fdfunc.wt = dfwt; hdfunc.rd = dhrd; hdfunc.wt = dhwt; fdparam.secoff = 1; hdparam.secoff = 0; if( dsktype == FD ) { dfmtron(); /* Start the engine */ dfselect(); /* Select the drive */ dfreset(); /* Kill the controller */ dhreset(); if( (status = dfrdy()) != 0 ) return( status ); status = dfrestore(); /* Start at ground zero */ wr2797( F_TRACKREG, 0 ); wr2797( F_SECTORREG, 0 ); wr2797( F_DATAREG, 0 ); if ( (status = drdvhb( dsktype,&fdparam,dbuf ) ) != 0 ) { #ifdef DEBUG printf("\nVHB read failed, status: %x", status ); #endif return( status ); } } else { #ifdef DEBUG printf("\nInitializing hard disk...\n"); #endif dhselect(); dhreset(); if( status = dhrestore() ) printf( "\nHard disk restore failed" ); wr1010( H_PRECOMP, 0x20 ); wr1010( H_SECCNT, 1 ); wr1010( H_SECNUM, 0 ); wr1010( H_CYLLOW, 0 ); wr1010( H_CYLHIGH, 0 ); wr1010( H_SDH, 0x20 ); if ( (status = drdvhb( dsktype,&hdparam,dbuf ) ) != 0 ) { drdbbt( dsktype,dsktbl ); return( status ); } if ( ( status = drdbbt( dsktype,dsktbl ) ) != 0 ) { return( status ); } } return( 0 ); /* Normal exit */ } drecal( dsktype, dsktbl, dbuf ) int dsktype; char *dsktbl; char *dbuf; { return( dinit( dsktype, dsktbl, dbuf ) ); } #ifdef EARLIER dsetparams( type, sectrk, psectrk, seccyl, pseccyl, ncyls, head, flags, step, secsz, retain ) /* These declarations needs to be checked for correct type info. */ int sectrk, seccyl; /* Logical sectors/track and sectors/cylinder */ int psectrk, pseccyl; /* Physical ditto */ int ncyls, secsz, type; char flags, head, retain; { } #endif dread( blk, dmabuf, seccnt, dsktype, blkmode ) int blk, blkmode, seccnt, dsktype; char *dmabuf; { #ifndef PROM #ifdef DEBUG printf("\nDREAD: disk = %x, blk = %x, seccnt = %x, blkmode = %x", dsktype, blk, seccnt, blkmode ); #endif #endif disktype = dsktype; if( dsktype == FD ) { return( fdcom( fdfunc.rd, &fdparam, blk, seccnt, blkmode, dmabuf ) ); } else { return( hdcom( hdfunc.rd, &hdparam, blk, seccnt, blkmode, dmabuf ) ); } } dwrite( blk, dmabuf, seccnt, dsktype, blkmode ) int blk, blkmode, seccnt, dsktype; char *dmabuf; { #ifndef PROM #ifdef DEBUG printf("\nDWRITE: disk = %x, blk = %x, seccnt = %x, blkmode = %x", dsktype, blk, seccnt, blkmode ); #endif #endif disktype = dsktype; if( dsktype == FD ) { return( fdcom( fdfunc.wt, &fdparam, blk, seccnt, blkmode, dmabuf ) ); } else { return( hdcom( hdfunc.wt, &hdparam, blk, seccnt, blkmode, dmabuf ) ); } } dnformat( type, buf, cyl, trk, seccnt, dmacnt ) int type, cyl, trk, seccnt, dmacnt; char *buf; { int status; if( type == FD ) { dfselect(); wr2797( F_DATAREG, cyl ); wr2797( F_COMMANDREG, F_SEEK ); setdma( buf, dmacnt, B_WRITE ); return( wr2797( F_COMMANDREG, F_WRITETRK | ( trk & 1 ) << 1 ) ); } else { if( ( cyl == 0 ) && ( trk == 0 ) ) { dhreset(); killdma(); dhselect(); dhrestore(); #ifdef FDEBUG showbuf( buf, 280, 8 ); #endif } setdma( buf, dmacnt, B_WRITE ); dsethead( trk ); wr1010( H_SDH, ( trk & 0x07 ) | 0x20 ); wr1010( H_CYLLOW, (ushort)cyl ); wr1010( H_CYLHIGH, (ushort)((cyl >> 8) & 3) ); wr1010( H_SECNUM, 36 ); wr1010( H_SECCNT, (ushort)seccnt ); status = wr1010( H_COMMANDREG, W_WR_FORMAT ); if( status ) lprintf(EXP_ERR,"dnformat: bad status = %x\n", status ); return( status ); } } dformat( type, buf, blk, cnt, mode, sectrk, psectrk, seccyl, pseccyl, ncyls, heads, flags, step, secsz, retain ) int type, blk, cnt, mode, psectrk, seccyl; int pseccyl, ncyls, heads, step; int secsz, retain; int sectrk; char flags; int *buf; { int status = 1, rsp; #ifndef PROM #ifdef DEBUG if( blk <= 8 ) printf("dformat: type = %x, buf = %x, blk = %d, cnt = %d, mode = %d, sectrk = %d, psectrk = %d, seccyl = %d, pseccyl = %d, ncyls = %d, heads = %d, flags = %d, step = %d, secsz = %d, retain = %d\n", type, buf, blk, cnt, mode, sectrk, psectrk, seccyl, pseccyl, ncyls, heads, flags, step, secsz, retain ); #endif #endif disktype = type; #ifdef DEBUG if( ( retain == 0 ) && ( blk <= 8 ) ) printf( pBBTLost ); if( ( bbt == 0 ) && ( retain ) ) printf( pBBTLost ); #endif /* First read the old bad block table */ if( ( retain ) && ( bbt != 0 ) && ( type == HD ) && ( blk <= 8 ) ) { status = drdbbt( disktype,bbt ); if( status ) printf( pBBTLost ); } /* Do the formatting */ if( type == HD ) { hdparam.secs[ PHYSICAL ] = psectrk; hdparam.secs[ LOGICAL ] = sectrk; hdparam.trks = heads; } rsp = dnformat( type, buf + 1, blk / pseccyl, ( blk / psectrk ) % heads, psectrk, cnt ) & 0xffff; #ifdef DEBUG if( rsp ) printf("dformat: status = %x\n", rsp ); #endif /* Now write the old bad block table back */ if( ( retain ) && ( status == 0 ) && ( type == HD ) && ( blk <= 8 ) ) { status = dwtbbt( type,bbt ); } return( rsp ); } /* * Routines intended to be private to this module. */ hdcom( func, param, stblk, seccnt, blkmode, dbuf ) struct dparam *param; int stblk, seccnt, blkmode; char *dbuf; int (*func)(); { int status, tmp1, tmp2; int thisblk; char bbflag; int cyl,trk,stsec; bbflag = status = 0; dfdeselect(); dhselect(); for( thisblk = stblk; thisblk < stblk+seccnt; thisblk++ ) { if( bbt == 0 ) break; tmp1 = thisblk / param->secs[ blkmode ]; tmp2 = thisblk % param->secs[ blkmode ]; cyl = tmp1 / param->trks ; trk = tmp1 % param->trks ; stsec = tmp2 + param->secoff ; if( bbflag = chkbb( &cyl,&trk,&stsec ) ) /* hit bad block */ { if( thisblk == stblk ) { status |= (*func)( cyl,trk,stsec,1,dbuf ); dbuf += param->secsz; if( (seccnt -1) <= 0 ) break; else { status |= hdcom( func,param,thisblk+1, seccnt-1,blkmode,dbuf ); break; /* done */ } } else { tmp1 = thisblk - stblk; status |= hdcom( func, param, stblk, tmp1, blkmode, dbuf ); dbuf += param->secsz*tmp1; status |= hdcom( func, param, thisblk, seccnt - tmp1, blkmode, dbuf ); break; /* done */ } } } /* for thisblk */ while ( bbflag == 0 ) { tmp1 = stblk / param->secs[ blkmode ]; tmp2 = stblk % param->secs[ blkmode ]; cyl = tmp1 / param->trks ; trk = tmp1 % param->trks ; stsec = tmp2 + param->secoff ; if( stsec + seccnt <= param->secs[ blkmode ] )/* not out of bound */ { status |= (*func)( cyl, trk, stsec, seccnt, dbuf ); break; /* done */ } else { tmp1 = param->secs[ blkmode ] - stsec + 1; status |= (*func)( cyl, trk, stsec, tmp1, dbuf ); dbuf += param->secsz*tmp1; stblk += tmp1; seccnt -= tmp1; } } /* while */ return( status ); } fdcom( func, param, blk, seccnt, blkmode, dbuf ) struct dparam *param; int blk, seccnt, blkmode; char *dbuf; int (*func)(); { int status, tmp1, tmp2; dhdeselect(); dfselect(); for( ; seccnt-- > 0; blk++ ) { diskretries = maxretries; diskrestores = maxrestores; tmp1 = blk / param->secs[ blkmode ]; tmp2 = blk % param->secs[ blkmode ]; while( ( status = (*func)( tmp1 / param->trks, tmp1 % param->trks, tmp2 + param->secoff, dbuf ) ) ) { if( diskretries-- ) continue; if( diskrestores--) { diskretries = maxretries; dfrestore(); continue; } return( status ); } dbuf += param->secsz; } diskretries = 0; return( 0 ); } drdvhb( dsktype,param,dbuf ) int dsktype; struct dparam *param; char *dbuf; { int status; struct vhbd *dvhb = ( struct vhbd *) dbuf; if( status = dread(0, dbuf, 2, dsktype, LOGICAL ) ) return( status ); if( ( dvhb->magic != VHBMAGIC ) || ( csumdblk( dbuf ) != -1 )) { printf(pVHBBad); return( 1 ); } param->cyls = dvhb->dsk.cyls; param->trks = dvhb->dsk.heads; param->secs[ LOGICAL ] = ( dvhb->dsk.psectrk ) & ~0x01; /*Always even */ param->secs[ PHYSICAL ] = dvhb->dsk.psectrk; /* Physical sectors */ param->secsz = dvhb->dsk.sectorsz; param->steprt = dvhb->dsk.step; return( 0 ); } drdbbt( dsktype,dbuf ) int dsktype; char *dbuf; { int status; if( status = dread( 2, dbuf, 2, dsktype, LOGICAL )) return( status ); bbt = dbuf; /* Save address of bad block table for future use */ return( 0 ); } dwtbbt( type, dbuf ) char *dbuf; int type; { int status; if( status = dwrite( 2,dbuf,2,type,LOGICAL ) ) return( status ); bbt = dbuf; /* Save address of bad block table for future use */ return( 0 ); } /* * Routines for the floppy disk. */ dfrd( cyl, trk, sec, dbuf ) int cyl, trk, sec; char *dbuf; { int status; if( ( status = dfseek( cyl ) ) != 0 ) return( status ); setdma( dbuf, fdparam.secsz, B_READ ); status = wr2797( F_SECTORREG, sec ); status = wr2797( F_COMMANDREG, F_READ | F_LENGTH | ( trk << 1 ) ); return( status ); } dfwt( cyl, trk, sec, dbuf ) int cyl, trk, sec; char *dbuf; { int status; if( ( status = dfseek( cyl ) ) != 0 ) return( status ); setdma( dbuf, fdparam.secsz, B_WRITE ); status = wr2797( F_SECTORREG, sec ); status = wr2797( F_COMMANDREG, F_WRITE | F_LENGTH | ( trk << 1 ) ); return( status ); } dfseek( cyl ) int cyl; { wr2797( F_DATAREG, cyl ); return( wr2797( F_COMMANDREG, F_SEEK | F_UPDTRKRG ) ); } dfrestore() { return( wr2797( F_COMMANDREG, F_RESTORE | STEPMSK ) ); } dforceint() { wr2797( F_COMMANDREG, F_FORCEINT | F_INT3 ); dfreset(); } dfrdy() { register int i, status; i = 0; while( i < 100000 ) { if( status = rd2797( F_STATUSREG ) & F_NOTRDY ) i++; else break; } return( status ); } /* * Routines for the hard disk. */ /* Assume no bad block or boundary problems */ dhrd( cyl, trk, stsec, seccnt, dbuf ) int cyl, trk, stsec, seccnt; char *dbuf; { int status; status = 0; diskretries = maxretries; diskrestores = MAXRESTORE; while( status = hdread( cyl, trk, stsec, seccnt, dbuf ) ) { if( diskretries-- ) continue; if( diskrestores-- ) { diskretries = maxretries; dhrestore(); continue; } return( status ); } } hdread( cyl, trk, stsec, seccnt, dbuf ) int cyl, trk, stsec, seccnt; char *dbuf; { int status; setdma( dbuf, hdparam.secsz*seccnt, B_READ ); dsethead( trk ); status = wr1010( H_SDH, ((trk & 0x07) | 0x20) ); status = wr1010( H_CYLLOW, (ushort)cyl ); status = wr1010( H_CYLHIGH, (ushort)((cyl >> 8) & 3) ); status = wr1010( H_SECNUM, (ushort)stsec ); status = wr1010( H_SECCNT, (ushort)seccnt ); status = wr1010( H_COMMANDREG, W_READ | W_MULT | W_INTEOC | 0x1 ); return( status ); } dhwt( cyl, trk, stsec, seccnt, dbuf ) int cyl, trk, stsec, seccnt; char *dbuf; { int status; status = 0; diskretries = maxretries; diskrestores = MAXRESTORE; while( status = hdwrite( cyl, trk, stsec, seccnt, dbuf ) ) { if( diskretries-- ) continue; if( diskrestores-- ) { diskretries = maxretries; dhrestore(); continue; } return( status ); } } hdwrite( cyl, trk, stsec, seccnt, dbuf ) int cyl, trk, stsec, seccnt; char *dbuf; { int status; setdma( dbuf, hdparam.secsz*seccnt, B_WRITE ); dsethead( trk ); status = wr1010( H_SDH, ((trk & 0x07) | 0x20) ); status = wr1010( H_CYLLOW, (ushort)cyl ); status = wr1010( H_CYLHIGH, (ushort)((cyl >> 8) & 3) ); status = wr1010( H_SECNUM, (ushort)stsec ); status = wr1010( H_SECCNT, (ushort)seccnt ); status = wr1010( H_COMMANDREG, W_WRITE | W_MULT | 0x1 ); return( status ); } dhrestore() { return( wr1010( H_COMMANDREG, W_RESTORE ) ); } chkbb( cyl, trk, sec ) int *cyl, *trk, *sec; { register struct bbcell *xbbc = (struct bbcell *) bbt; int i; xbbc++; for( i = 1; i < 128; i++ ) { if( ((ushort)xbbc->cyl == 0 ) && ( (ushort)xbbc->badblk == 0 ) ) return(0); if( ( (ushort)xbbc->cyl == *cyl ) && ( ( (ushort)xbbc->badblk / (ushort)hdparam.secs[ PHYSICAL ] ) == *trk ) && ( ( (ushort)xbbc->badblk % (ushort)hdparam.secs[ PHYSICAL ] ) == *sec ) ) { *cyl = (ushort)xbbc->altblk / hdparam.trks; *trk = (ushort)xbbc->altblk % hdparam.trks; *sec = hdparam.secs[ PHYSICAL ] - 1; return(1); } xbbc++; } } /* * General purpose routines. */ sdel() { int i; for( i = 0; i < 1000; i++ ) ; } /* * Hardware dependent routines */ wr2797( reg, data ) ushort reg, data; { int status; FDFint = 0; FD_BASE[ reg ] = (ushort)data; if( reg == F_COMMANDREG ) { status = fdwait(); if(( data & 0x80 ) == 0 ) /*Type 1 commands */ { return( status & ( F_SEEKERR | F_CRCERR | F_NOTRDY | DMA_ERROR ) ); } else /* Type 2 or 3 commands */ { return( status & ( F_NOTRDY | F_RECTYP | F_RECNF | F_CRCERR | F_LOSTDATA | DMA_ERROR ) ); } } else { return( 0 ); } } wr1010( reg, data ) ushort reg, data; { *DISK_CNTRL = dcr_save; HDFint = 0; HD_BASE[ reg ] = (ushort)data; if( reg == H_COMMANDREG ) return( hdwait() ); else return( 0 ); } rd2797( reg ) ushort reg; { return( FD_BASE[ reg ] ); } rd1010( reg ) ushort reg; { return( HD_BASE[ reg ] ); } setdma( sbuf, count, dir ) char *sbuf; char dir; int count; { ushort phys_cnt; phys_cnt = -(( count >> 1 ) + 1 ); DMA_LOADDR[ (ushort)( (int)(sbuf) & DMA_LO_MASK ) ] = 0; DMA_HIADDR[ (ushort)( ((int)(sbuf) >> 8) & DMA_HI_MASK ) ] = 0; if( dir == B_WRITE ) { mcr_save |= DMA_READ; *MCR_ADDR = mcr_save; *DMA_CNT = phys_cnt | DMA_ENABLE | DMA_READ; } else { mcr_save &= ~DMA_READ; *MCR_ADDR = mcr_save; *DMA_CNT = ( phys_cnt | DMA_ENABLE ) & ~DMA_READ; while( (phys_cnt | DMA_ENABLE) == *DMA_CNT ) ; DMA_LOADDR[ (ushort)( (int)(sbuf) & DMA_LO_MASK ) ] = 0; DMA_HIADDR[ (ushort)( ((int)(sbuf) >> 8) & DMA_HI_MASK ) ] = 0; *DMA_CNT = ( phys_cnt | DMA_ENABLE ) & ~DMA_READ; } dma_flag = TRUE; } killdma() { register int status; if( dma_flag == FALSE ) return( 0 ); dma_flag = FALSE; status = *DMA_CNT; *DMA_CNT = 0; /* Disable dma */ *DMA_LOADDR = 0; /* Clear write fault latch */ if( (status & DMA_ERROR) == 0 ) { lprintf( EXP_ERR,"\nDisk DMA overrun/underrun, DMA count = %x", status ); return( DMA_ERROR ); } /* Return low 14 bits of incremented terminal count, with the over/underrun bit toggled to be high true */ return( 0 ); } dfselect() { *DISK_CNTRL = dcr_save |= FDR0; } dfdeselect() { *DISK_CNTRL = dcr_save &= ~FDR0; } dhselect() { *DISK_CNTRL = dcr_save |= HDR0; } dhdeselect() { *DISK_CNTRL = dcr_save &= ~HDR0; } dsethead( head ) int head; { dcr_save &= ~HDSEL; *DISK_CNTRL = dcr_save |= (ushort)( head & HDSEL ); } dfreset() { *DISK_CNTRL = dcr_save &= ~NOT_FDRST; sdel(); *DISK_CNTRL = dcr_save |= NOT_FDRST; sdel(); } dhreset() { *DISK_CNTRL = dcr_save &= ~NOT_HDRST; sdel(); *DISK_CNTRL = dcr_save |= NOT_HDRST; sdel(); } dfmtron() { *DISK_CNTRL = dcr_save |= FDMTR; } dfmtroff() { *DISK_CNTRL = dcr_save &= ~FDMTR; } hdwait() { int status; unsigned int timeout; timeout = 0xffffffff; while( HDFint == 0 && timeout-- ); if( status = killdma() ) return( status ); if( HDFint == 0 ) { status = ( rd1010( H_STATUSREG ) & W_ERR ); sprintf(ComBuf,"\tHard disk time out, status = %x",status); error(ComBuf,CurSubtest,ComBuf); } else status = Disk_status & W_ERR; /* dhreset();*/ if( status || ( HDisk_err & (W_CRC || W_ID || W_TK || 0x1) ) ) status = HDisk_err & 0xff; return( status ); } fdwait() { int status; unsigned int timeout; timeout = 0xfffff; while( FDFint == 0 && timeout-- ); if( status = killdma() ) return( status ); if( FDFint == 0 ) { status = rd2797( F_STATUSREG ) & 0xff; sprintf(ComBuf,"\tFloppy timeout, status = %x",status); error(ComBuf,CurSubtest,ComBuf); } else status = Disk_status & 0xff; return( status ); } #ifndef PROM #ifdef DEBUG showbuf( buf, count, width ) ushort *buf; int count, width; { int i, j; for( j = 0; j*width < count; j++ ) { printf("\n%04x: ", j*2*width ); for( i = 0; i < width; i++ ) printf( "%04x ", *buf++ ); printf(" "); buf -= width; for( i = 0; i < width; i++ ) { if( ((*buf)>>8) >= ' ' && ((*buf)>>8) <= 0x7f ) printf("%c", (*buf)>>8 ); else printf("."); if( ((*buf)&0xff) >= ' ' && ((*buf)&0xff) <= 0x7f ) printf("%c", *buf); else printf("."); buf++; } } printf("\n"); } showbbt( param, dbuf ) char *dbuf; struct dparam *param; { register struct bbcell *xbbc = (struct bbcell *) dbuf; int i; xbbc++; for (i=1; i<127; i++) { if (((ushort)xbbc->cyl == 0) && ((ushort)xbbc->badblk == 0)) { break; } printf("Cylinder %d, Track %d, Physical Sector %d, uses Track %d as Alternate.\n", (ushort)xbbc->cyl, (ushort)xbbc->badblk / (short)param->psecs, (ushort)xbbc->badblk % (short)param->psecs, (ushort)xbbc->altblk); xbbc++; } } #endif #endif 0707070000020026571006440001460001440000010323710352172545000001300000000130newtest1.cnewtest1a(subtest) int subtest; { printf("Test 1A: subtest %d\n", subtest); return; } 0707070000020026611006660001460001440000010323720352172545000001000000002312odump.c#include "sys/wd.h" #define REV(n,b) (((n>>b)&1)<<(7-b)) unsigned char rev[256]; #ifdef PRINTSCR lpdump() { register unsigned char pix; register short row,col,i; char empty; for (i=0 ; i<256 ; i++) rev[i] = REV(i,7)+REV(i,6)+REV(i,5)+REV(i,4)+ REV(i,3)+REV(i,2)+REV(i,1)+REV(i,0); for (i=0 ; i<1024 ; i++) lpout(0); lpout('\n'); lpout('\n'); lpputs("\033>\033E\033T16"); for (row=0 ; row= VIDHEIGHT ) return(0); w = VIDMEM[(VIDWIDTH/16)*row + col/16]; if (w & masks[col%16]) return(1); else return(0); } lpputs(s) register char *s; { while (*s) lpout(*s++); } #endif 0707070000020026631006660001460001440000010323740352172545400000700000001276page.c/* Convergent Technologies - System V - Jul 1983 */ /*static char page_c[] = "@(#)page.c 1.1";*/ #include "diag.h" #include "sys/hardware.h" #include "sys/pte.h" long tmaxMem, tminMem, tminPage, tmaxPage; #define MAP_SUBTESTS 2 /* * To prevent parity error interrupts when reading uninitialized * memory after a power up. This routine saves the GCR state, * inhibits parity errors and then reads and promptly writes back * all locations in memory. Then restores the GCR state. */ ClearParity() { register int *ptr = (int *) 0; SetS4Map(); /* to ensure we can access memory */ *PE_INT_GCR_ADDR = PE_INT_DISABLE ; /* disable PIE */ while ( ptr <= (int *)tmaxMem) { *ptr++ = *ptr; } } 0707070000020026641006660001460001440000010323750352172545400001100000000435parity.c/* Convergent Technologies - System V - Jul 1983 */ /*static char parity_c[] = "@(#)parity.c 1.1";*/ /* Parity check program - part of s4 diagnostics */ #include #include #include "diag.h" ushort ParBSR0, ParBSR1; BOOLEAN fParErr=FALSE, fParTest=FALSE; 0707070000020026661006660001460001440000010323760352172545500001100000010551printf.c/* Convergent Technologies - System V - Jul 1983 */ /*static char printf_c[] = "@(#)printf.c 1.1";*/ /* printf, simple/portable version. SAW 6/79 * * Calls only putchar. * Escape sequences implemented: * %nd 1-prec decimal, signed * %nD 2-prec decimal, signed * %no 1-prec octal, unsigned * %n) 2-prec octal, unsigned * %nx 1-prec hex, unsigned * %nX 2-prec hex, unsigned * %ns string * %c character * %% percent * * in above, "n" can be an integer arg or "v", whence field width comes * from arg list. */ #include "diag.h" #define ESC '%' extern putchar(); extern msglevel_t MsgLevel; long DecTab[] = { 1000000000L, 100000000L, 10000000L, 1000000L, 100000L, 10000L, 1000L, 100L, 10L, 1L, 0L }; RdArg(ptr,where) register char *ptr; register int *where; { int val = 0; while (*ptr >= '0' && *ptr <= '9') val = (val<<3) + (val<<1) + *ptr++ - '0'; *where = val; return (int) ptr; } int putn2(val,digs) register long val; register char *digs; { long *lp = DecTab; int ndigs = 10, i=0; int dig; if (val == 0) { digs[0] = 0; return 1; } while (*lp > val) { lp++; ndigs--; }; while (ndigs) { for (dig = 0; (val -= *lp) >= 0; dig++); val += *lp++; digs[--ndigs] = dig; i++; } return i; } putnum(val,fmt,radix,sign) register int val; { char digbuf[100], negflag = 0; int ndig = 0, spaces = fmt; if (sign && val<0) { if ((val = -val) < 0) val = 0; negflag++; } switch (radix) { case 10: ndig = putn2( (long) val,digbuf); break; case 16: do { digbuf[ndig++] = val & 0XFL; val = (val >> 4) & 0X0FFFFFFF; } while (val); break; case 8: do { digbuf[ndig++] = val & 0X7L; val = (val >> 3) & 0X1FFFFFFF; } while (val); break; case 2: do { digbuf[ndig++] = val & 0X1L; val = (val >> 1) & 0X7FFFFFFF; } while (val); break; } spaces = fmt-ndig-negflag; if (sign) while (spaces-- > 0) putchar(' '); else while (spaces-- > 0) putchar('0'); if (negflag) putchar('-'); while (ndig) { if ((spaces = digbuf[--ndig]) >= 10) spaces += 'A'-'0'-10; putchar(spaces + '0'); }} putstring(str,fmt) register char *str; register int fmt; { while (*str && fmt--) putchar(*str++); while (fmt-- > 0) putchar(' '); } /*VARARGS1*/ printf(ctl,args) char *ctl; { register int *argp = &args; register char *cc = ctl; register int ch; int Arg1, Arg2; if (ctl == 0) return; while (ch = *cc++) { if (ch != ESC) { putchar(ch); continue; } Arg1 = -1; Arg2 = -1; if (((ch = *cc++) >= '0' && ch <= '9') || (ch == 'v')) { if (ch == 'v') Arg1 = *argp++; else cc = (char *) RdArg(--cc,&Arg1); if ((ch = *cc++) == '.') { if (*cc == 'v') { Arg2 = *argp++; cc++; } else cc = (char *) RdArg(cc,&Arg2); ch = *cc++; }} switch (ch) { case ESC: putchar(ESC); break; case 0: putchar(ESC); return; case 'D': case 'd': putnum(*argp++,Arg1,10,1); break; case 'O': case 'o': putnum(*argp++,Arg1,8,0); break; case 'X': case 'x': putnum(*argp++,Arg1,16,0); break; case 'c': putchar(*argp++); break; case 's': putstring((char *) *argp++,Arg1); break; default: putchar(ESC); putchar(ch); break; }} } /*VARARGS1*/ lprintf(lvl,ctl,args) msglevel_t lvl; char *ctl; { register int *argp = &args; register char *cc = ctl; register int ch; int Arg1, Arg2; if (ctl == 0) return; while (ch = *cc++) { if (ch != ESC) { if (lvl <= MsgLevel) putchar(ch); continue; } Arg1 = -1; Arg2 = -1; if (((ch = *cc++) >= '0' && ch <= '9') || (ch == 'v')) { if (ch == 'v') Arg1 = *argp++; else cc = (char *) RdArg(--cc,&Arg1); if ((ch = *cc++) == '.') { if (*cc == 'v') { Arg2 = *argp++; cc++; } else cc = (char *) RdArg(cc,&Arg2); ch = *cc++; }} #ifdef DEBUG printf("lvl = %d, MsgLevel = %d, ch = %x, %c\n", lvl, MsgLevel, ch, ch); #endif if (lvl <= MsgLevel) { switch (ch) { case ESC: putchar(ESC); break; case 0: putchar(ESC); return; case 'D': case 'd': putnum(*argp++,Arg1,10,1); break; case 'O': case 'o': putnum(*argp++,Arg1,8,0); break; case 'X': case 'x': putnum(*argp++,Arg1,16,0); break; case 'c': putchar(*argp++); break; case 's': putstring((char *) *argp++,Arg1); break; default: putchar(ESC); putchar(ch); break; } } else { switch (ch) { case ESC: break; case 0: return; case 'D': case 'd': case 'O': case 'o': case 'X': case 'x': case 'c': case 's': *argp++; break; default: putchar(ESC); putchar(ch); break; } } } } 0707070000020026701006660001460001440000010324030352172545600000700000000620prot.c/* Convergent Technologies - System V - Jul 1983 */ #include "diag.h" #include "sys/hardware.h" #include "sys/pte.h" #define PG_ABSENT (~PG_STAT) #define PF_MAX_SUBTESTS 2 #define CPU 0x1 #define DMA 0x0 #define PF 0x1 #define NPC 0x2 #define UIE 0x4 #define MMU 0x8 BOOLEAN fPROTest = FALSE; BOOLEAN fBUSERR=FALSE, fPFTest=FALSE ; ushort PROTGSR,PROTBSR0,PROTBSR1; ushort mapKeep,*pMapKeep; 0707070000020026711006660001460001440000010324040352172545700001200000043264rastop.m4 # General RasterOp Primitive # E. A. Hahn, February, 1984 # # xrastop( SrcBase, SrcWidth, DstBase, DstWidth, # SrcX, SrcY, DstX, DstY, # Width, Height, SrcOp, DstOp, # Pattern # ) # # The Bases and Pattern are pointers to shorts # The Src/Dst Widths are in bytes # The coordinates and Width/Height are in pixels # The Ops are controls # # If this module is compiled with SMALLROP, it gets smaller # by omitting most of the source, destination operations leaving # only SRCSRC and PATSRC. undefine(`shift') #define SrcBase 8(%a6) #define SrcWidth 14(%a6) #define DstBase 16(%a6) #define DstWidth 22(%a6) #define SrcX 26(%a6) #define SrcY 30(%a6) #define DstX 34(%a6) #define DstY 38(%a6) #define Width 42(%a6) #define Height 46(%a6) #define SrcOp 50(%a6) #define DstOp 54(%a6) #define Pattern 56(%a6) # Locals (all allocated as longs) #define SavedHeight -4(%a6) #define DstWords -8(%a6) #define ShiftMask -12(%a6) #define SrcPat -16(%a6) #define SrcFstMask -20(%a6) #define SrcLstMask -24(%a6) #define DstFstMask -28(%a6) #define DstLstMask -32(%a6) #define SrcFstBit -36(%a6) #define SrcLstBit -40(%a6) #define DstFstBit -44(%a6) #define DstLstBit -48(%a6) data even global syspat,patwhite,patblack,patgray syspat: # System Pattern Table long patblack # PATBLACK (0) long patwhite # PATWHITE (1) long patgray # PATGRAY (2) long patltgray # PATLTGRAY(3) patblack: # All Pixels off short 0x0000,0x0000,0x0000,0x0000 short 0x0000,0x0000,0x0000,0x0000 short 0x0000,0x0000,0x0000,0x0000 short 0x0000,0x0000,0x0000,0x0000 patwhite: # All Pixels on short 0xFFFF,0xFFFF,0xFFFF,0xFFFF short 0xFFFF,0xFFFF,0xFFFF,0xFFFF short 0xFFFF,0xFFFF,0xFFFF,0xFFFF short 0xFFFF,0xFFFF,0xFFFF,0xFFFF patgray: # Every other Pixel on short 0xAAAA,0x5555,0xAAAA,0x5555 short 0xAAAA,0x5555,0xAAAA,0x5555 short 0xAAAA,0x5555,0xAAAA,0x5555 short 0xAAAA,0x5555,0xAAAA,0x5555 patltgray: # Lighter gray #ifdef WHITE short 0xEEEE,0xFFFF,0xEEEE,0xFFFF short 0xEEEE,0xFFFF,0xEEEE,0xFFFF short 0xEEEE,0xFFFF,0xEEEE,0xFFFF short 0xEEEE,0xFFFF,0xEEEE,0xFFFF #else short 0x1111,0x0000,0x1111,0x0000 short 0x1111,0x0000,0x1111,0x0000 short 0x1111,0x0000,0x1111,0x0000 short 0x1111,0x0000,0x1111,0x0000 #endif set SrcOpPattern,1 #ifndef SMALLROP OpTable: # Forward Versions long FSrcSrc, FPatSrc, FAndSrc, FOrSrc long FXorSrc, RastErr, RastErr, RastErr long FSrcAnd, FPatAnd, FAndAnd, FOrAnd long FXorAnd, RastErr, RastErr, RastErr long FSrcOr, FPatOr, FAndOr, FOrOr long FXorOr, RastErr, RastErr, RastErr long FSrcXor, FPatXor, FAndXor, FOrXor long FXorXor, RastErr, RastErr, RastErr long FSrcCand, FPatCand, FAndCand, FOrCand long FXorCand, RastErr, RastErr, RastErr BOpTable: # Backward Versions long BSrcSrc, RastErr, BAndSrc, BOrSrc long BXorSrc, RastErr, RastErr, RastErr long BSrcAnd, RastErr, BAndAnd, BOrAnd long BXorAnd, RastErr, RastErr, RastErr long BSrcOr, RastErr, BAndOr, BOrOr long BXorOr, RastErr, RastErr, RastErr long BSrcXor, RastErr, BAndXor, BOrXor long BXorXor, RastErr, RastErr, RastErr long BSrcCand, RastErr, BAndCand, BOrCand long BXorCand, RastErr, RastErr, RastErr #else OpTable: # Forward Versions long FSrcSrc, FPatSrc, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr BOpTable: # Backward Versions long BSrcSrc, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr long RastErr, RastErr, RastErr, RastErr #endif FstMaskTab: short 0xFFFF,0xFFFE,0xFFFC,0xFFF8 short 0xFFF0,0xFFE0,0xFFC0,0xFF80 short 0xFF00,0xFE00,0xFC00,0xF800 short 0xF000,0xE000,0xC000,0x8000 global ForwardMask # used by rastex ForwardMask: short 0x0000 # rest is LstMaskTab LstMaskTab: short 0x0001,0x0003,0x0007,0x000F short 0x001F,0x003F,0x007F,0x00FF short 0x01FF,0x03FF,0x07FF,0x0FFF short 0x1FFF,0x3FFF,0x7FFF,0xFFFF ReverseMask: short 0x0000,0xFFFE,0xFFFC,0xFFF8 short 0xFFF0,0xFFE0,0xFFC0,0xFF80 short 0xFF00,0xFE00,0xFC00,0xF800 short 0xF000,0xE000,0xC000,0x8000 even text # Main entry point. First, compute bit positions of first and last # points in the rectangle. #ifdef DEBUGPRINT global xrastop xrastop: #else global rastop rastop: #endif link %a6,&-104 # 48 locals, 56 (14*4) registers movm.l &0x3FFF,-104(%a6) # save the D0-D7, A0-A5 sub.w &1, Width # convert width/height to offsets bcs RastRet # width must not be 0 mov.w Width,%d2 mov.w Height,SavedHeight # get a copy of the height sub.w &1,Height bcs RastRet # height must not be 0 # In the code below, D1=&0xF and D2=Width. Towards the end, D3 is # set to a copy of DstLstBit before being truncated to 4 bits. mov.w &0xF,%d1 mov.w SrcX,%d0 # compute bit positions of xy pairs and.w %d1,%d0 mov.w %d0,SrcFstBit add.w %d2,%d0 # and of final xy pairs and.w %d1,%d0 mov.w %d0,SrcLstBit mov.w DstX,%d0 and.w %d1,%d0 mov.w %d0,DstFstBit add.w %d2,%d0 mov.w %d0,%d3 # save a copy before the modulo and.w %d1,%d0 mov.w %d0,DstLstBit # Compute the number of words wide in the destination rectangle from # (DstFirstBit+Width-1)/16 + 1. The parenthetical quantity is in D3. lsr.w &4,%d3 add.w &1,%d3 mov.w %d3,DstWords # Compute the number of bit places which must be shifted by subtracting # the two bit position quantities (DstLstBit-SrcLstBit) modulo the word # size (16), save it in D0 forever. Also set the fNeedRem flag to false # in D7. sub.w SrcLstBit,%d0 and.w %d1,%d0 clr.l %d7 # Compute the pattern alignement 2*( DstY MOD 16 ) mov.w DstY,%d2 and.w %d1,%d2 add.w %d2,%d2 mov.w %d2,SrcPat # Now D0=rotate count, D7=flags=0 # Compute the direction of the rasterop (forwards or backwards) in the # fBack flag. Since D7 already has 0, the fBack flag is false, indicating # a forward direction. cmp.w SrcOp,&SrcOpPattern # source a simple pattern? beq Forward # yes - forward is fine mov.l SrcBase,%d1 # src & dst in different maps? cmp.l %d1,DstBase bne Forward # yes - forward is fine mov.w DstY,%d1 # no - check which is sooner cmp.w %d1,SrcY bgt Backward # dest is greater, go backwards blt Forward # dest is lesser, go forwards mov.w DstX,%d1 # too close, must check Xs cmp.w %d1,SrcX ble Forward # If we're going backwards, adjust the xy pairs to be at the lower # right of the rectangle instead of the upper-left. Backward: bset &0,%d7 # light the backwards bit mov.w Width,%d2 # get the width add.w %d2,SrcX # offset add.w %d2,DstX mov.w Height,%d2 add.w %d2,SrcY add.w %d2,DstY # Compute the src and dst masks given the bit positions # D0 still has rotate count. mov.w DstFstBit,%d2 # get dest first bit add.w %d2,%d2 mov.l &FstMaskTab,%a0 # get base of table mov.w 0(%a0,%d2.w),%d1 # get the mask mov.w %d1,SrcLstMask # save it not.w %d1 mov.w %d1,DstLstMask mov.w DstLstBit,%d2 add.w %d2,%d2 mov.l &LstMaskTab,%a0 mov.w 0(%a0,%d2.w),%d1 mov.w %d1,SrcFstMask not.w %d1 mov.w %d1,DstFstMask # Compute SrcLine = -SrcWidth + (2*DstWords) # DstLine = -DstWidth + (2*DstWords) # D0 still has rotate count. # Note that SrcLine and DstLine are sign-extended longs. mov.w DstWords,%d2 add.w %d2,%d2 mov.w DstWidth,%d1 neg.w %d1 add.w %d2,%d1 ext.l %d1 mov.l %d1,%a5 cmp.w SrcOp,&SrcOpPattern # source a simple pattern? beq NoSrc mov.w SrcWidth,%d1 neg.w %d1 add.w %d2,%d1 ext.l %d1 mov.l %d1,%a4 # If SrcLstBit < DstLstBit then light the fNeedRem flag in D7 and # step SrcLine forward by 2 bytes. # D0 still has rotate count. mov.w SrcLstBit,%d1 cmp.w %d1,DstLstBit bge XX1 bset &1,%d7 add.l &2,%a4 # Use rotate count (still in D0) to find the ReverseMask entry XX1: mov.w %d0,%d1 # don't hurt d0 add.w %d1,%d1 mov.l &ReverseMask,%a0 mov.w 0(%a0,%d1.w),ShiftMask # record the entry bra Rast1 # and merge with normal code # Here when we're going forward. Forward: # Compute the src and dst masks given the bit positions # D0 still has rotate count. mov.w DstFstBit,%d2 # get dest first bit add.w %d2,%d2 mov.l &FstMaskTab,%a0 # get base of table mov.w 0(%a0,%d2.w),%d1 # get the mask mov.w %d1,SrcFstMask # save it not.w %d1 mov.w %d1,DstFstMask mov.w DstLstBit,%d2 add.w %d2,%d2 mov.l &LstMaskTab,%a0 mov.w 0(%a0,%d2.w),%d1 mov.w %d1,SrcLstMask not.w %d1 mov.w %d1,DstLstMask # Compute SrcLine = SrcWidth - (2*DstWords) # DstLine = DstWidth - (2*DstWords) # D0 still has rotate count. # Note that SrcLine and DstLine are sign-extended longs. mov.w DstWords,%d2 add.w %d2,%d2 mov.w DstWidth,%d1 sub.w %d2,%d1 ext.l %d1 mov.l %d1,%a5 # If the source is just the pattern, skip all this cmp.w SrcOp,&SrcOpPattern # skip all this if no source beq NoSrc mov.w SrcWidth,%d1 sub.w %d2,%d1 ext.l %d1 mov.l %d1,%a4 # If DstFstBit < SrcFstBit then light the fNeedRem flag in D7 and # step SrcLine backward by 2 bytes. # D0 still has rotate count. mov.w DstFstBit,%d1 cmp.w %d1,SrcFstBit bge XX2 bset &1,%d7 sub.l &2,%a4 # Use rotate count (still in D0) to find the ReverseMask entry XX2: mov.w %d0,%d1 # don't hurt d0 add.w %d1,%d1 mov.l &ForwardMask,%a0 mov.w 0(%a0,%d1.w),ShiftMask # record the entry # Compute the raw memory address of the source pointer in A0, as # follows SrcRaw=A0=SrcBase + SrcY*SrcWidth + (SrcX/8 AND 0xFE) Rast1: mov.w SrcY,%d1 mulu.w SrcWidth,%d1 # produces a long (hi part of d1=0) mov.w SrcX,%d2 lsr.w &3,%d2 and.l &0xFE,%d2 # produces a long add.l %d2,%d1 mov.l SrcBase,%a0 add.l %d1,%a0 # Do the same for the destination, DstRaw into A1 NoSrc: mov.w DstY,%d1 mulu.w DstWidth,%d1 mov.w DstX,%d2 lsr.w &3,%d2 and.l &0xFE,%d2 add.l %d2,%d1 mov.l DstBase,%a1 add.l %d1,%a1 # Compute a hash index of the two functions, SrcOp and DstOp as follows: # CombinedOp = 8*DstOp + SrcOp # This will be used to jump through a table. # A0 has the SrcRaw and A1 has DstRaw at this point. # D0 has the rotate count and D7 has the flags. mov.w DstOp,%d1 lsl.w &3,%d1 or.w SrcOp,%d1 # Check if SrcOp is Src and DstOp is STORE. If so, check further to see # if the rotate count is zero. If so, branch off to a very fast special # case. For all other cases, compute the inner loop address in A2. bne NotFast tst.w %d0 bne NotFast jmp Fast NotFast: bclr &0,%d7 # check D7 for backwardsness beq SlowForward # if zero, its forward SlowBackward: add.l &2,%a0 # fix 68K predecrement add.l &2,%a1 add.w &40,%d1 # if backwards, step to latter table # (40 = BopTable-OpTable) SlowForward: mov.w ShiftMask,%d6 # D6 = shift mask lsl.w &2,%d1 # 4 bytes/entry mov.l &OpTable,%a2 mov.l 0(%a2,%d1.w),%d1 mov.l %d1,%a2 # A2 = inner loop address mov.l Pattern,%a3 # A3 = pattern address jmp (%a2) Fast: bclr &0,%d7 beq FFast add.l &2,%a0 # fix 68K predecrement add.l &2,%a1 jmp BFast RastErr: RastRet: movm.l -104(%a6),&0x3FFF # restore D0-D7, A0-A5 unlk %a6 rts # These are the inner loops # Throughout this code: # # A0 = Src pointer (SrcRaw) # A1 = Dst pointer (DstRaw) # A2 = Inner Loop Routine Address # A3 = Base of Pattern Table # A4 = Src Line Increment # A5 = Dst Line Increment # # D0 = Rotate Count # D1 = Assembled Word # D2 = Aligned Pattern # D3 = Remainder for next iteration # D4 = General counter (esp for loop mode) # D5 = Temp (esp manipulations with DstWords) # D6 = ShiftMask # D7 = Need Rem Flag define(RasterLoop,` #***************************************************************************** # # INNER LOOP, Source Op=$1, Dest Op=$2, -=$3, +=$4, local symbol=$5 # #***************************************************************************** ifelse($4,`+',` global F$1$2 F$1$2: ifelse($1,Pat,` ifelse($2,Src,` cmp.l %a3,&0 # check for fast pattern of zeros beq FZerSrc ')') ',` global B$1$2 B$1$2: ') $51: ifelse($1,Pat,,` ifelse($1,Src,,` mov.w SrcPat,%d1 # get source pattern alignment mov.w 0(%a3,%d1.w),%d2 # get pattern add.w &2,%d1 # step to next pattern and.w &0x1E,%d1 # mod 2*16 mov.w %d1,SrcPat # update ')') ifelse($1,Pat,` mov.w SrcPat,%d1 # get source pattern alignment mov.w 0(%a3,%d1.w),%d3 # get pattern add.w &2,%d1 # step to next pattern and.w &0x1E,%d1 # mod 2*16 mov.w %d1,SrcPat # update mov.w %d3,%d1 # set up current word=remainder ',` /* Source is not pattern */ clr.w %d3 tst.l %d7 beq $52 ifelse($1,Src,` /* Source is Src */ mov.w $3(%a0)$4,%d3 # go directly into remainder rol.w %d0,%d3 ',` /* Source is not Src, not Pat */ SrcProc($1,%d1,$3,$4) mov.w %d1,%d3 # save remainder ') and.w %d6,%d3 # mask off, leaving remainder in d3 $52: SrcProc($1,%d2,$3,$4) exg %d1,%d3 # D1 gets remainder from previous word eor.w %d3,%d1 and.w %d6,%d3 # D3 gets remainder for next word eor.w %d3,%d1 # D1 gets comb. of old rem. and current ') and.w SrcFstMask,%d1 # mask with Fst word mask ifelse($2,Xor,,` ifelse($2,Cand,,` ifelse($4,+,` mov.w (%a1),%d5 # get first destination word ',` mov.w -2(%a1),%d5 # get first destination word ') and.w DstFstMask,%d5 # plug in unchanged part or.w %d5,%d1 ')') ifelse($1,Pat,,` /* Src is not pattern */ mov.w DstWords,%d5 # normal move operation sub.w &1,%d5 # while DstWords > 1 beq $54 $53: DstProc($2,$3,$4) SrcProc($1,%d2,$3,$4) exg %d1,%d3 # D1 gets remainder from previous word eor.w %d3,%d1 and.w %d6,%d3 # D3 gets remainder for next word eor.w %d3,%d1 # D1 gets comb. of old rem. and current sub.w &1,%d5 bne $53 ') ifelse($1,Pat,` mov.w DstWords,%d4 # case of SrcPat and nil Dest op sub.w &1,%d4 beq $54 ifelse($2,Src,` mov.w %d1,$3(%a1)$4 # store first word mov.w %d3,%d1 sub.w &2,%d4 blt $54 $55: mov.w %d1,$3(%a1)$4 # rapidly store all but last dbf %d4,$55 ',` $53: DstProc($2,$3,$4) mov.w %d3,%d1 sub.w &1,%d4 bne $53 ')') $54: and.w SrcLstMask,%d1 # store last word under mask ifelse($2,Xor,,` ifelse($2,Cand,,` ifelse($4,+,` mov.w (%a1),%d5 # get first destination word ',` mov.w -2(%a1),%d5 # get first destination word ') and.w DstLstMask,%d5 or.w %d5,%d1 # plug in unchanged part of dest ')') DstProc($2,$3,$4) # SrcRaw=SrcRaw + SrcLine # DstRaw=DstRaw + DstLine # SavedHeight-- ifelse($1,Pat,,` add.l %a4,%a0 ') add.l %a5,%a1 sub.w &1,SavedHeight bne $51 jmp RastRet ') define(DstProc,` ifelse($1,Src,` mov.w %d1,$2(%a1)$3 ') ifelse($1,And,` and.w %d1,$2(%a1)$3 ') ifelse($1,Or,` or.w %d1,$2(%a1)$3 ') ifelse($1,Xor,` eor.w %d1,$2(%a1)$3 ') ifelse($1,Cand,` not.w %d1 and.w %d1,$2(%a1)$3 ') ') define(SrcProc,` ifelse($1,Src,` mov.w $3(%a0)$4,%d1 rol.w %d0,%d1 ') ifelse($1,And,` mov.w $3(%a0)$4,%d1 rol.w %d0,%d1 and.w $2,%d1 ') ifelse($1,Or,` mov.w $3(%a0)$4,%d1 rol.w %d0,%d1 or.w $2,%d1 ') ifelse($1,Xor,` mov.w $3(%a0)$4,%d1 rol.w %d0,%d1 eor.w $2,%d1 ') ') define(FastLoop,` # Optimized routine for case of no shift and just moving (scrolling) # Direction = $1 global $1Fast $1Fast: mov.w SavedHeight,%d3 $1FZ1: mov.w $2(%a0)$3,%d1 # Fetch first source and.w SrcFstMask,%d1 # mask with first mask ifelse($3,+,` mov.w (%a1),%d5 # get first destination word ',` mov.w -2(%a1),%d5 # get first destination word ') and.w DstFstMask,%d5 or.w %d5,%d1 # plug in unchanged mov.w DstWords,%d4 sub.w &1,%d4 beq $1FZ4 mov.w %d1,$2(%a1)$3 sub.w &2,%d4 blt $1FZ3 $1FZ2: mov.w $2(%a0)$3,$2(%a1)$3 dbf %d4,$1FZ2 $1FZ3: mov.w $2(%a0)$3,%d1 $1FZ4: and.w SrcLstMask,%d1 ifelse($3,+,` mov.w (%a1),%d5 # get first destination word ',` mov.w -2(%a1),%d5 # get first destination word ') and.w DstLstMask,%d5 or.w %d5,%d1 mov.w %d1,$2(%a1)$3 # rawSrc=rawSrc + dbLineSrc; # rawDst=rawDst + dbLineDst; # dy=dy - 1; add.l %a4,%a0 add.l %a5,%a1 sub.w &1,%d3 bne $1FZ1 jmp RastRet ') # Optimized case of Clearing Dest global FZerSrc FZerSrc: ZZ1: mov.w (%a1),%d1 and.w DstFstMask,%d1 mov.w DstWords,%d4 sub.w &1,%d4 beq ZZ3 mov.w %d1,(%a1)+ clr.w %d1 sub.w &2,%d4 blt ZZ3 ZZ2: clr.w (%a1)+ dbf %d4,ZZ2 ZZ3: and.w SrcLstMask,%d1 mov.w (%a1),%d5 and.w DstLstMask,%d5 or.w %d5,%d1 mov.w %d1,(%a1)+ add.l %a5,%a1 sub.w &1,SavedHeight bne ZZ1 jmp RastRet FastLoop(F, ,+) FastLoop(B,-, ) RasterLoop(Src,Src, ,+,R1) RasterLoop(Pat,Src, ,+,R2) #ifndef SMALLROP RasterLoop(And,Src, ,+,R3) RasterLoop(Or,Src, ,+,R4) RasterLoop(Xor,Src, ,+,R5) RasterLoop(Src,And, ,+,R6) RasterLoop(Pat,And, ,+,R7) RasterLoop(And,And, ,+,R8) RasterLoop(Or,And, ,+,R9) RasterLoop(Xor,And, ,+,R10) RasterLoop(Src,Or, ,+,R11) RasterLoop(Pat,Or, ,+,R12) RasterLoop(And,Or, ,+,R13) RasterLoop(Or,Or, ,+,R14) RasterLoop(Xor,Or, ,+,R15) RasterLoop(Src,Xor, ,+,R16) RasterLoop(Pat,Xor, ,+,R17) RasterLoop(And,Xor, ,+,R18) RasterLoop(Or,Xor, ,+,R19) RasterLoop(Xor,Xor, ,+,R20) RasterLoop(Src,Cand, ,+,R21) RasterLoop(Pat,Cand, ,+,R22) RasterLoop(And,Cand, ,+,R23) RasterLoop(Or,Cand, ,+,R24) RasterLoop(Xor,Cand, ,+,R25) #endif RasterLoop(Src,Src,-, ,R26) #ifndef SMALLROP RasterLoop(And,Src,-, ,R27) RasterLoop(Or,Src,-, ,R28) RasterLoop(Xor,Src,-, ,R29) RasterLoop(Src,And,-, ,R30) RasterLoop(And,And,-, ,R31) RasterLoop(Or,And,-, ,R32) RasterLoop(Xor,And,-, ,R33) RasterLoop(Src,Or,-, ,R34) RasterLoop(And,Or,-, ,R35) RasterLoop(Or,Or,-, ,R36) RasterLoop(Xor,Or,-, ,R37) RasterLoop(Src,Xor,-, ,R38) RasterLoop(And,Xor,-, ,R39) RasterLoop(Or,Xor,-, ,R40) RasterLoop(Xor,Xor,-, ,R41) RasterLoop(Src,Cand,-, ,R42) RasterLoop(And,Cand,-, ,R43) RasterLoop(Or,Cand,-, ,R44) RasterLoop(Xor,Cand,-, ,R45) #endif 0707070000020026731006660001460001440000010324270352172546700001300000000745showdate.c/* Convergent Technologies - System V - Aug 1983 */ /* static char Showdate_c[] = "@(#)showdate.c 1.4"; */ /* * This code can be called from main() on each boot to show * the date that the system was build and the directory it * was built in. * * The date-pwd string is updated by ../Makefile everytime that Unix is * relinked, and this file recompiled. */ static char *date = DATE; static char *pwd = PWD; showdatepwd() { printf("\nBuilt:%s in directory %s\n", date, pwd); } 0707070000020026741006660001460001440000010324300352172547000001200000007657sprintf.c/* Convergent Technologies - System V - Jul 1983 */ /*static char sprintf_c[] = "@(#)sprintf.c 1.1";*/ /* sprintf, simple/portable version. * adapted from printf by Tom Faulhaber SAW 6/79 * * Must be linked wih original printf for argument pickup functions. * * Escape sequences implemented: * %nd 1-prec decimal, signed * %nD 2-prec decimal, signed * %no 1-prec octal, unsigned * %n) 2-prec octal, unsigned * %nx 1-prec hex, unsigned * %nX 2-prec hex, unsigned * %ns string * %c character * %% percent * * in above, "n" can be an integer arg or "v", whence field width comes * from arg list. */ #define ESC '%' #include "diag.h" extern RdArg(),putn2(); extern msglevel_t MsgLevel; static char *bc; /* buffer pointer character */ sputnum(val,fmt,radix,sign) register int val; { char digbuf[100], negflag = 0; int ndig = 0, spaces = fmt; if (sign && val<0) { if ((val = -val) < 0) val = 0; negflag++; } switch (radix) { case 10: ndig = putn2( (long) val,digbuf); break; case 16: do { digbuf[ndig++] = val & 0XFL; val = (val >> 4) & 0X0FFFFFFF; } while (val); break; case 8: do { digbuf[ndig++] = val & 0X7L; val = (val >> 3) & 0X1FFFFFFF; } while (val); break; case 2: do { digbuf[ndig++] = val & 0X1L; val = (val >> 1) & 0X7FFFFFFF; } while (val); break; } spaces = fmt-ndig-negflag; if (sign) while (spaces-- > 0) *bc++ = (' '); else while (spaces-- > 0) *bc++ = ('0'); if (negflag) *bc++ = ('-'); while (ndig) { if ((spaces = digbuf[--ndig]) >= 10) spaces += 'A'-'0'-10; *bc++ = (spaces + '0'); }} sputstring(str,fmt) register char *str; register int fmt; { while (*str && fmt--) *bc++ = (*str++); while (fmt-- > 0) *bc++ = (' '); } /*VARARGS2*/ sprintf(buf,ctl,args) char *buf; char *ctl; { register int *argp = &args; register char *cc = ctl; register int ch; int Arg1, Arg2; if (ctl == 0) return; bc = buf; while (ch = *cc++) { if (ch != ESC) { *bc++ = (ch); continue; } Arg1 = -1; Arg2 = -1; if (((ch = *cc++) >= '0' && ch <= '9') || (ch == 'v')) { if (ch == 'v') Arg1 = *argp++; else cc = (char *) RdArg(--cc,&Arg1); if ((ch = *cc++) == '.') { if (*cc == 'v') { Arg2 = *argp++; cc++; } else cc = (char *) RdArg(cc,&Arg2); ch = *cc++; }} switch (ch) { case ESC: *bc++ = (ESC); break; case 0: *bc++ = (ESC); *bc++ = '\0'; return; case 'D': case 'd': sputnum(*argp++,Arg1,10,1); break; case 'O': case 'o': sputnum(*argp++,Arg1,8,0); break; case 'X': case 'x': sputnum(*argp++,Arg1,16,0); break; case 'c': *bc++ = (*argp++); break; case 's': sputstring((char *)*argp++,Arg1); break; default: *bc++ = (ESC); *bc++ = (ch); break; } } *bc++ = '\0'; } /*VARARGS2*/ lsprintf(lvl,buf,ctl,args) msglevel_t lvl; char *buf; char *ctl; { register int *argp = &args; register char *cc = ctl; register int ch; int Arg1, Arg2; if (ctl == 0) return; bc = buf; while (ch = *cc++) { if (ch != ESC) { if (lvl <= MsgLevel) *bc++ = (ch); continue; } Arg1 = -1; Arg2 = -1; if (((ch = *cc++) >= '0' && ch <= '9') || (ch == 'v')) { if (ch == 'v') Arg1 = *argp++; else cc = (char *) RdArg(--cc,&Arg1); if ((ch = *cc++) == '.') { if (*cc == 'v') { Arg2 = *argp++; cc++; } else cc = (char *) RdArg(cc,&Arg2); ch = *cc++; }} if (lvl <= MsgLevel) { switch (ch) { case ESC: *bc++ = (ESC); break; case 0: *bc++ = (ESC); *bc++ = '\0'; return; case 'D': case 'd': sputnum(*argp++,Arg1,10,1); break; case 'O': case 'o': sputnum(*argp++,Arg1,8,0); break; case 'X': case 'x': sputnum(*argp++,Arg1,16,0); break; case 'c': *bc++ = (*argp++); break; case 's': sputstring((char *)*argp++,Arg1); break; default: *bc++ = (ESC); *bc++ = (ch); break; } } else { switch (ch) { case ESC: break; case 0: return; case 'D': case 'd': case 'O': case 'o': case 'X': case 'x': case 'c': *argp++; break; case 's': *argp++; break; default: break; } } } *bc++ = '\0'; } 0707070000020026751006660001460001440000010324350352172547100000700000017734trap.c/* Convergent Technologies - System V - Jul 1983 */ #include #include "sys/hardware.h" #include "sys/iohw.h" #include "sys/pte.h" #include "sys/gdisk.h" #include "sys/dialer.h" #include "diag.h" extern ushort mcr_save; extern BOOLEAN fPFTest, fPROTest,fBUSERR ; extern BOOLEAN fFClkTest, fSClkTest, fFClkInt, fSClkInt; extern BOOLEAN fDSKTest; extern BOOLEAN fDSKPFTest, fDSKPFInt; extern BOOLEAN fParErr, fParTest; extern ushort *pReg; extern unsigned char fLPTest; extern unsigned char LPFint; extern unsigned char HDFint,FDFint; extern ushort Disk_status,HDisk_err; extern int LPCount; extern ushort LPChar; extern BOOLEAN fCLign, fCLrcv; extern int CurSubtest; extern int sec,hertz; extern int UIE_addr; extern ushort ParBSR0, ParBSR1; extern ushort PROTBSR0,PROTBSR1,PROTGSR; extern char ComBuf[]; extern char *pDoubleB; extern char *pPErr0, *pPErr1, *pPErr2, *pPErr3, *pPEErr1, *pPEErr2, *pPEErr3; extern char *pPFErr3; extern char *pPFErr1, *pPFErr2, *pPFErr3, *pPFEErr1, *pPFEErr2, *pPFEErr3; extern char *pIntStray, *pTrapError, *pNMIStray, *pBusStrayInt, *pStrayStatus; extern char *pUIEerr0, *pUIEerr1, *pUIEerr2, *pUIEerr3; extern char *pPrErr5; extern char *pSpurInt; extern char *pTrapdb; extern ushort *pMapKeep, mapKeep; ushort GSR, BSR0, BSR1; /* the appropriate processor registers are loaded to these on every NMI or BusERR */ extern unsigned char P2_P3 ; extern unsigned char putc; extern char fAnswer,Ringing; /* Tape driver data */ extern BOOLEAN TapePresent; extern struct tcdi tpcmd; StrayInt(type,reg) ushort type; int *reg; { sprintf(ComBuf,pIntStray, type, reg[PC], reg[RPS],GSR,BSR0,BSR1); error(ComBuf,CurSubtest,ComBuf); } TrapError(type,reg) ushort type; int *reg; { sprintf(ComBuf,pTrapError,ComBuf,type, reg[PC], reg[RPS],GSR,BSR0,BSR1); error(ComBuf,CurSubtest,ComBuf); } trap(type, regs) ushort type; int regs; { int *reg; ushort lpstatus; reg = ®s; GSR = *GSR_ADDR; BSR0 = *BSR0_ADDR; BSR1 = *BSR1_ADDR; lpstatus = *LP_STATUS_ADDR; /* Save the Parity status before it is cleared by the next instruction */ *CSR_ADDR = 0; #ifdef DEBUG if( type != 30 ) printf(pTrapdb, type, GSR, BSR0, BSR1); if (type == 26) printf(pTrapdb, type, GSR, BSR0, BSR1); #endif switch(type) { case 2: /* --------------------------------------------------------- | Bus error. | --------------------------------------------------------- */ if( fPROTest || fPFTest ) { ProtCheck(type,reg); return; } sprintf(ComBuf,pBusStrayInt); TrapError(type,reg); return; case 30:/* --------------------------------------------------------- | Autovector for interrupt level 6 | | | | - Slow clock, or 60 hz interval timer. | --------------------------------------------------------- */ *MCR_ADDR = mcr_save |= 0x8000; *MCR_ADDR = mcr_save &= 0x7fff; *MCR_ADDR = mcr_save |= 0x8000; if (fSClkTest) { fSClkInt = TRUE; if (--hertz == 0) { hertz = 60; --sec; } } return; case 31:/* --------------------------------------------------------- | Autovector for interrupt level 7 | | | | - NON-MASKABLE INTERRUPT. | --------------------------------------------------------- */ if( ( ( lpstatus & PARITY_ERR ) != 0 ) && /* no parity error */ ( ( ( GSR & NPC_CYCLE ) == 0 ) || /* no DMA */ ( ( BSR0 & MMU_ERR ) == 1 ) /* no MMU */ ) ) { printf(pSpurInt, type, reg[PC], reg[RPS],GSR,BSR0,BSR1); return; } if (fParTest) { if (( lpstatus & (ushort)PARITY_ERR) == 0) {/* printf("parity error detected");*/ fParErr = TRUE; ParBSR0 = BSR0; ParBSR1 = BSR1; *PE_INT_GCR_ADDR = PE_INT_DISABLE; return; } *PE_INT_GCR_ADDR = PE_INT_DISABLE; } #ifdef LATER if (fDSKPFTest) { fDSKPFInt = TRUE; ParBSR0 = BSR0; ParBSR1 = BSR1; return; } #endif sprintf(ComBuf,pNMIStray, reg[PC], reg[RPS], GSR, BSR0, BSR1); error(ComBuf,CurSubtest,ComBuf); *SYSERR_GCR_ADDR = SYSERR_ENABLE; return; case 32: /* ------------------------------------------------- | Trap #0 | ------------------------------------------------- */ #ifdef DEBUG printf("Trap 0, PC = %x, RPS = %x\r\n", reg[PC], reg[RPS]); #endif reg[RPS] |= S_SUPV; return; default: /* ------------------------------------------------- | All other exceptions | ------------------------------------------------- */ StrayInt(type,reg); /* display stray interrupt message + regs */ return; } } /**************************************************************************** busaddr - Save the info from a bus or address error. ****************************************************************************/ struct { short r_fcode; long r_aaddr; short r_ireg; } br; busaddr(frame) struct { long regs[4]; /* d0,d1,a0,a1 */ short fcode; long aaddr; short ireg; } frame; { br.r_fcode = frame.fcode; br.r_aaddr = frame.aaddr; br.r_ireg = frame.ireg; } ProtCheck(type,reg) ushort type; int *reg; { if( fBUSERR ) { sprintf(ComBuf,pDoubleB); fBUSERR = FALSE; TrapError(type,reg); return; } fBUSERR = TRUE; PROTGSR = GSR; PROTBSR0 = BSR0; PROTBSR1 = BSR1; if( fPFTest ) { *pMapKeep = mapKeep; return; } if( fPROTest ) { RetrvStk(); return; } } IntLevel(type, regs) ushort type; int regs; { int *reg; ushort lpstatus; reg = ®s; #ifdef DEBUG if( type != 30 ) printf(pTrapdb, type, GSR, BSR0, BSR1); if (type == 26) printf(pTrapdb, type, GSR, BSR0, BSR1); #endif switch(type) { case 25:/* -------------------------------------------------------- | Expansion interrupt level 1 | | Tape drive interrupt | -------------------------------------------------------- */ if( TapePresent ) { TapeIntHandler( &tpcmd ); return; } StrayInt(type,reg); return; case 26:/* --------------------------------------------------------- | Autovector interrupt level 2 | | FD,HD,LP interrupt | --------------------------------------------------------- */ FDHDDMA( type,reg ); return; case 27:/* --------------------------------------------------------- | Autovector interrupt level 3 | | Keyboard interrupt | --------------------------------------------------------- */ KbdInt(); return; case 30:/* --------------------------------------------------------- | Autovector for interrupt level 6 | | | | - Slow clock, or 60 hz interval timer. | --------------------------------------------------------- */ HzInt(); return; default: /* ------------------------------------------------- | All other exceptions | ------------------------------------------------- */ StrayInt(type,reg); /* display stray interrupt message + regs */ return; } } /* --------------------------------------------------------- | Keyboard handler | --------------------------------------------------------- */ KbdInt() { klow( (unsigned char)(*C_DATA_ADDR >> 8) ); } /* --------------------------------------------------------- | Interrupt handler for HD,FD(for P2) and LP(for P3) | | LP interrupt is for printing test | --------------------------------------------------------- */ FDHDDMA(type,reg) ushort type; int *reg; { ushort i; if ( *LP_STATUS_ADDR & HDINTRQ ) /* HD interrupt */ { HDFint = 0xff; Disk_status = HD_BASE[ H_STATUSREG ]; HDisk_err = HD_BASE[ H_ERRFLAGS ]; } else if ( *LP_STATUS_ADDR & FDINTRQ ) /* FD interrupt */ { FDFint = 0xff; Disk_status = FD_BASE[ F_STATUSREG ]; } else if ( (*GSR_ADDR & 0x800) && (!P2_P3) )/* LP interrupt */ { LPFint = 0xff; /* interrupt software flag */ *LP_DATA_ADDR = 0; /* deassert interrupt */ } else { sprintf(ComBuf,pSpurInt, type, reg[PC], reg[RPS],GSR,BSR0,BSR1); error(ComBuf,CurSubtest,ComBuf); } } HzInt() { *MCR_ADDR = mcr_save |= 0x8000; *MCR_ADDR = mcr_save &= 0x7fff; *MCR_ADDR = mcr_save |= 0x8000; if ( fAnswer ) if( !(*TEL_STATUSREG & LINE1_RING) || !(*TEL_STATUSREG & LINE2_RING)) Ringing = 1; if ( !putc ) cursor_blink(); krepeat(); } 0707070000020026761006660001460001440000010324450352172547300001200000000477version.c/* Convergent Technologies - System V - Jul 1983 */ static char version_c[] = "@(#)version.c 1.1"; #include "diag.h" #ifndef DVER #define DVER 00 #endif extern char *pHeader; extern unsigned char P2_P3; Identify() { lprintf(ALL_MSG,"\n\t\t%s%d.0\n", pHeader , DVER); } Version() { Identify(); showdatepwd(); } 0707070000020027001006660001460001440000010324460352172547400000600000005116vid.c#include "sys/wd.h" #include "diag.h" #define VIDSTART 0x420000 #define VIDEND 0x427fff extern struct fntdef font; extern unsigned short *syspat[]; int vx = 0; unsigned char putc = 0x0; /* putc = 0xff if putting char on screen */ BOOLEAN crs_on = TRUE; #define MAXSUBTEST 8 #define band(b) ((unsigned char)((b) & 0xFF)) #define wand(w) ((unsigned short)((w) & 0xFFFF)) ushort two_exponent(); vidregs() { char putcsave; putcsave = putc; putc = 0xff; EAddrTest((int)VIDSTART,(int)VIDEND); ERand((int)VIDSTART,(int)VIDEND); putc = putcsave; } vidblack() { fillpattern(0,0,0,0); } vidwhite() { fillpattern(0xFF,0xFF,0xFF,0xFF); } vidgrey() { fillpattern(0xAA,0x55,0xAA,0x55); } vidhatch() { fillpattern(0xFF,0x80,0x80,0x80); } vidvert() { fillpattern(0x80,0x80,0x80,0x80); } vidhorz() { fillpattern(0xFF,0,0,0); } fillpattern(r1,r2,r3,r4) unsigned char r1,r2,r3,r4; { register unsigned char r, *cp = (unsigned char *)VIDMEM; register short col; short row; char putcsave; putcsave = putc; putc = 0xff; for (row=0 ; rowfc_mr)) + fc->fc_mr, 2*((fc->fc_hs+15)>>4), VIDMEM, VIDBYTES, 0,0, x + fc->fc_ha, y + fc->fc_va, fc->fc_hs,fc->fc_vs, SRCSRC, DSTSRC, 0 ); } vputc(c) unsigned char c; { unsigned char cc; char putcsave; cc = ' '; /* erases curor first */ putcsave = putc; putc = 0xff; if ( crs_on ) { vputxy(vx,VIDHEIGHT-font.ff_vs,&font.ff_fc[cc-FNTBASE]); crs_on = (BOOLEAN) ! crs_on; } if ( c == '\r' ) { vx = 0; } else if ( c == '\n' ) { vscroll(); } else if ( c == 010 ) { if ( vx >= font.ff_hs ) vx -= font.ff_hs; } else if ( c >=' ' && c <= '~' ) { vputxy(vx,VIDHEIGHT-font.ff_vs,&font.ff_fc[c-FNTBASE]); vx += font.ff_hs; if ( vx + font.ff_hs > VIDWIDTH ) { vx = 0; vscroll(); } } putc = putcsave; } vscroll() { rastop(VIDMEM,VIDBYTES,VIDMEM,VIDBYTES, 0,font.ff_vs, 0,0, VIDWIDTH, VIDHEIGHT-font.ff_vs, SRCSRC, DSTSRC, 0 ); rastop(VIDMEM,VIDBYTES,VIDMEM,VIDBYTES, 0,0, 0, VIDHEIGHT-font.ff_vs, VIDWIDTH, font.ff_vs, SRCPAT, DSTSRC, syspat[PATBLACK] ); } cursor_blink() { static short crs = 10; char c; crs--; if ( crs ) return; crs = 10; crs_on = (BOOLEAN) !crs_on; if ( crs_on ) c = '_'; if ( !crs_on) c = ' '; vputxy(vx,VIDHEIGHT-font.ff_vs,&font.ff_fc[c-FNTBASE]); } 0707070000020027461007770001460001440000010327320353675334700001100000000045MAKEflopcat Files | cpio -ocBv > /dev/rfp021 0707070000020027621007770001460001440000010327370353675340500001100000000044MAKEcpiocat Files | cpio -ocBv > IHVDIAG+IN 0707070000020027621007770001460001440000010327370353675340500001300000000000TRAILER!!!t.ff_fc[cc-FNTBASE]); crs_on = (BOOLEAN) ! crs_on; } if ( c == '\r' ) { vx = 0; } else if ( c == '\n' ) { vscroll(); } else if ( c == 010 ) { if ( vx >= font.ff_hs ) vx -= font.ff_hs; } else if ( c >=' ' && c <= '~' ) { vputxy(vx,VIDHEIGHT-font.ff_vs,&font.ff_fc[c-FNTBASE]); vx += font.ff_hs; if ( vx + font.ff_hs > VIDWIDTH ) { vx = 0; vscroll(); } } putc = putcsave; } vscroll() { rastop(VIDMEM,VIDBYTES,VIDMEM,VIDBYTES, 0,font.ff_vs, 0,0, VIDWIDTH, VIDHEIGHT-font.ff_vs, SRCSRC, DSTSRC, 0 ); rastop(VIDMEM,VIDBYTES,VIDMEM,VIDBYTES, 0,0, 0, VIDHEIGHT-font.ff_vs, VIDWIDTH, font.ff_vs, SRCPAT, DSTSRC, syspat[PATBLACK] ); } cursor_blink() { static short crs = 10; char c; crs--; if ( crs ) return; crs = 10; crs_on = (BOOLEAN) !crs_on; if ( crs_on ) c = '_'; if ( !crs_on) c = ' '; vputxy(vx,VIDHEIGHT-font.ff_vs,&font.ff_fc[c-FNTBASE]); } 0707070000020027461007770001460001440000010327320353675334700001100000000045MAKEflopcat Files | cpio -ocBv > /dev/rfp021 0707070000020027621007770001460001440000010327370353675340500001100000000044MAKEcpiocat Files | cpio -ocBv > IHVDIAG+IN 0707070000020027621007770001460001440000010327370353675340500001300000000000TRAILER!!!t.ff_fc[cc-FNTBASE]); crs_on = (BOOLEAN) ! crs_on; } if ( c == '\r' ) { vx = 0; } else if ( c == '\n' ) { vscroll(); } else if ( c == 010 ) { if ( vx >= font.ff_hs ) vx -= font.ff_hs; } else if ( c >=' ' && c <= '~' ) { vputxy(vx,VIDHEIGHT-font.ff_vs,&font.ff_fc[c-FNTBASE]); vx += font.ff_hs; if ( vx + font.ff_hs > VIDWIDTH ) { vx = 0; vscroll(); } } putc = putcsave; } vscroll() { rastop(VIDMEM,VIDBYTES,VIDMEM,VIDBYTES, 0,font.ff_vs, 0,0, VIDWIDTH, VIDHEIGHT-font.ff_vs, SRCSRC, DSTSRC, 0 ); rastop(VIDMEM,VIDBYTES,VIDMEM,VIDBYTES, 0,0, 0, VIDHEIGHT-font.ff_vs, VIDWIDTH, font.ff_vs, SRCPAT, DSTSRC, syspat[PATBLACK] ); } cursor_blink() { static short crs = 10; char c; crs--; if ( crs ) return; crs = 10; crs_on = (BOOLEAN) !crs_on; if ( crs_on ) c = '_'; if ( !crs_on) c = ' '; vputxy(vx,VIDHEIGHT-font.ff_vs,&font.ff_fc[c-FNTBASE]); } 0707070000020027461007770001460001440000010327320353675334700001100000000045MAKEflopcat Files | cpio -ocBv > /dev/rfp021 0707070000020027621007770001460001440000010327370353675340500001100000000044MAKEcpiocat Files | cpio -ocBv > IHVDIAG+IN 0707070000020027621007770001460001440000010327370353675340500001300000000000TRAILER!!!t.ff_fc[cc-FNTBASE]); crs_on = (BOOLEAN) ! crs_on; } if ( c == '\r' ) { vx = 0; } else if ( c == '\n' ) { vscroll(); } else if ( c == 010 ) { if ( vx >= font.ff_hs ) vx -= font.ff_hs; } else if ( c >=' ' && c <= '~' ) { vputxy(vx,VIDHEIGHT-font.ff_vs,&font.ff_fc[c-FNTBASE]); vx += font.ff_hs; if ( vx + font.ff_hs > VIDWIDTH ) { vx = 0; vscroll(); } } putc = putcsave; } vscroll() { rastop(VIDMEM,VIDBYTES,VIDMEM,VIDBYTES, 0,font.ff_vs, 0,0, VIDWIDTH, VIDHEIGHT-font.ff_vs, SRCSRC, DSTSRC, 0 ); rastop(VIDMEM,VIDBYTES,VIDMEM,VIDBYTES, 0,0, 0, VIDHEIGHT-font.ff_vs, VIDWIDTH, font.ff_vs, SRCPAT, DSTSRC, syspat[PATBLACK] ); } cursor_blink() { static short crs = 10; char c; crs--; if ( crs ) return; crs = 10; crs_on = (BOOLEAN) !crs_on; if ( crs_on ) c = '_'; if ( !crs_on) c = ' '; vputxy(vx,VIDHEIGHT-font.ff_vs,&font.ff_fc[c-FNTBASE]); } 0707070000020027461007770001460001440000010327320353675334700001100000000045MAKEflopcat Files | cpio -ocBv > /dev/rfp021 0707070000020027621007770001460001440000010327370353675340500001100000000044MAKEcpiocat Files | cpio -ocBv > IHVDIAG+IN 0707070000020027621007770001460001440000010327370353675340500001300000000000TRAILER!!!t.ff_fc[cc-FNTBASE]); crs_on = (BOOLEAN) ! crs_on; } if ( c == '\r' ) { vx = 0; } else if ( c == '\n' ) { vscroll(); } else if ( c ==