Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mcvax!botter!ast From: ast@cs.vu.nl (Andy Tanenbaum) Newsgroups: comp.os.minix Subject: Definitive MINIX 1.2 updates (Part 3 of 4) Message-ID: <1564@botter.cs.vu.nl> Date: Sun, 9-Aug-87 17:55:13 EDT Article-I.D.: botter.1564 Posted: Sun Aug 9 17:55:13 1987 Date-Received: Tue, 11-Aug-87 00:45:43 EDT Reply-To: ast@cs.vu.nl (Andy Tanenbaum) Distribution: world Organization: VU Informatica, Amsterdam Lines: 878 : This is a shar archive. Extract with sh, not csh. : This archive ends with exit, so do not worry about trailing junk. : --------------------------- cut here -------------------------- PATH=/bin:/usr/bin echo Extracting \c\r\y\p\t\.\c sed 's/^X//' > \c\r\y\p\t\.\c << '+ END-OF-FILE '\c\r\y\p\t\.\c X/* From Andy Tanenbaum's book "Computer Networks", X rewritten in C X*/ X Xstruct block { X unsigned char b_data[64]; X}; X Xstruct ordering { X unsigned char o_data[64]; X}; X Xstatic struct block key; X Xstatic struct ordering InitialTr = { X 58,50,42,34,26,18,10, 2,60,52,44,36,28,20,12, 4, X 62,54,46,38,30,22,14, 6,64,56,48,40,32,24,16, 8, X 57,49,41,33,25,17, 9, 1,59,51,43,35,27,19,11, 3, X 61,53,45,37,29,21,13, 5,63,55,47,39,31,23,15, 7, X}; X Xstatic struct ordering FinalTr = { X 40, 8,48,16,56,24,64,32,39, 7,47,15,55,23,63,31, X 38, 6,46,14,54,22,62,30,37, 5,45,13,53,21,61,29, X 36, 4,44,12,52,20,60,28,35, 3,43,11,51,19,59,27, X 34, 2,42,10,50,18,58,26,33, 1,41, 9,49,17,57,25, X}; X Xstatic struct ordering swap = { X 33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48, X 49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64, X 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16, X 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32, X}; X Xstatic struct ordering KeyTr1 = { X 57,49,41,33,25,17, 9, 1,58,50,42,34,26,18, X 10, 2,59,51,43,35,27,19,11, 3,60,52,44,36, X 63,55,47,39,31,23,15, 7,62,54,46,38,30,22, X 14, 6,61,53,45,37,29,21,13, 5,28,20,12, 4, X}; X Xstatic struct ordering KeyTr2 = { X 14,17,11,24, 1, 5, 3,28,15, 6,21,10, X 23,19,12, 4,26, 8,16, 7,27,20,13, 2, X 41,52,31,37,47,55,30,40,51,45,33,48, X 44,49,39,56,34,53,46,42,50,36,29,32, X}; X Xstatic struct ordering etr = { X 32, 1, 2, 3, 4, 5, 4, 5, 6, 7, 8, 9, X 8, 9,10,11,12,13,12,13,14,15,16,17, X 16,17,18,19,20,21,20,21,22,23,24,25, X 24,25,26,27,28,29,28,29,30,31,32, 1, X}; X Xstatic struct ordering ptr = { X 16, 7,20,21,29,12,28,17, 1,15,23,26, 5,18,31,10, X 2, 8,24,14,32,27, 3, 9,19,13,30, 6,22,11, 4,25, X}; X Xstatic unsigned char s_boxes[8][64] = { X{ 14, 4,13, 1, 2,15,11, 8, 3,10, 6,12, 5, 9, 0, 7, X 0,15, 7, 4,14, 2,13, 1,10, 6,12,11, 9, 5, 3, 8, X 4, 1,14, 8,13, 6, 2,11,15,12, 9, 7, 3,10, 5, 0, X 15,12, 8, 2, 4, 9, 1, 7, 5,11, 3,14,10, 0, 6,13, X}, X X{ 15, 1, 8,14, 6,11, 3, 4, 9, 7, 2,13,12, 0, 5,10, X 3,13, 4, 7,15, 2, 8,14,12, 0, 1,10, 6, 9,11, 5, X 0,14, 7,11,10, 4,13, 1, 5, 8,12, 6, 9, 3, 2,15, X 13, 8,10, 1, 3,15, 4, 2,11, 6, 7,12, 0, 5,14, 9, X}, X X{ 10, 0, 9,14, 6, 3,15, 5, 1,13,12, 7,11, 4, 2, 8, X 13, 7, 0, 9, 3, 4, 6,10, 2, 8, 5,14,12,11,15, 1, X 13, 6, 4, 9, 8,15, 3, 0,11, 1, 2,12, 5,10,14, 7, X 1,10,13, 0, 6, 9, 8, 7, 4,15,14, 3,11, 5, 2,12, X}, X X{ 7,13,14, 3, 0, 6, 9,10, 1, 2, 8, 5,11,12, 4,15, X 13, 8,11, 5, 6,15, 0, 3, 4, 7, 2,12, 1,10,14, 9, X 10, 6, 9, 0,12,11, 7,13,15, 1, 3,14, 5, 2, 8, 4, X 3,15, 0, 6,10, 1,13, 8, 9, 4, 5,11,12, 7, 2,14, X}, X X{ 2,12, 4, 1, 7,10,11, 6, 8, 5, 3,15,13, 0,14, 9, X 14,11, 2,12, 4, 7,13, 1, 5, 0,15,10, 3, 9, 8, 6, X 4, 2, 1,11,10,13, 7, 8,15, 9,12, 5, 6, 3, 0,14, X 11, 8,12, 7, 1,14, 2,13, 6,15, 0, 9,10, 4, 5, 3, X}, X X{ 12, 1,10,15, 9, 2, 6, 8, 0,13, 3, 4,14, 7, 5,11, X 10,15, 4, 2, 7,12, 9, 5, 6, 1,13,14, 0,11, 3, 8, X 9,14,15, 5, 2, 8,12, 3, 7, 0, 4,10, 1,13,11, 6, X 4, 3, 2,12, 9, 5,15,10,11,14, 1, 7, 6, 0, 8,13, X}, X X{ 4,11, 2,14,15, 0, 8,13, 3,12, 9, 7, 5,10, 6, 1, X 13, 0,11, 7, 4, 9, 1,10,14, 3, 5,12, 2,15, 8, 6, X 1, 4,11,13,12, 3, 7,14,10,15, 6, 8, 0, 5, 9, 2, X 6,11,13, 8, 1, 4,10, 7, 9, 5, 0,15,14, 2, 3,12, X}, X X{ 13, 2, 8, 4, 6,15,11, 1,10, 9, 3,14, 5, 0,12, 7, X 1,15,13, 8,10, 3, 7, 4,12, 5, 6,11, 0,14, 9, 2, X 7,11, 4, 1, 9,12,14, 2, 0, 6,10,13,15, 3, 5, 8, X 2, 1,14, 7, 4,10, 8,13,15,12, 9, 0, 3, 5, 6,11, X}, X}; X Xstatic int rots[] = { X 1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1, X}; X Xstatic Xtranspose(data, t, n) X register struct block *data; X register struct ordering *t; X register int n; X{ X struct block x; X X x = *data; X X while (n-- > 0) { X data->b_data[n] = x.b_data[t->o_data[n] - 1]; X } X} X Xstatic Xrotate(key) X register struct block *key; X{ X register unsigned char *p = key->b_data; X register unsigned char *ep = &(key->b_data[55]); X int data0 = key->b_data[0], data28 = key->b_data[28]; X X while (p++ < ep) *(p-1) = *p; X key->b_data[27] = data0; X key->b_data[55] = data28; X} X Xstatic struct ordering *EP = &etr; X Xstatic Xf(i, key, a, x) X struct block *key, *a; X register struct block *x; X{ X struct block e, ikey, y; X int k; X register unsigned char *p, *q, *r; X X e = *a; X transpose(&e, EP, 48); X for (k = rots[i]; k; k--) rotate(key); X ikey = *key; X transpose(&ikey, &KeyTr2, 48); X p = &(y.b_data[48]); X q = &(e.b_data[48]); X r = &(ikey.b_data[48]); X while (p > y.b_data) { X *--p = *--q ^ *--r; X } X q = x->b_data; X for (k = 0; k < 8; k++) { X register int xb, r; X X r = *p++ << 5; X r += *p++ << 3; X r += *p++ << 2; X r += *p++ << 1; X r += *p++; X r += *p++ << 4; X X xb = s_boxes[k][r]; X X *q++ = (xb >> 3) & 1; X *q++ = (xb>>2) & 1; X *q++ = (xb>>1) & 1; X *q++ = (xb & 1); X } X transpose(x, &ptr, 32); X} X Xsetkey(k) X register char *k; X{ X X key = *((struct block *) k); X transpose(&key, &KeyTr1, 56); X} X Xencrypt(blck, edflag) X char *blck; X{ X register struct block *p = (struct block *) blck; X register int i; X X transpose(p, &InitialTr, 64); X for (i = 15; i>= 0; i--) { X int j = edflag ? i : 15 - i; X register int k; X struct block b, x; X X b = *p; X for (k = 31; k >= 0; k--) { X p->b_data[k] = b.b_data[k + 32]; X } X f(j, &key, p, &x); X for (k = 31; k >= 0; k--) { X p->b_data[k+32] = b.b_data[k] ^ x.b_data[k]; X } X } X transpose(p, &swap, 64); X transpose(p, &FinalTr, 64); X} X Xchar * Xcrypt(pw,salt) X register char *pw; X char *salt; X{ X /* Unfortunately, I had to look at the sources of V7 crypt. X There was no other way to find out what this routine X actually does. X */ X X char pwb[66]; X static char result[16]; X register char *p = pwb; X struct ordering new_etr; X register int i; X X while (*pw && p < &pwb[64]) { X register int j = 7; X X while (j--) { X *p++ = (*pw >> j) & 01; X } X pw++; X *p++ = 0; X } X while (p < &pwb[64]) *p++ = 0; X X setkey(p = pwb); X X while (p < &pwb[66]) *p++ = 0; X X new_etr = etr; X EP = &new_etr; X for (i = 0; i < 2; i++) { X register char c = *salt++; X register int j; X X result[i] = c; X if ( c > 'Z') c -= 6 + 7 + '.'; /* c was a lower case letter */ X else if ( c > '9') c -= 7 + '.';/* c was upper case letter */ X else c -= '.'; /* c was digit, '.' or '/'. */ X /* now, 0 <= c <= 63 */ X for (j = 0; j < 6; j++) { X if ((c >> j) & 01) { X int t = 6*i + j; X int temp = new_etr.o_data[t]; X new_etr.o_data[t] = new_etr.o_data[t+24]; X new_etr.o_data[t+24] = temp; X } X } X } X X if (result[1] == 0) result[1] = result[0]; X X for (i = 0; i < 25; i++) encrypt(pwb,0); X EP = &etr; X X p = pwb; X pw = result+2; X while (p < &pwb[66]) { X register int c = 0; X register int j = 6; X X while (j--) { X c <<= 1; X c |= *p++; X } X c += '.'; /* becomes >= '.' */ X if (c > '9') c += 7; /* not in [./0-9], becomes upper */ X if (c > 'Z') c += 6; /* not in [A-Z], becomes lower */ X *pw++ = c; X } X *pw = 0; X return result; X} + END-OF-FILE crypt.c chmod 'u=rw,g=r,o=r' \c\r\y\p\t\.\c set `sum \c\r\y\p\t\.\c` sum=$1 case $sum in 07161) :;; *) echo 'Bad sum in '\c\r\y\p\t\.\c >&2 esac echo Extracting \f\s\:\l\i\n\k\.\c sed 's/^X//' > \f\s\:\l\i\n\k\.\c << '+ END-OF-FILE '\f\s\:\l\i\n\k\.\c X55c55,58 X< if (fetch_name(name2, name2_length, M1) != OK) return(err_code); X--- X> if (fetch_name(name2, name2_length, M1) != OK) { X> put_inode(rip); X> return(err_code); X> } + END-OF-FILE fs:link.c chmod 'u=rw,g=r,o=r' \f\s\:\l\i\n\k\.\c set `sum \f\s\:\l\i\n\k\.\c` sum=$1 case $sum in 01679) :;; *) echo 'Bad sum in '\f\s\:\l\i\n\k\.\c >&2 esac echo Extracting \f\s\:\m\i\s\c\.\c sed 's/^X//' > \f\s\:\m\i\s\c\.\c << '+ END-OF-FILE '\f\s\:\m\i\s\c\.\c X169a170,176 X> if (fp->fp_suspended == SUSPENDED) { X> if (fp->fp_task == XPIPE) susp_count--; X> pro = exitee; X> do_unpause(); X> fp->fp_suspended = NOT_SUSPENDED; X> } X> X180,185d186 X< if (fp->fp_suspended == SUSPENDED) { X< if (fp->fp_task == XPIPE) susp_count--; X< pro = exitee; X< do_unpause(); X< fp->fp_suspended = NOT_SUSPENDED; X< } + END-OF-FILE fs:misc.c chmod 'u=rw,g=r,o=r' \f\s\:\m\i\s\c\.\c set `sum \f\s\:\m\i\s\c\.\c` sum=$1 case $sum in 05012) :;; *) echo 'Bad sum in '\f\s\:\m\i\s\c\.\c >&2 esac echo Extracting \f\s\:\p\i\p\e\.\c sed 's/^X//' > \f\s\:\p\i\p\e\.\c << '+ END-OF-FILE '\f\s\:\p\i\p\e\.\c X201c201 X< if (rfp->fp_suspended == NOT_SUSPENDED) return; X--- X> if (rfp->fp_suspended == NOT_SUSPENDED || rfp->fp_revived == REVIVING)return; X231c231 X< int proc_nr, task; X--- X> int proc_nr, task, fild; X244c244,246 X< f = get_filp(rfp->fp_fd); X--- X> fild = (rfp->fp_fd >> 8) & BYTE; /* extract file descriptor */ X> if (fild < 0 || fild >= NR_FDS) panic("unpause err 2", NO_NUM); X> f = rfp->fp_filp[fild]; X249,252c251,254 X< if (sendrec(task, &mess) != OK) panic("unpause err 2", NO_NUM); X< while (mess.REP_PROC_NR != proc_nr) { X< revive(mess.REP_PROC_NR, mess.REP_STATUS); X< if (receive(task, &m) != OK) panic("unpause err 3", NO_NUM); X--- X> if (sendrec(task, &mess) != OK) panic("unpause err 3", NO_NUM); X> while (mess.REP_PROC_NR != proc_nr) { X> revive(mess.REP_PROC_NR, mess.REP_STATUS); X> if (receive(task, &m) != OK) panic("unpause err 4", NO_NUM); + END-OF-FILE fs:pipe.c chmod 'u=rw,g=r,o=r' \f\s\:\p\i\p\e\.\c set `sum \f\s\:\p\i\p\e\.\c` sum=$1 case $sum in 32696) :;; *) echo 'Bad sum in '\f\s\:\p\i\p\e\.\c >&2 esac echo Extracting \f\s\:\p\r\o\t\e\c\t\.\c sed 's/^X//' > \f\s\:\p\r\o\t\e\c\t\.\c << '+ END-OF-FILE '\f\s\:\p\r\o\t\e\c\t\.\c X151c151 X< if (super_user) { X--- X> if (test_uid == SU_UID) { + END-OF-FILE fs:protect.c chmod 'u=rw,g=r,o=r' \f\s\:\p\r\o\t\e\c\t\.\c set `sum \f\s\:\p\r\o\t\e\c\t\.\c` sum=$1 case $sum in 07444) :;; *) echo 'Bad sum in '\f\s\:\p\r\o\t\e\c\t\.\c >&2 esac echo Extracting \i\n\c\l\u\d\e\:\c\t\y\p\e\. sed 's/^X//' > \i\n\c\l\u\d\e\:\c\t\y\p\e\. << '+ END-OF-FILE '\i\n\c\l\u\d\e\:\c\t\y\p\e\. X21a22,24 X> X> #define toupper(c) ((c) - 'a' + 'A') X> #define tolower(c) ((c) - 'A' + 'a') + END-OF-FILE include:ctype. chmod 'u=rw,g=r,o=r' \i\n\c\l\u\d\e\:\c\t\y\p\e\. set `sum \i\n\c\l\u\d\e\:\c\t\y\p\e\.` sum=$1 case $sum in 53050) :;; *) echo 'Bad sum in '\i\n\c\l\u\d\e\:\c\t\y\p\e\. >&2 esac echo Extracting \i\n\c\l\u\d\e\:\s\t\d\i\o\. sed 's/^X//' > \i\n\c\l\u\d\e\:\s\t\d\i\o\. << '+ END-OF-FILE '\i\n\c\l\u\d\e\:\s\t\d\i\o\. X38d37 X< #define puts(s) fputs(s,stdout) + END-OF-FILE include:stdio. chmod 'u=rw,g=r,o=r' \i\n\c\l\u\d\e\:\s\t\d\i\o\. set `sum \i\n\c\l\u\d\e\:\s\t\d\i\o\.` sum=$1 case $sum in 33279) :;; *) echo 'Bad sum in '\i\n\c\l\u\d\e\:\s\t\d\i\o\. >&2 esac echo Extracting \k\e\r\n\e\l\:\f\l\o\p\p\y\. sed 's/^X//' > \k\e\r\n\e\l\:\f\l\o\p\p\y\. << '+ END-OF-FILE '\k\e\r\n\e\l\:\f\l\o\p\p\y\. X108c108 X< #define NT 4 /* number of diskette/drive combinations */ X--- X> #define NT 6 /* number of diskette/drive combinations */ X141,153c141,161 X< /* Four combinations of diskette/drive are supported: X< * # Drive diskette Sectors Tracks Rotation Data-rate Comment X< * 0 360K 360K 9 40 300 RPM 250 kbps Standard PC DSDD X< * 1 720K 360K 9 40 300 RPM 250 kbps Quad density PC X< * 2 1.2M 360K 9 40 360 RPM 300 kbps PC disk in AT drive X< * 3 1.2M 1.2M 15 80 360 RPM 500 kbps AT disk in AT drive X< */ X< PRIVATE int gap[NT] = {0x2A, 0x2A, 0x23, 0x1B}; /* gap size */ X< PRIVATE int rate[NT] = {0x02, 0x02, 0x01, 0x00}; /* 250,300,500 kbps*/ X< PRIVATE int nr_sectors[NT] = {9, 9, 9, 15}; /* sectors/track */ X< PRIVATE int nr_blocks[NT] = {720, 720, 720, 2400}; /* sectors/diskette*/ X< PRIVATE int steps_per_cyl[NT] = {1, 2, 2, 1}; /* 2 = dbl step */ X< PRIVATE int mtr_setup[NT] = {HZ/4,HZ/4,3*HZ/4,3*HZ/4};/* in ticks */ X--- X> /* Six combinations of diskette/drive are supported: X> * # Drive diskette Sectors Tracks Rotation Data-rate Comment X> * 0 360K 360K 9 40 300 RPM 250 kbps Standard PC DSDD X> * 1 1.2M 1.2M 15 80 360 RPM 500 kbps AT disk in AT drive X> * 2 720K 360K 9 40 300 RPM 250 kbps Quad density PC X> * 3 720K 720K 9 80 300 RPM 250 kbps Toshiba, et al. X> * 4 1.2M 360K 9 40 360 RPM 300 kbps PC disk in AT drive X> * 5 1.2M 720K 9 80 360 RPM 300 kbps Toshiba in AT drive X> */ X> PRIVATE int gap[NT] = X> {0x2A, 0x1B, 0x2A, 0x2A, 0x23, 0x23}; /* gap size */ X> PRIVATE int rate[NT] = X> {0x02, 0x00, 0x02, 0x02, 0x01, 0x01}; /* 250,300,500 kbps*/ X> PRIVATE int nr_sectors[NT] = X> {9, 15, 9, 9, 9, 9}; /* sectors/track */ X> PRIVATE int nr_blocks[NT] = X> {720, 2400, 720, 1440, 720, 1440}; /* sectors/diskette*/ X> PRIVATE int steps_per_cyl[NT] = X> {1, 1, 2, 1, 2, 1}; /* 2 = dbl step */ X> PRIVATE int mtr_setup[NT] = X> {HZ/4,3*HZ/4,HZ/4,HZ/4,3*HZ/4,3*HZ/4};/* in ticks */ + END-OF-FILE kernel:floppy. chmod 'u=rw,g=r,o=r' \k\e\r\n\e\l\:\f\l\o\p\p\y\. set `sum \k\e\r\n\e\l\:\f\l\o\p\p\y\.` sum=$1 case $sum in 25397) :;; *) echo 'Bad sum in '\k\e\r\n\e\l\:\f\l\o\p\p\y\. >&2 esac echo Extracting \k\e\r\n\e\l\:\k\l\i\b\8\8\. sed 's/^X//' > \k\e\r\n\e\l\:\k\l\i\b\8\8\. << '+ END-OF-FILE '\k\e\r\n\e\l\:\k\l\i\b\8\8\. X18a19,20 X> | dma_read: transfer data between HD controller and memory X> | dma_write: transfer data between memory and HD controller X23c25 X< .globl _wreboot, _portw_in, _portw_out X--- X> .globl _wreboot, _dma_read, _dma_write X215,229c217,223 X< |* portw_out * X< |*===========================================================================* X< | portw_out(port, value) writes 'value' on the I/O port 'port'. X< X< _portw_out: X< push bx | save bx X< mov bx,sp | index off bx X< push ax | save ax X< push dx | save dx X< mov dx,4(bx) | dx = port X< mov ax,6(bx) | ax = value X< outw | output 1 word X< pop dx | restore dx X< pop ax | restore ax X< pop bx | restore bx X--- X> |* lock * X> |*===========================================================================* X> | Disable CPU interrupts. X> _lock: X> pushf | save flags on stack X> cli | disable interrupts X> pop lockvar | save flags for possible restoration later X234,258c228,232 X< |* portw_in * X< |*===========================================================================* X< | portw_in(port, &value) reads from port 'port' and puts the result in 'value'. X< _portw_in: X< push bx | save bx X< mov bx,sp | index off bx X< push ax | save ax X< push dx | save dx X< mov dx,4(bx) | dx = port X< inw | input 1 word X< mov bx,6(bx) | fetch address where byte is to go X< mov (bx),ax | return byte to caller in param X< pop dx | restore dx X< pop ax | restore ax X< pop bx | restore bx X< ret | return to caller X< X< |*===========================================================================* X< |* lock * X< |*===========================================================================* X< | Disable CPU interrupts. X< _lock: X< pushf | save flags on stack X< cli | disable interrupts X< pop lockvar | save flags for possible restoration later X--- X> |* unlock * X> |*===========================================================================* X> | Enable CPU interrupts. X> _unlock: X> sti | enable interrupts X263,267c237,242 X< |* unlock * X< |*===========================================================================* X< | Enable CPU interrupts. X< _unlock: X< sti | enable interrupts X--- X> |* restore * X> |*===========================================================================* X> | Restore enable/disable bit to the value it had before last lock. X> _restore: X> push lockvar | push flags as they were before previous lock X> popf | restore flags X272,281d246 X< |* restore * X< |*===========================================================================* X< | Restore enable/disable bit to the value it had before last lock. X< _restore: X< push lockvar | push flags as they were before previous lock X< popf | restore flags X< ret | return to caller X< X< X< |*===========================================================================* X370a336,382 X> |*===========================================================================* X> |* dma_read * X> |*===========================================================================* X> _dma_read: X> push bp X> mov bp,sp X> push cx X> push dx X> push di X> push es X> mov cx,#256 | transfer 256 words X> mov dx,#0x1F0 | from/to port 1f0 X> cld X> mov es,4(bp) | segment in es X> mov di,6(bp) | offset in di X> .byte 0xF3, 0x6D | opcode for 'rep insw' X> pop es X> pop di X> pop dx X> pop dx X> mov sp,bp X> pop bp X> ret X> X> |*===========================================================================* X> |* dma_write * X> |*===========================================================================* X> _dma_write: X> push bp X> mov bp,sp X> push cx X> push dx X> push si X> push ds X> mov cx,#256 | transfer 256 words X> mov dx,#0x1F0 | from/to port 1f0 X> cld X> mov ds,4(bp) | segment in ds X> mov si,6(bp) | offset in si X> .byte 0xF3, 0x6F | opcode for 'rep outsw' X> pop ds X> pop si X> pop dx X> pop dx X> mov sp,bp X> pop bp X> ret X431c443 X< nop | 'lock' indicates a video ram access X--- X> inc vidlock | 'lock' indicates a video ram access X496c508,518 X< int 0x19 | reboot the PC X--- X> mov ax,#0x40 X> mov ds,ax X> mov ax,#0x1234 X> mov 0x72,ax X> mov ax,#0xFFFF X> mov ds,ax X> mov ax,3 X> push ax X> mov ax,1 X> push ax X> reti X505c527,537 X< int 0x19 | reboot the PC X--- X> mov ax,#0x40 X> mov ds,ax X> mov ax,#0x1234 X> mov 0x72,ax X> mov ax,#0xFFFF X> mov ds,ax X> mov ax,3 X> push ax X> mov ax,1 X> push ax X> reti X524a557 X> vidlock: .word 0 | dummy variable for use with lock prefix + END-OF-FILE kernel:klib88. chmod 'u=rw,g=r,o=r' \k\e\r\n\e\l\:\k\l\i\b\8\8\. set `sum \k\e\r\n\e\l\:\k\l\i\b\8\8\.` sum=$1 case $sum in 22765) :;; *) echo 'Bad sum in '\k\e\r\n\e\l\:\k\l\i\b\8\8\. >&2 esac echo Extracting \k\e\r\n\e\l\:\m\a\k\e\f\i\l sed 's/^X//' > \k\e\r\n\e\l\:\m\a\k\e\f\i\l << '+ END-OF-FILE '\k\e\r\n\e\l\:\m\a\k\e\f\i\l X1,3c1,7 X< # The kernel directory contains files xt_wini.c and at_wini.c. Before running X< # make you must copy one of these to wini.c, depending on whether you have a X< # PC or an AT. You must do this even if you do not have a hard disk.. X--- X> # The kernel dir contains wd_wini.c, xt_wini.c and at_wini.c. Before running X> # make you must copy one of these to wini.c, depending on which controller you X> # have. If you do not have a hard disk, you MUST choose one of them at random. X> # On a PC, cpp and cem are in /lib and will be removed to make space while X> # linking the kernel. On an AT, they are in /usr/lib are are not removed. X> # This is because they have to be in /lib on a PC; the diskette is too small X> # for them to be in /usr/lib. X8c12 X< obj = mpx88.s main.s proc.s system.s tty.s clock.s memory.s floppy.s wini.s \ X--- X> obj = mpx88.s main.s tty.s floppy.s wini.s system.s proc.s clock.s memory.s \ X12,15c16,21 X< @echo "Start linking Kernel. /lib/cem will be removed to make space on RAM disk" X< @rm -f /lib/cem /tmp/* X< @asld -o kernel $(obj) $l/libc.a $l/end.s X< @echo "Kernel done. Please restore /lib/cem manually" X--- X> @echo "Start linking Kernel." X> @echo "On a PC, /lib/* will be removed to make space on RAM disk" X> @echo "If linking fails due to lack of space on 2/1, rm xx_wini.c" X> @rm -f /lib/cem /lib/cpp /tmp/* X> @asld -o kernel $(obj) $l/libc.a $l/end.s X> @echo "Kernel done. On a PC, restore /lib/cem and /lib/cpp manually" + END-OF-FILE kernel:makefil chmod 'u=rw,g=r,o=r' \k\e\r\n\e\l\:\m\a\k\e\f\i\l set `sum \k\e\r\n\e\l\:\m\a\k\e\f\i\l` sum=$1 case $sum in 36557) :;; *) echo 'Bad sum in '\k\e\r\n\e\l\:\m\a\k\e\f\i\l >&2 esac echo Extracting \k\e\r\n\e\l\:\p\r\i\n\t\e\r sed 's/^X//' > \k\e\r\n\e\l\:\p\r\i\n\t\e\r << '+ END-OF-FILE '\k\e\r\n\e\l\:\p\r\i\n\t\e\r X33,34c33,34 X< #define NORMAL_STATUS 0xDF /* printer gives this status when idle */ X< #define BUSY_STATUS 0x5F /* printer gives this status when busy */ X--- X> #define NORMAL_STATUS 0x90 /* printer gives this status when idle */ X> #define BUSY_STATUS 0x10 /* printer gives this status when busy */ X48a49 X> #define STATUS_MASK 0xB0 /* mask to filter out status bits */ X121c122 X< if (value == NORMAL_STATUS) { X--- X> if ((value&STATUS_MASK) == NORMAL_STATUS) { X127c128 X< if (value == BUSY_STATUS) { X--- X> if ((value&STATUS_MASK) == BUSY_STATUS) { X139c140 X< if (value == BUSY_STATUS) r = EAGAIN; X--- X> if ((value&STATUS_MASK) == BUSY_STATUS) r = EAGAIN; X253c254 X< if (value == NORMAL_STATUS) { X--- X> if ((value&STATUS_MASK) == NORMAL_STATUS) { X264c265 X< } else if (value == BUSY_STATUS) { X--- X> } else if ((value&STATUS_MASK) == BUSY_STATUS) { X275a277,278 X> X> + END-OF-FILE kernel:printer chmod 'u=rw,g=r,o=r' \k\e\r\n\e\l\:\p\r\i\n\t\e\r set `sum \k\e\r\n\e\l\:\p\r\i\n\t\e\r` sum=$1 case $sum in 44270) :;; *) echo 'Bad sum in '\k\e\r\n\e\l\:\p\r\i\n\t\e\r >&2 esac echo Extracting \k\e\r\n\e\l\:\p\r\o\c\.\c sed 's/^X//' > \k\e\r\n\e\l\:\p\r\o\c\.\c << '+ END-OF-FILE '\k\e\r\n\e\l\:\p\r\o\c\.\c X40c40,42 X< if (pc_at) port_out(INT2_CTL, ENABLE); /* re-enable second 8259A */ X--- X> if (pc_at && task == WINCHESTER) X> /* this re-enables the second controller chip */ X> port_out(INT2_CTL, ENABLE); + END-OF-FILE kernel:proc.c chmod 'u=rw,g=r,o=r' \k\e\r\n\e\l\:\p\r\o\c\.\c set `sum \k\e\r\n\e\l\:\p\r\o\c\.\c` sum=$1 case $sum in 20827) :;; *) echo 'Bad sum in '\k\e\r\n\e\l\:\p\r\o\c\.\c >&2 esac echo Extracting \k\e\r\n\e\l\:\t\t\y\.\c sed 's/^X//' > \k\e\r\n\e\l\:\t\t\y\.\c << '+ END-OF-FILE '\k\e\r\n\e\l\:\t\t\y\.\c X79c79,80 X< #define F10 68 /* scan code for function key F9 */ X--- X> #define F9 67 /* scan code for function key F9 */ X> #define F10 68 /* scan code for function key F10 */ X151a153,154 X> PRIVATE caps_off = 1; /* 1 = normal position, 0 = depressed */ X> PRIVATE num_off = 1; /* 1 = normal position, 0 = depressed */ X154a158 X> X162c166 X< ,0261, 0262,0263,'0',0177 X--- X> ,0261,0262,0263,'0',0177 X172c176 X< '2','3','0',177 X--- X> '2','3','0','.' X312,315c316,320 X< chuck(tp); /* remove last char entered */ X< echo(tp, '\b'); /* remove it from the screen */ X< echo(tp, ' '); X< echo(tp, '\b'); X--- X> if (chuck(tp) != -1) { /* remove last char entered */ X> echo(tp, '\b'); /* remove it from the screen */ X> echo(tp, ' '); X> echo(tp, '\b'); X> } X362,368c367 X< tp->tty_inhibited = RUNNING; /* do implied CRTL-Q */ X< finish(tp, EINTR); /* send reply */ X< tp->tty_inhead = tp->tty_inqueue; /* discard input */ X< tp->tty_intail = tp->tty_inqueue; X< tp->tty_incount = 0; X< tp->tty_lfct = 0; X< cause_sig(LOW_USER + 1 + line, sig); X--- X> sigchar(tp, line, sig); X415,422c414,423 X< code = (shift1 || shift2 || capslock ? sh[c] : unsh[c]); X< if (control && c < TOP_ROW) code = sh[c]; /* CTRL-(top row) */ X< if (c > 70 && numlock) code = sh[c]; /* numlock depressed */ X< } else { X< /* (Olivetti M24 or AT&T 6300) with Olivetti-style keyboard. */ X< code = (shift1 || shift2 || capslock ? m24[c] : unm24[c]); X< if (control && c < TOP_ROW) code = sh[c]; /* CTRL-(top row) */ X< if (c > 70 && numlock) code = m24[c]; /* numlock depressed */ X--- X> code = (shift1 || shift2 ? sh[c] : unsh[c]); X> if (control && c < TOP_ROW) code = sh[c]; /* CTRL-(top row) */ X> if (c > 70 && numlock) /* numlock depressed */ X> code = (shift1 || shift2 ? unsh[c] : sh[c]); X> } else { X> /* (Olivetti M24 or AT&T 6300) with Olivetti-style keyboard. */ X> code = (shift1 || shift2 ? m24[c] : unm24[c]); X> if (control && c < TOP_ROW) code = sh[c]; /* CTRL-(top row) */ X> if (c > 70 && numlock) /* numlock depressed */ X> code = (shift1 || shift2 ? unm24[c] : m24[c]); X426a428,432 X> if (capslock) X> if (code >= 'A' && code <= 'Z') X> code += 'a' - 'A'; X> else if (code >= 'a' && code <= 'z') X> code -= 'a' - 'A'; X440,441c446,451 X< case 4: if (make) capslock = 1 - capslock; break; /* caps lock */ X< case 5: if (make) numlock = 1 - numlock; break; /* num lock */ X--- X> case 4: if (make && caps_off) capslock = 1 - capslock; X> caps_off = 1 - make; X> break; /* caps lock */ X> case 5: if (make && num_off) numlock = 1 - numlock; X> num_off = 1 - make; X> break; /* num lock */ X755a766,785 X> /*===========================================================================* X> * sigchar * X> *===========================================================================*/ X> PRIVATE sigchar(tp, line, sig) X> register struct tty_struct *tp; /* pointer to tty_struct */ X> int line; /* line on which signal arrived */ X> int sig; /* SIGINT, SIGQUIT, or SIGKILL */ X> { X> /* Process a SIGINT, SIGQUIT or SIGKILL char from the keyboard */ X> X> tp->tty_inhibited = RUNNING; /* do implied CRTL-Q */ X> finish(tp, EINTR); /* send reply */ X> tp->tty_inhead = tp->tty_inqueue; /* discard input */ X> tp->tty_intail = tp->tty_inqueue; X> tp->tty_incount = 0; X> tp->tty_lfct = 0; X> cause_sig(LOW_USER + 1 + line, sig); X> } X> X> X792a823 X> #define EGA 0x3C0 /* port for EGA card */ X833c864 X< * The shift-type keys, 29, 42, 54, 56, and 69 must be processed normally. X--- X> * The shift-type keys, 29, 42, 54, 56, 58, and 69 must be processed normally. X838c869 X< if (k != 29 && k != 42 && k != 54 && k != 56 && k != 69) { X--- X> if (k != 29 && k != 42 && k != 54 && k != 56 && k != 58 && k != 69) { X1168a1200,1203 X> /* Tell the EGA card, if any, to simulate a 16K CGA card. */ X> port_out(EGA + INDEX, 4); /* register select */ X> port_out(EGA + DATA, 1); /* no extended memory to be used */ X> X1237,1238c1272,1275 X< } X< #endif X--- X> if (ch == F9) sigchar(&tty_struct[0], 0, SIGKILL); /* issue SIGKILL */ X> } X> #endif X> + END-OF-FILE kernel:tty.c chmod 'u=rw,g=r,o=r' \k\e\r\n\e\l\:\t\t\y\.\c set `sum \k\e\r\n\e\l\:\t\t\y\.\c` sum=$1 case $sum in 21674) :;; *) echo 'Bad sum in '\k\e\r\n\e\l\:\t\t\y\.\c >&2 esac exit 0