ast@cs.vu.nl (Andy Tanenbaum) (06/28/88)
: 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:/usr/ucb echo Extracting 'LISTING' sed 's/^X//' > 'LISTING' << '+ END-OF-FILE ''LISTING' Xtotal 81 X-rw-r--r-- 1 ast 1948 Jun 27 23:22 at_wini.c.diff X-rw-r--r-- 1 ast 113 Jun 27 23:23 clock.c.diff X-rw-r--r-- 1 ast 363 Jun 27 23:23 const.h.diff X-rw-r--r-- 1 ast 1277 Jun 27 23:23 dmp.c.diff X-rw-r--r-- 1 ast 820 Jun 27 23:23 floppy.c.diff X-rw-r--r-- 1 ast 256 Jun 27 23:23 glo.h.diff X-rw-r--r-- 1 ast 7509 Jun 27 23:23 klib88.s.diff X-rw-r--r-- 1 ast 5836 Jun 27 23:23 main.c.diff X-rw-r--r-- 1 ast 3078 Jun 27 23:23 makefile X-rw-r--r-- 1 ast 1192 Jun 27 23:23 memory.c.diff X-rw-r--r-- 1 ast 4359 Jun 27 23:23 mpx88.s.diff X-rw-r--r-- 1 ast 155 Jun 27 23:23 printer.c.diff X-rw-r--r-- 1 ast 1775 Jun 27 23:23 proc.c.diff X-rw-r--r-- 1 ast 225 Jun 27 23:23 proc.h.diff X-rw-r--r-- 1 ast 2682 Jun 27 23:23 system.c.diff X-rw-r--r-- 1 ast 2671 Jun 27 23:23 table.c.diff X-rw-r--r-- 1 ast 107 Jun 27 23:23 type.h.diff X-rw-r--r-- 1 ast 403 Jun 27 23:23 xt_wini.c.diff + END-OF-FILE LISTING chmod 'u=rw,g=r,o=r' 'LISTING' set `wc -c 'LISTING'` count=$1 case $count in 1051) :;; *) echo 'Bad character count in ''LISTING' >&2 echo 'Count should be 1051' >&2 esac echo Extracting 'at_wini.c.diff' sed 's/^X//' > 'at_wini.c.diff' << '+ END-OF-FILE ''at_wini.c.diff' X98c98 X< init_param(); X--- X> init_params(); X192c192 X< register int i,j; X--- X> register int i; X423c423 X< phys_copy(address, umap(proc_addr(WINCHESTER), D, buf, 16), 16L); X--- X> phys_copy(address, umap(proc_addr(WINCHESTER), D, (vir_bytes)buf, 16), 16L); X426c426 X< copy_param(buf, &wini[0]); X--- X> copy_params(buf, &wini[0]); X434c434 X< phys_copy(address, umap(proc_addr(WINCHESTER), D, buf, 16), 16L); X--- X> phys_copy(address, umap(proc_addr(WINCHESTER), D, (vir_bytes)buf, 16), 16L); X437c437 X< copy_param(buf, &wini[5]); X--- X> copy_params(buf, &wini[5]); X440c440 X< phys_copy(0x475L, umap(proc_addr(WINCHESTER), D, buf, 1), 1L); X--- X> phys_copy(0x475L, umap(proc_addr(WINCHESTER), D, (vir_bytes)buf, 1), 1L); X458,459c458,462 X< if (w_do_rdwt(&w_mess) != BLOCK_SIZE) X< panic("Can't read partition table of winchester ", i); X--- X> if (w_do_rdwt(&w_mess) != BLOCK_SIZE) { X> printf("Can't read partition table on winchester %d\n",i); X> delay(); X> continue; X> } X461c464,465 X< printf("Invalid partition table\n"); X--- X> printf("Invalid partition table on winchester %d\n",i); X> delay(); X464c468 X< copy_prt(i*5); X--- X> copy_prt((int)i*5); X523c527 X< register struct wini *wn; X--- X> register struct wini wn[]; X525a530 X> struct wini tmp; X529,532c534,539 X< if ((wn[j].wn_low == 0) && (wn[j+1].wn_low != 0)) X< swap(&wn[j], &wn[j+1]); X< else if (wn[j].wn_low > wn[j+1].wn_low && wn[j+1].wn_low != 0) X< swap(&wn[j], &wn[j+1]); X--- X> if ((wn[j].wn_low == 0 && wn[j+1].wn_low != 0) || X> (wn[j].wn_low > wn[j+1].wn_low && wn[j+1].wn_low != 0)) { X> tmp = wn[j]; X> wn[j] = wn[j+1]; X> wn[j+1] = tmp; X> } X535,536c542 X< swap(first, second) X< register struct wini *first, *second; X--- X> delay() X538c544 X< register struct wini tmp; X--- X> int i,j; X540,542c546,548 X< tmp = *first; X< *first = *second; X< *second = tmp; X--- X> for (i = 0; i < 1000; i++) X> for (j = 0; j < 1000; j ++) X> ; + END-OF-FILE at_wini.c.diff chmod 'u=rw,g=r,o=r' 'at_wini.c.diff' set `wc -c 'at_wini.c.diff'` count=$1 case $count in 1948) :;; *) echo 'Bad character count in ''at_wini.c.diff' >&2 echo 'Count should be 1948' >&2 esac echo Extracting 'cache.c.diff' sed 's/^X//' > 'cache.c.diff' << '+ END-OF-FILE ''cache.c.diff' X66c66 X< * However, a block that is aready in use (b_count > 0) may not be taken. X--- X> * However, a block that is already in use (b_count > 0) may not be taken. + END-OF-FILE cache.c.diff chmod 'u=rw,g=r,o=r' 'cache.c.diff' set `wc -c 'cache.c.diff'` count=$1 case $count in 167) :;; *) echo 'Bad character count in ''cache.c.diff' >&2 echo 'Count should be 167' >&2 esac echo Extracting 'clock.c.diff' sed 's/^X//' > 'clock.c.diff' << '+ END-OF-FILE ''clock.c.diff' X152c152 X< /* This routine called on every clock tick. */ X--- X> /* This routine is called on every clock tick. */ + END-OF-FILE clock.c.diff chmod 'u=rw,g=r,o=r' 'clock.c.diff' set `wc -c 'clock.c.diff'` count=$1 case $count in 113) :;; *) echo 'Bad character count in ''clock.c.diff' >&2 echo 'Count should be 113' >&2 esac echo Extracting 'const.h.diff' sed 's/^X//' > 'const.h.diff' << '+ END-OF-FILE ''const.h.diff' X24a25,26 X> #define ETHER_VECTOR 11 /* ethernet interrupt vector */ X> #define RS232_VECTOR 12 /* rs232 interrupt vector */ X39,40c41 X< #define TASK_STACK_BYTES 256 /* how many bytes for each task stack */ X< #define K_STACK_BYTES 256 /* how many bytes for the kernel stack */ X--- X> #define K_STACK_BYTES 512 /* how many bytes for the kernel stack */ + END-OF-FILE const.h.diff chmod 'u=rw,g=r,o=r' 'const.h.diff' set `wc -c 'const.h.diff'` count=$1 case $count in 363) :;; *) echo 'Bad character count in ''const.h.diff' >&2 echo 'Count should be 363' >&2 esac echo Extracting 'device.c.diff' sed 's/^X//' > 'device.c.diff' << '+ END-OF-FILE ''device.c.diff' X11a12,13 X> * tty_open: a tty has been opened X> * tty_exit: a process with pid=pgrp has exited. X40a43 X> dev_mess.DEVICE = dev; X111a115 X> dev_mess.TTY_SPEED = m.TTY_SPEED; X138d141 X< dev_mess.DEVICE = minor; X151a155,156 X> int r; X> message m; X153,160c158,161 X< int proc_nr; X< X< proc_nr = mess_ptr->PROC_NR; X< X< if (sendrec(task_nr, mess_ptr) != OK) panic("rw_dev: can't send", NO_NUM); X< while (mess_ptr->REP_PROC_NR != proc_nr) { X< /* Instead of the reply to this request, we got a message for an X< * earlier request. Handle it and go receive again. X--- X> while ((r = sendrec(task_nr, mess_ptr)) == E_LOCKED) { X> /* sendrec() failed to avoid deadlock. The task 'task_nr' is X> * trying to send a REVIVE message for an earlier request. X> * Handle it and go try again. X162,163c163,164 X< revive(mess_ptr->REP_PROC_NR, mess_ptr->REP_STATUS); X< receive(task_nr, mess_ptr); X--- X> if (receive(task_nr, &m) != OK) panic("rw_dev: can't receive", NO_NUM); X> revive(m.REP_PROC_NR, m.REP_STATUS); X164a166 X> if (r != OK) panic("rw_dev: can't send", NO_NUM); X175c177 X< /* This routine is only called for one device, namely /dev/tty. It's job X--- X> /* This routine is only called for one device, namely /dev/tty. Its job X181a184,188 X> if (fp->fs_tty == 0) { X> mess_ptr->DEVICE = NULL_DEV; X> rw_dev(MEM, mess_ptr); X> return; X> } X199a207,264 X> X> /*===========================================================================* X> * tty_open * X> *===========================================================================*/ X> PUBLIC tty_open(task_nr, mess_ptr) X> int task_nr; X> message *mess_ptr; X> { X> register struct fproc *rfp; X> int major; X> X> mess_ptr->REP_STATUS = OK; X> X> /* Is this a process group leader? */ X> if (fp->fp_pid != fp->fp_pgrp) return; X> X> /* Is there a current control terminal? */ X> if (fp->fs_tty != 0) return; X> /* Is this one already allocated to another process? */ X> for (rfp = &fproc[INIT_PROC_NR + 1]; rfp < &fproc[NR_PROCS]; rfp++) X> if (rfp->fs_tty == mess_ptr->DEVICE) return; X> X> /* All conditions satisfied. Make this a control terminal. */ X> fp->fs_tty = mess_ptr->DEVICE; X> major = (mess_ptr->DEVICE >> MAJOR) & BYTE; X> mess_ptr->DEVICE = (mess_ptr->DEVICE >> MINOR) & BYTE; X> mess_ptr->m_type = TTY_SETPGRP; X> mess_ptr->PROC_NR = who; X> mess_ptr->TTY_PGRP = who; X> (*dmap[major].dmap_rw)(task_nr, mess_ptr); X> } X> X> /*===========================================================================* X> * tty_exit * X> *===========================================================================*/ X> PUBLIC tty_exit() X> { X> /* Process group leader exits. Remove its control terminal X> * from any processes currently running. X> */ X> X> register struct fproc *rfp; X> register dev_nr ttydev; X> X> ttydev = fp->fs_tty; X> for (rfp = &fproc[INIT_PROC_NR + 1]; rfp < &fproc[NR_PROCS]; rfp++) X> if (rfp->fs_tty == ttydev) X> rfp->fs_tty = 0; X> /* Inform the terminal driver. */ X> find_dev(ttydev); X> dev_mess.m_type = TTY_SETPGRP; X> dev_mess.DEVICE = (ttydev >> MINOR) & BYTE; X> dev_mess.PROC_NR = who; X> dev_mess.TTY_PGRP = 0; X> (*dmap[major].dmap_rw)(task, &dev_mess); X> return(OK); X> } X> + END-OF-FILE device.c.diff chmod 'u=rw,g=r,o=r' 'device.c.diff' set `wc -c 'device.c.diff'` count=$1 case $count in 3244) :;; *) echo 'Bad character count in ''device.c.diff' >&2 echo 'Count should be 3244' >&2 esac echo Extracting 'dmp.c.diff' sed 's/^X//' > 'dmp.c.diff' << '+ END-OF-FILE ''dmp.c.diff' X17a18,19 X> extern struct tasktab tasktab[]; X> X35c37 X< dst = umap(proc_addr(SYSTASK), D, nbuff, NSIZE); X--- X> dst = umap(proc_addr(SYSTASK), D, (vir_bytes)nbuff, NSIZE); X67c69 X< printf("\n"); X--- X> printf("\r\n"); X69c71 X< printf("\n"); X--- X> printf("\r\n"); X80c82 X< printf("\nPROC -----TEXT----- -----DATA----- ----STACK----- BASE SIZE\n"); X--- X> printf("\nPROC -----TEXT----- -----DATA----- ----STACK----- BASE SIZE\r\n"); X90c92 X< printf(" %4x %4x %4x %4x %4x %4x %4x %4x %4x %3dK %3dK\n", X--- X> printf(" %4x %4x %4x %4x %4x %4x %4x %4x %4x %3dK %3dK\r\n", X99,100d100 X< char *nayme[]= {"PRINTR", "TTY ", "WINCHE", "FLOPPY", "RAMDSK", "CLOCK ", X< "SYS ", "HARDWR", "MM ", "FS ", "INIT "}; X107c107 X< printf("%s",nayme[i]); X--- X> printf("%s", tasktab[i].name); X122c122 X< phys_bytes src, dst, count; X--- X> phys_bytes src, dst; X129c129 X< src = umap(proc_addr(proc_nr), D, ptr + 2, 2); X--- X> src = umap(proc_addr(proc_nr), D, (vir_bytes)(ptr + 2), 2); X131c131 X< dst = umap(proc_addr(SYSTASK), D, &vargv, 2); X--- X> dst = umap(proc_addr(SYSTASK), D, (vir_bytes)&vargv, 2); X134c134 X< aout[proc_nr] = umap(proc_addr(proc_nr), D, vargv, NSIZE); X--- X> aout[proc_nr] = umap(proc_addr(proc_nr), D, (vir_bytes)vargv, NSIZE); + END-OF-FILE dmp.c.diff chmod 'u=rw,g=r,o=r' 'dmp.c.diff' set `wc -c 'dmp.c.diff'` count=$1 case $count in 1277) :;; *) echo 'Bad character count in ''dmp.c.diff' >&2 echo 'Count should be 1277' >&2 esac echo Extracting 'floppy.c.diff' sed 's/^X//' > 'floppy.c.diff' << '+ END-OF-FILE ''floppy.c.diff' X6c6 X< * m_type DEVICE PROC_NR COUNT POSITION ADRRESS X--- X> * m_type DEVICE PROC_NR COUNT POSITION ADDRESS X221c221 X< fp->fl_sector = (int) interleave[block % nr_sectors[d]]; X--- X> fp->fl_sector = (int) interleave[(int)(block % nr_sectors[d])]; X338c338 X< * Interrupts must be disabled temporarily to prevent clock interrupt from X--- X> * Interrupts must be disabled temporarily to prevent clock interrupts from X408a409 X> fp->fl_curcyl = (r == OK ? fp->fl_cylinder : -1); X431c432 X< /* The command is issued by outputing 9 bytes to the controller chip. */ X--- X> /* The command is issued by outputting 9 bytes to the controller chip. */ X476c477 X< int i, j, status, ready; X--- X> int i, j, k, status, ready; X481a483 X> for (k = 0; k < 32; k++) ; /* delay loop for 386 */ + END-OF-FILE floppy.c.diff chmod 'u=rw,g=r,o=r' 'floppy.c.diff' set `wc -c 'floppy.c.diff'` count=$1 case $count in 820) :;; *) echo 'Bad character count in ''floppy.c.diff' >&2 echo 'Count should be 820' >&2 esac echo Extracting 'fproc.h.diff' sed 's/^X//' > 'fproc.h.diff' << '+ END-OF-FILE ''fproc.h.diff' X5a6 X> X21a23,24 X> int fp_pid; /* process id */ X> int fp_pgrp; /* process group */ + END-OF-FILE fproc.h.diff chmod 'u=rw,g=r,o=r' 'fproc.h.diff' set `wc -c 'fproc.h.diff'` count=$1 case $count in 90) :;; *) echo 'Bad character count in ''fproc.h.diff' >&2 echo 'Count should be 90' >&2 esac echo Extracting 'glo.h.diff' sed 's/^X//' > 'glo.h.diff' << '+ END-OF-FILE ''glo.h.diff' X16,22d15 X< X< /* The kernel and task stacks. */ X< EXTERN struct t_stack { X< int stk[TASK_STACK_BYTES/sizeof(int)]; X< } t_stack[NR_TASKS - 1]; /* task stacks; task = -1 never really runs */ X< X< EXTERN char k_stack[K_STACK_BYTES]; /* The kernel stack. */ + END-OF-FILE glo.h.diff chmod 'u=rw,g=r,o=r' 'glo.h.diff' set `wc -c 'glo.h.diff'` count=$1 case $count in 256) :;; *) echo 'Bad character count in ''glo.h.diff' >&2 echo 'Count should be 256' >&2 esac echo Extracting 'klib88.s.diff' sed 's/^X//' > 'klib88.s.diff' << '+ END-OF-FILE ''klib88.s.diff' X14c14 X< | get_chrome: returns 0 is display is monochrome, 1 if it is color X--- X> | get_chrome: returns 0 if display is monochrome, 1 if it is color X15a16,17 X> | scr_up: scroll screen a line up (in software, by copying) X> | scr_down: scroll screen a line down (in software, by copying) X20a23 X> | em_xfer: read or write AT extended memory using the BIOS X25c28 X< .globl _wreboot, _dma_read, _dma_write X--- X> .globl _wreboot, _dma_read, _dma_write, _em_xfer, _scr_up, _scr_down X42a46 X> cld | clear direction flag X130c134 X< | This routine is makes a fast copy of a message from anywhere in the address X--- X> | This routine makes a fast copy of a message from anywhere in the address X138c142 X< | correctly. Changing the definition of message the type file and not changing X--- X> | correctly. Changing the definition of message in type file and not changing X149a154 X> cld | clear direction flag X355c360 X< pop dx X--- X> pop cx X379c384 X< pop dx X--- X> pop cx X437a443 X> cld | clear direction flag X473a480,561 X> |* scr_up * X> |*===========================================================================* X> | This routine scrolls the screen up one line on an EGA display X> | X> | The call is: X> | scr_up(org) X> | where X> | 'org' is the video segment origin of the desired page X> X> _scr_up: X> push bp | we need bp to access the parameters X> mov bp,sp | set bp to sp for indexing X> push si | save the registers X> push di | save di X> push cx | save cx X> push es | save es X> push ds | save ds X> mov si,#160 | si = pointer to data to be copied X> mov di,#0 | di = offset within video ram X> mov cx,#1920 | cx = word count for copy loop X> X> pushf | copying may now start; save flags X> cli | interrupts just get in the way: disable them X> cld | clear diretion flag X> mov ax,4(bp) X> mov es,ax | load es now: int routines may ruin it X> mov ds,ax X> X> rep | this is the copy loop X> movw | ditto X> X> popf | restore flags X> pop ds | restore ds X> pop es | restore es X> pop cx | restore cx X> pop di | restore di X> pop si | restore si X> pop bp | restore bp X> ret | return to caller X> X> |*===========================================================================* X> |* scr_down * X> |*===========================================================================* X> | This routine scrolls the screen down one line on an EGA display X> | X> | The call is: X> | scr_down(org) X> | where X> | 'org' is the video segment origin of the desired page X> X> _scr_down: X> push bp | we need bp to access the parameters X> mov bp,sp | set bp to sp for indexing X> push si | save the registers X> push di | save di X> push cx | save cx X> push es | save es X> push ds | save ds X> mov si,#3838 | si = pointer to data to be copied X> mov di,#3998 | di = offset within video ram X> mov cx,#1920 | cx = word count for copy loop X> X> pushf | copying may now start; save flags X> cli | interrupts just get in the way: disable them X> mov ax,4(bp) X> mov es,ax | load es now: int routines may ruin it X> mov ds,ax X> X> std X> rep | this is the copy loop X> movw | ditto X> X> popf | restore flags X> pop ds | restore ds X> pop es | restore es X> pop cx | restore cx X> pop di | restore di X> pop si | restore si X> pop bp | restore bp X> ret | return to caller X> X> |*===========================================================================* X494a583,645 X> |=========================================================================== X> | em_xfer X> |=========================================================================== X> | X> | This file contains one routine which transfers words between user memory X> | and extended memory on an AT or clone. A BIOS call (INT 15h, Func 87h) X> | is used to accomplish the transfer. The BIOS call is "faked" by pushing X> | the processor flags on the stack and then doing a far call to the actual X> | BIOS location. An actual INT 15h would get a MINIX complaint from an X> | unexpected trap. X> | X> | NOTE: WARNING: CAUTION: ... X> | Before using this routine, you must find your BIOS address for INT 15h. X> | The debug command "d 0:54 57" will give you the segment and address of X> | the BIOS call. On my machine this generates: X> | 0000:0050 59 F8 00 F0 Y... X> | These values are then plugged into the two strange ".word xxxx" lines X> | near the end of this routine. They correspond to offset=0xf859 and X> | seg=0xf000. The offset is the first two bytes and the segment is the X> | last two bytes (Note the byte swap). X> | X> | This particular BIOS routine runs with interrupts off since the 80286 X> | must be placed in protected mode to access the memory above 1 Mbyte. X> | So there should be no problems using the BIOS call. X> | X> .text X> gdt: | Begin global descriptor table X> | Dummy descriptor X> .word 0 | segment length (limit) X> .word 0 | bits 15-0 of physical address X> .byte 0 | bits 23-16 of physical address X> .byte 0 | access rights byte X> .word 0 | reserved X> | descriptor for GDT itself X> .word 0 | segment length (limit) X> .word 0 | bits 15-0 of physical address X> .byte 0 | bits 23-16 of physical address X> .byte 0 | access rights byte X> .word 0 | reserved X> src: | source descriptor X> srcsz: .word 0 | segment length (limit) X> srcl: .word 0 | bits 15-0 of physical address X> srch: .byte 0 | bits 23-16 of physical address X> .byte 0x93 | access rights byte X> .word 0 | reserved X> tgt: | target descriptor X> tgtsz: .word 0 | segment length (limit) X> tgtl: .word 0 | bits 15-0 of physical address X> tgth: .byte 0 | bits 23-16 of physical address X> .byte 0x93 | access rights byte X> .word 0 | reserved X> | BIOS CS descriptor X> .word 0 | segment length (limit) X> .word 0 | bits 15-0 of physical address X> .byte 0 | bits 23-16 of physical address X> .byte 0 | access rights byte X> .word 0 | reserved X> | stack segment descriptor X> .word 0 | segment length (limit) X> .word 0 | bits 15-0 of physical address X> .byte 0 | bits 23-16 of physical address X> .byte 0 | access rights byte X> .word 0 | reserved X495a647,661 X> | X> | X> | Execute a transfer between user memory and extended memory. X> | X> | status = em_xfer(source, dest, count); X> | X> | Where: X> | status => return code (0 => OK) X> | source => Physical source address (32-bit) X> | dest => Physical destination address (32-bit) X> | count => Number of words to transfer X> | X> | X> | X> _em_xfer: X496a663,705 X> push bp | Save registers X> mov bp,sp X> push si X> push es X> push cx X> | X> | Pick up source and destination addresses and update descriptor tables X> | X> mov ax,4(bp) X> seg cs X> mov srcl,ax X> mov ax,6(bp) X> seg cs X> movb srch,al X> mov ax,8(bp) X> seg cs X> mov tgtl,ax X> mov ax,10(bp) X> seg cs X> movb tgth,al X> | X> | Update descriptor table segment limits X> | X> mov cx,12(bp) X> mov ax,cx X> add ax,ax X> seg cs X> mov tgtsz,ax X> seg cs X> mov srcsz,ax X> | X> | Now do actual DOS call X> | X> push cs X> pop es X> seg cs X> mov si,#gdt X> movb ah,#0x87 X> pushf X> int 0x15 | Do a far call to BIOS routine X> | X> | All done, return to caller. X> | X497a707,715 X> pop cx | restore registers X> pop es X> pop si X> mov sp,bp X> pop bp X> ret X> X> X> X506a725 X> call _eth_stp | stop the ethernet chip X523a743 X> call _eth_stp | stop the ethernet chip + END-OF-FILE klib88.s.diff chmod 'u=rw,g=r,o=r' 'klib88.s.diff' set `wc -c 'klib88.s.diff'` count=$1 case $count in 7509) :;; *) echo 'Bad character count in ''klib88.s.diff' >&2 echo 'Count should be 7509' >&2 esac echo Extracting 'link.c.diff' sed 's/^X//' > 'link.c.diff' << '+ END-OF-FILE ''link.c.diff' X28c28 X< /* Perform the link(name, name2) system call. */ X--- X> /* Perform the link(name1, name2) system call. */ + END-OF-FILE link.c.diff chmod 'u=rw,g=r,o=r' 'link.c.diff' set `wc -c 'link.c.diff'` count=$1 case $count in 113) :;; *) echo 'Bad character count in ''link.c.diff' >&2 echo 'Count should be 113' >&2 esac echo Extracting 'main.c.diff' sed 's/^X//' > 'main.c.diff' << '+ END-OF-FILE ''main.c.diff' X17a18 X> #include "../h/signal.h" X29a31,32 X> #define EM_VEC 0x15 /* vector for extended memory BIOS calls */ X> #define HIGH_INT 16 /* limit of the interrupt vectors */ X30a34,40 X> extern int int00(), int01(), int02(), int03(), int04(), int05(), int06(), X> int07(), int08(), int09(), int10(), int11(), int12(), int13(), X> int14(), int15(); X> int (*int_vec[HIGH_INT])() = {int00, int01, int02, int03, int04, int05, int06, X> int07, int08, int09, int10, int11, int12, int13, int14, int15}; X> X> X39a50 X> int i; X42a54,55 X> int stack_size; X> int * ktsb; /* kernel task stack base */ X44c57 X< extern int color, vec_table[], get_chrome(), (*task[])(); X--- X> extern int color, vec_table[], get_chrome(); X46c59 X< extern int wini_int(), lpr_int(), surprise(), trp(), divide(); X--- X> extern int wini_int(), lpr_int(), trp(), rs232_int(); X47a61,64 X> extern char get_byte(); X> extern struct tasktab tasktab[]; /* see table.c */ X> extern int t_stack[]; /* see table.c */ X> extern int k_stack[]; /* see table.c */ X48a66,71 X> #ifdef AM_KERNEL X> #ifndef NONET X> extern int eth_int(); X> #endif X> #endif X> X61,68c84,99 X< for (rp = &proc[0]; rp <= &proc[NR_TASKS+LOW_USER]; rp++) { X< for (t=0; t< NR_REGS; t++) rp->p_reg[t] = 0100*t; /* debugging */ X< t = rp - proc - NR_TASKS; /* task number */ X< rp->p_sp = (rp < &proc[NR_TASKS] ? t_stack[NR_TASKS+t+1].stk : INIT_SP); X< rp->p_splimit = rp->p_sp; X< if (rp->p_splimit != INIT_SP) X< rp->p_splimit -= (TASK_STACK_BYTES - SAFETY)/sizeof(int); X< rp->p_pcpsw.pc = task[t + NR_TASKS]; X--- X> for (ktsb = t_stack, t = -NR_TASKS, rp = &proc[0]; X> rp <= &proc[NR_TASKS+LOW_USER]; rp++, t++) { X> for (i = 0; i < NR_REGS; i++) rp->p_reg[i] = 0100 * i; /* debugging */ X> if (t < 0) X> { X> stack_size = tasktab[t+NR_TASKS].stksize; X> ktsb += stack_size / sizeof (int); X> rp->p_sp = ktsb; X> rp->p_splimit = ktsb - (stack_size - SAFETY) / sizeof(int); X> } X> else X> { X> rp->p_sp = INIT_SP; X> rp->p_splimit = rp->p_sp; X> } X> rp->p_pcpsw.pc = tasktab[t + NR_TASKS].initial_pc; X93a125 X> X102,105c134,137 X< proc[NR_TASKS+(HARDWARE)].p_sp = (int *) k_stack; X< proc[NR_TASKS+(HARDWARE)].p_sp += K_STACK_BYTES/2; X< proc[NR_TASKS+(HARDWARE)].p_splimit = (int *) k_stack; X< proc[NR_TASKS+(HARDWARE)].p_splimit += SAFETY/2; X--- X> proc[NR_TASKS+(HARDWARE)].p_sp = k_stack; X> proc[NR_TASKS+(HARDWARE)].p_sp += K_STACK_BYTES/sizeof (int); X> proc[NR_TASKS+(HARDWARE)].p_splimit = k_stack; X> proc[NR_TASKS+(HARDWARE)].p_splimit += SAFETY/sizeof (int); X112c144 X< t = get_byte(CPU_TY1, CPU_TY2); /* is this PC, XT, AT ... ? */ X--- X> t = (int)get_byte(CPU_TY1, CPU_TY2) & 0xFF; /* is this PC, XT, AT ... ? */ X120,122c152,153 X< for (t = 0; t < 16; t++) set_vec(t, surprise, base_click); X< for (t = 16; t < 256; t++) set_vec(t, trp, base_click); X< set_vec(DIVIDE_VECTOR, divide, base_click); X--- X> for (t = 0; t < HIGH_INT; t++) set_vec(t, int_vec[t], base_click); X> for (t = HIGH_INT; t < 256; t++) set_vec(t, trp, base_click); X125a157 X> set_vec(RS232_VECTOR, rs232_int, base_click); X128,131c160,170 X< if (pc_at) X< set_vec(AT_WINI_VECTOR, wini_int, base_click); X< else X< set_vec(XT_WINI_VECTOR, wini_int, base_click); X--- X> #ifdef AM_KERNEL X> #ifndef NONET X> set_vec(ETHER_VECTOR, eth_int, base_click); X> #endif X> #endif X> if (pc_at) { X> set_vec(AT_WINI_VECTOR, wini_int, base_click); X> phys_copy(phys_b + 4L*EM_VEC, 4L*EM_VEC, 4L); /* extended mem vec */ X> } else { X> set_vec(XT_WINI_VECTOR, wini_int, base_click); X> } X149c188,189 X< PUBLIC unexpected_int() X--- X> PUBLIC unexpected_int(vecnr) X> int vecnr; /* vector number, 0 to 15 */ X153,154c193,200 X< printf("Unexpected trap: vector < 16\n"); X< printf("pc = 0x%x text+data+bss = 0x%x\n",proc_ptr->p_pcpsw.pc, X--- X> if (vecnr == DIVIDE_VECTOR) { X> printf("Division overflow trap. SIGILL will be sent to process.\n"); X> cause_sig(cur_proc, SIGILL); /* send signal to current process */ X> unready(proc_addr(cur_proc)); /* deschedule current process */ X> } else { X> printf("Unexpected interrupt or trap: vector = %d. ", vecnr); X> } X> printf("pc = 0x%x text+data+bss = 0x%x\n",proc_ptr->p_pcpsw.pc, X166,168c212 X< printf("\nUnexpected trap: vector >= 16 "); X< printf("This may be due to accidentally including\n"); X< printf("a non-MINIX library routine that is trying to make a system call.\n"); X--- X> printf("\nUnexpected trap: vector >= 16. "); X170a215,216 X> printf("This may be due to accidentally including a non-MINIX\n"); X> printf("library routine that is trying to make a system call.\n"); X175,187d220 X< * div_trap * X< *===========================================================================*/ X< PUBLIC div_trap() X< { X< /* The divide intruction traps to vector 0 upon overflow. */ X< X< printf("Trap to vector 0: divide overflow. "); X< printf("pc = 0x%x text+data+bss = 0x%x\n",proc_ptr->p_pcpsw.pc, X< proc_ptr->p_map[D].mem_len<<4); X< } X< X< X< /*===========================================================================* X234c267 X< phys_copy(phys_b, (phys_bytes) 4*vec_nr, (phys_bytes) 4); X--- X> phys_copy(phys_b, (phys_bytes) vec_nr*4, (phys_bytes) 4); X235a269,280 X> #endif X> X> X> /*===========================================================================* X> * networking * X> *===========================================================================*/ X> #ifndef AM_KERNEL X> /* These routines are dummies. They are only needed when networking is X> * disabled. They are called in mpx88.s and klib88.s. X> */ X> PUBLIC eth_stp() {} /* stop the ethernet upon reboot */ X> PUBLIC dp8390_int(){} /* Ethernet interrupt */ + END-OF-FILE main.c.diff chmod 'u=rw,g=r,o=r' 'main.c.diff' set `wc -c 'main.c.diff'` count=$1 case $count in 5836) :;; *) echo 'Bad character count in ''main.c.diff' >&2 echo 'Count should be 5836' >&2 esac echo Extracting 'makefile' sed 's/^X//' > 'makefile' << '+ END-OF-FILE ''makefile' X# The kernel dir contains xt_wini.c and at_wini.c. Before running make X# 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. You can change this by editing commands/cc.c. X# X# Normally, MINIX scrolls the screen using the 6845's registers. However, X# on some EGA cards (those that are not IBM compatible), the 6845 is not X# properly emulated. On these machines, it is necessary to scroll in X# software by copying. This is much slower, but it works. The CFLAGS flags are: X# X# -Di8088 - required on an 8088/80286/80386 CPU; forbidden on a 68000 X# -F - run cpp and cem sequentially (used when memory is tight) X# -T. - put temporaries in working directory (when RAM disk is small) X# X# In the standard distribution, the following defaults are set X# PC: CFLAGS = -Di8088 -F -T. X# AT: CFLAGS = -Di8088 -F X# XCFLAGS= -Di8088 -F Xh=../h Xl=/usr/lib X Xobj = mpx88.s main.s tty.s floppy.s wini.s system.s proc.s clock.s memory.s \ X printer.s table.s klib88.s dmp.s X Xcobjs = main.s tty.s floppy.s wini.s system.s proc.s clock.s memory.s \ X printer.s table.s dmp.s X X Xkernel: makefile $(obj) $l/libc.a X @echo "Start linking Kernel." X @asld -o kernel $(obj) $l/libc.a $l/end.s X @echo "Kernel done. " X Xclean: X rm -f $(cobjs) X Xclock.s: const.h type.h $h/const.h $h/type.h Xclock.s: $h/callnr.h Xclock.s: $h/com.h Xclock.s: $h/error.h Xclock.s: $h/signal.h Xclock.s: glo.h Xclock.s: proc.h X Xfloppy.s: const.h type.h $h/const.h $h/type.h Xfloppy.s: $h/callnr.h Xfloppy.s: $h/com.h Xfloppy.s: $h/error.h Xfloppy.s: glo.h Xfloppy.s: proc.h X X Xdmp.s: const.h type.h $h/const.h $h/type.h Xdmp.s: $h/callnr.h Xdmp.s: $h/com.h Xdmp.s: $h/error.h Xdmp.s: glo.h Xdmp.s: proc.h X Xmain.s: const.h type.h $h/const.h $h/type.h Xmain.s: $h/callnr.h Xmain.s: $h/com.h Xmain.s: $h/error.h Xmain.s: glo.h Xmain.s: proc.h X Xmemory.s: const.h type.h $h/const.h $h/type.h Xmemory.s: $h/callnr.h Xmemory.s: $h/com.h Xmemory.s: $h/error.h Xmemory.s: proc.h X Xprinter.s: const.h type.h $h/const.h $h/type.h Xprinter.s: $h/callnr.h Xprinter.s: $h/com.h Xprinter.s: $h/error.h Xprinter.s: proc.h Xprinter.s: glo.h X Xproc.s: const.h type.h $h/const.h $h/type.h Xproc.s: $h/callnr.h Xproc.s: $h/com.h Xproc.s: $h/error.h Xproc.s: glo.h Xproc.s: proc.h X Xsystem.s: const.h type.h $h/const.h $h/type.h Xsystem.s: $h/callnr.h Xsystem.s: $h/com.h Xsystem.s: $h/error.h Xsystem.s: $h/signal.h Xsystem.s: glo.h Xsystem.s: proc.h X Xtable.s: const.h type.h $h/const.h $h/type.h $h/com.h Xtable.s: glo.h Xtable.s: proc.h X Xtty.s: const.h type.h $h/const.h $h/type.h Xtty.s: $h/callnr.h Xtty.s: $h/com.h Xtty.s: $h/error.h Xtty.s: $h/sgtty.h Xtty.s: $h/signal.h Xtty.s: glo.h Xtty.s: proc.h X Xwini.s: const.h type.h $h/const.h $h/type.h Xwini.s: $h/callnr.h Xwini.s: $h/com.h Xwini.s: $h/error.h Xwini.s: proc.h + END-OF-FILE makefile chmod 'u=rw,g=r,o=r' 'makefile' set `wc -c 'makefile'` count=$1 case $count in 3078) :;; *) echo 'Bad character count in ''makefile' >&2 echo 'Count should be 3078' >&2 esac echo Extracting 'memory.c.diff' sed 's/^X//' > 'memory.c.diff' << '+ END-OF-FILE ''memory.c.diff' X35c35 X< X--- X> #define EM_ORIGIN 0x100000 /* origin of extended memory on the AT */ X93c93 X< int device, count; X--- X> int device, count, words, status; X116,120c116,133 X< /* Copy the data. */ X< if (m_ptr->m_type == DISK_READ) X< phys_copy(mem_phys, user_phys, (long) count); X< else X< phys_copy(user_phys, mem_phys, (long) count); X--- X> /* Copy the data. Origin above EM_ORIGIN means AT extended memory */ X> if (ram_origin[device] < EM_ORIGIN) { X> /* Ordinary case. RAM disk is below 640K. */ X> if (m_ptr->m_type == DISK_READ) X> phys_copy(mem_phys, user_phys, (long) count); X> else X> phys_copy(user_phys, mem_phys, (long) count); X> } else { X> /* AT with RAM disk in extended memory (above 1 MB). */ X> if (count & 1) panic("RAM disk got odd byte count\n", NO_NUM); X> words = count >> 1; /* # words is half # bytes */ X> if (m_ptr->m_type == DISK_READ) { X> status = em_xfer(mem_phys, user_phys, words); X> } else { X> status = em_xfer(user_phys, mem_phys, words); X> } X> if (status != 0) count = -1; X> } X136c149 X< if (device < 0 || device >= NR_RAMS) return(ENXIO); /* bad minor device */ X--- X> if (device != RAM_DEV) return(ENXIO); /* bad minor device */ + END-OF-FILE memory.c.diff chmod 'u=rw,g=r,o=r' 'memory.c.diff' set `wc -c 'memory.c.diff'` count=$1 case $count in 1192) :;; *) echo 'Bad character count in ''memory.c.diff' >&2 echo 'Count should be 1192' >&2 esac echo Extracting 'misc.c.diff' sed 's/^X//' > 'misc.c.diff' << '+ END-OF-FILE ''misc.c.diff' X88,89c88,91 X< sp->s_time = clock_time(); X< if (sp->s_rd_only == FALSE) sp->s_dirt = DIRTY; X--- X> if (sp != NIL_SUPER) { X> sp->s_time = clock_time(); X> if (sp->s_rd_only == FALSE) sp->s_dirt = DIRTY; X> } X124c126 X< * In particular, let the child inherit its parents file descriptors. X--- X> * In particular, let the child inherit its parent's file descriptors. X146a149,154 X> /* Fill in new process id and, if necessary, process group. */ X> cp->fp_pid = pid; X> if (parent == INIT_PROC_NR) { X> cp->fp_pgrp = pid; X> } X> X168a177,179 X> X> /* Can this be a process group leader associated with a terminal? */ X> if (fp->fp_pid == fp->fp_pgrp && fp->fs_tty != 0) tty_exit(); + END-OF-FILE misc.c.diff chmod 'u=rw,g=r,o=r' 'misc.c.diff' set `wc -c 'misc.c.diff'` count=$1 case $count in 694) :;; *) echo 'Bad character count in ''misc.c.diff' >&2 echo 'Count should be 694' >&2 esac echo Extracting 'mount.c.diff' sed 's/^X//' > 'mount.c.diff' << '+ END-OF-FILE ''mount.c.diff' X34c34 X< extern dev_nr name_to_dev(); X--- X> dev_nr name_to_dev(); X132c132 X< extern dev_nr name_to_dev(); X--- X> dev_nr name_to_dev(); + END-OF-FILE mount.c.diff chmod 'u=rw,g=r,o=r' 'mount.c.diff' set `wc -c 'mount.c.diff'` count=$1 case $count in 140) :;; *) echo 'Bad character count in ''mount.c.diff' >&2 echo 'Count should be 140' >&2 esac echo Extracting 'mpx88.s.diff' sed 's/^X//' > 'mpx88.s.diff' << '+ END-OF-FILE ''mpx88.s.diff' X12a13 X> | rs232_int: interrupt routine for each rs232 interrupt X17c18,19 X< | surprise: all other interrupts < 16 are vectored here X--- X> | eth_int: ethernet interrupt routine X> | int00-int15:handlers for unused interrupt vectors < 16 X19d20 X< | divide: divide overflow traps are vectored here X32,33c33,36 X< .globl _tty_int, _lpr_int, _clock_int, _disk_int, _wini_int X< .globl _s_call, _surprise, _trp, _divide, _restart X--- X> .globl _tty_int, _rs232_int, _lpr_int, _clock_int, _disk_int, _wini_int X> .globl _eth_int, _s_call, _trp, _restart X> .globl _int00, _int01, _int02, _int03, _int04, _int05, _int06, _int07 X> .globl _int08, _int09, _int10, _int11, _int12, _int13, _int14, _int15 X37c40 X< .globl _pr_char, _div_trap X--- X> .globl _pr_char, _rs232 X99a103,113 X> |*============================================================================ X> |* rs232_int * X> |*============================================================================ X> _rs232_int: | Interrupt routine for rs232 I/O. X> call save | save the machine state X> mov ax,#1 | which unit caused the interrupt X> push ax | pass it as a parameter X> call _rs232 | process a rs232 interrupt X> jmp _restart | continue execution X> X> X152c166 X< |* surprise * X--- X> |* eth_int * X154c168 X< _surprise: | This is where unexpected interrupts come. X--- X> _eth_int: | Interrupt routine for ethernet input X155a170,242 X> call _dp8390_int | call the handler X> jmp _restart | continue execution X> X> X> |*===========================================================================* X> |* int00-15 * X> |*===========================================================================* X> _int00: call save | interrupt through vector 0 X> mov ax,#0 | save vector number in ax X> jmp vec_mess | print message X> X> _int01: call save | interrupt through vector 1 X> mov ax,#1 | save vector number in ax X> jmp vec_mess | print message X> X> _int02: call save | interrupt through vector 1 X> mov ax,#2 | save vector number in ax X> jmp vec_mess | print message X> X> _int03: call save | interrupt through vector 3 X> mov ax,#3 | save vector number in ax X> jmp vec_mess | print message X> X> _int04: call save | interrupt through vector 4 X> mov ax,#4 | save vector number in ax X> jmp vec_mess | print message X> X> _int05: call save | interrupt through vector 5 X> mov ax,#5 | save vector number in ax X> jmp vec_mess | print message X> X> _int06: call save | interrupt through vector 6 X> mov ax,#6 | save vector number in ax X> jmp vec_mess | print message X> X> _int07: call save | interrupt through vector 7 X> mov ax,#7 | save vector number in ax X> jmp vec_mess | print message X> X> _int08: call save | interrupt through vector 8 X> mov ax,#8 | save vector number in ax X> jmp vec_mess | print message X> X> _int09: call save | interrupt through vector 9 X> mov ax,#9 | save vector number in ax X> jmp vec_mess | print message X> X> _int10: call save | interrupt through vector 10 X> mov ax,#10 | save vector number in ax X> jmp vec_mess | print message X> X> _int11: call save | interrupt through vector 11 X> mov ax,#11 | save vector number in ax X> jmp vec_mess | print message X> X> _int12: call save | interrupt through vector 12 X> mov ax,#12 | save vector number in ax X> jmp vec_mess | print message X> X> _int13: call save | interrupt through vector 13 X> mov ax,#13 | save vector number in ax X> jmp vec_mess | print message X> X> _int14: call save | interrupt through vector 14 X> mov ax,#14 | save vector number in ax X> jmp vec_mess | print message X> X> _int15: call save | interrupt through vector 15 X> mov ax,#15 | save vector number in ax X> jmp vec_mess | print message X> X> vec_mess: | this is where unexpected interrupts come. X> push ax | push the vector number X163c250 X< _trp: | This is where unexpected traps come. X--- X> _trp: | this is where unexpected traps come. X170,178d256 X< |* divide * X< |*===========================================================================* X< _divide: | This is where divide overflow traps come. X< call save | save the machine state X< call _div_trap | print a message X< jmp _restart | this error is not fatal X< X< X< |*===========================================================================* X270d347 X< + END-OF-FILE mpx88.s.diff chmod 'u=rw,g=r,o=r' 'mpx88.s.diff' set `wc -c 'mpx88.s.diff'` count=$1 case $count in 4359) :;; *) echo 'Bad character count in ''mpx88.s.diff' >&2 echo 'Count should be 4359' >&2 esac echo Extracting 'open.c.diff' sed 's/^X//' > 'open.c.diff' << '+ END-OF-FILE ''open.c.diff' X39c39 X< extern struct inode *new_node(); X--- X> struct inode *new_node(); X52c52 X< * and has been created, or it pre-existed. In the later case, truncate X--- X> * and has been created, or it pre-existed. In the latter case, truncate X213,217d212 X< /* Assume that first open of char special file is controlling tty. */ X< if (fp->fs_tty == 0) fp->fs_tty = (dev_nr) rip->i_zone[0]; X< dev_open((dev_nr) rip->i_zone[0], (int) bits); X< break; X< + END-OF-FILE open.c.diff chmod 'u=rw,g=r,o=r' 'open.c.diff' set `wc -c 'open.c.diff'` count=$1 case $count in 452) :;; *) echo 'Bad character count in ''open.c.diff' >&2 echo 'Count should be 452' >&2 esac echo Extracting 'param.h.diff' sed 's/^X//' > 'param.h.diff' << '+ END-OF-FILE ''param.h.diff' X29a30 X> #define pid m.m1_i3 + END-OF-FILE param.h.diff chmod 'u=rw,g=r,o=r' 'param.h.diff' set `wc -c 'param.h.diff'` count=$1 case $count in 34) :;; *) echo 'Bad character count in ''param.h.diff' >&2 echo 'Count should be 34' >&2 esac echo Extracting 'path.c.diff' sed 's/^X//' > 'path.c.diff' << '+ END-OF-FILE ''path.c.diff' X70c70 X< extern char *get_name(); X--- X> char *get_name(); X121c121 X< while ( rnp < &user_path[MAX_PATH] && c != '/' && c != '\0') { X--- X> while ( rnp < &old_name[MAX_PATH] && c != '/' && c != '\0') { X127c127 X< while (c == '/' && rnp < &user_path[MAX_PATH]) c = *++rnp; X--- X> while (c == '/' && rnp < &old_name[MAX_PATH]) c = *++rnp; X132c132 X< if (rnp >= &user_path[MAX_PATH]) { X--- X> if (rnp >= &old_name[MAX_PATH]) { X162a163,165 X> /* Check for NIL_INODE. */ X> if (dirp == NIL_INODE) return(NIL_INODE); X> X175c178 X< for (sp = &super_block[1]; sp < &super_block[NR_SUPERS]; sp++) { X--- X> for (sp = &super_block[1]; sp < &super_block[NR_SUPERS]; sp++){ X189a193,194 X> if (rip == NIL_INODE) return(NIL_INODE); X> + END-OF-FILE path.c.diff chmod 'u=rw,g=r,o=r' 'path.c.diff' set `wc -c 'path.c.diff'` count=$1 case $count in 743) :;; *) echo 'Bad character count in ''path.c.diff' >&2 echo 'Count should be 743' >&2 esac echo Extracting 'pipe.c.diff' sed 's/^X//' > 'pipe.c.diff' << '+ END-OF-FILE ''pipe.c.diff' X84c84 X< PUBLIC int pipe_check(rip, rw_flag, virgin, bytes, position) X--- X> PUBLIC int pipe_check(rip, rw_flag, bytes, position) X87d86 X< int virgin; /* 1 if no data transferred yet, else 0 */ X89c88 X< register file_pos *position; /* pointer to current file position */ X--- X> register file_pos position; /* pointer to current file position */ X101c100 X< if (*position >= rip->i_size) { X--- X> if (position >= rip->i_size) { X104,105c103,104 X< /* Writer exists; suspend rdr if no data already read.*/ X< if (virgin) suspend(XPIPE); /* block reader */ X--- X> /* Writer exists */ X> suspend(XPIPE); /* block reader */ X116,120c115,116 X< /* Tell MM to generate a SIGPIPE signal. */ X< mess.m_type = KSIG; X< mess.PROC1 = fp - fproc; X< mess.SIG_MAP = 1 << (SIGPIPE - 1); X< send(MM_PROC_NR, &mess); X--- X> /* Tell kernel to generate a SIGPIPE signal. */ X> sys_kill((int)(fp - fproc), SIGPIPE); X124c120 X< if (*position + bytes > PIPE_SIZE) { X--- X> if (position + bytes > PIPE_SIZE) { X130c126 X< if (*position == 0) release(rip, READ, 1); X--- X> if (position == 0) release(rip, READ, 1); X176,178c172,176 X< if (rp->fp_suspended == SUSPENDED && (rp->fp_fd & BYTE) == call_nr && X< rp->fp_filp[rp->fp_fd>>8]->filp_ino == ip) { X< revive(rp - fproc, 0); X--- X> if (rp->fp_suspended == SUSPENDED && X> rp->fp_revived == NOT_REVIVING && X> (rp->fp_fd & BYTE) == call_nr && X> rp->fp_filp[rp->fp_fd>>8]->filp_ino == ip) { X> revive((int)(rp - fproc), 0); X251,255c249 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); X< } X--- X> rw_dev(task, &mess); + END-OF-FILE pipe.c.diff chmod 'u=rw,g=r,o=r' 'pipe.c.diff' set `wc -c 'pipe.c.diff'` count=$1 case $count in 1736) :;; *) echo 'Bad character count in ''pipe.c.diff' >&2 echo 'Count should be 1736' >&2 esac echo Extracting 'printer.c.diff' sed 's/^X//' > 'printer.c.diff' << '+ END-OF-FILE ''printer.c.diff' X106c106 X< phys = umap(rp, D, (vir_bytes) m_ptr->ADDRESS, m_ptr->COUNT); X--- X> phys = umap(rp, D, (vir_bytes) m_ptr->ADDRESS, (vir_bytes)m_ptr->COUNT); + END-OF-FILE printer.c.diff chmod 'u=rw,g=r,o=r' 'printer.c.diff' set `wc -c 'printer.c.diff'` count=$1 case $count in 155) :;; *) echo 'Bad character count in ''printer.c.diff' >&2 echo 'Count should be 155' >&2 esac echo Extracting 'proc.c.diff' sed 's/^X//' > 'proc.c.diff' << '+ END-OF-FILE ''proc.c.diff' X153a154,163 X> /* Check for deadlock by 'caller' and 'dest' sending to each other. */ X> if (dest_ptr->p_flags & SENDING) { X> next_ptr = caller_ptr->p_callerq; X> while (next_ptr) { X> if (next_ptr == dest_ptr) X> return(E_LOCKED); X> next_ptr = next_ptr->p_sendlink; X> } X> } X> X155,156c165,166 X< if ( (dest_ptr->p_flags & RECEIVING) && X< (dest_ptr->p_getfrom == ANY || dest_ptr->p_getfrom == caller) ) { X--- X> if ( (dest_ptr->p_flags & RECEIVING) && (dest_ptr->p_flags & SENDING) == 0 && X> (dest_ptr->p_getfrom == ANY || dest_ptr->p_getfrom == caller)){ X165a176 X> if (caller_ptr->p_flags == 0) unready(caller_ptr); X167d177 X< unready(caller_ptr); X205c215,216 X< while (sender_ptr != NIL_PROC) { X--- X> if ((caller_ptr->p_flags & SENDING) == 0) { X> while (sender_ptr != NIL_PROC) { X220a232 X> } X225a238 X> if (caller_ptr->p_flags == 0) unready(caller_ptr); X227d239 X< unready(caller_ptr); X232c244 X< if (sig_procs > 0 && caller == MM_PROC_NR && src == ANY) inform(MM_PROC_NR); X--- X> if (sig_procs > 0 && caller == MM_PROC_NR && src == ANY) inform(); X253c265 X< * deposit the registers when a interrupt occurs on an idle machine. X--- X> * deposit the registers when an interrupt occurs on an idle machine. X256c268 X< * clock task is running, 'cur_proc' = CLOCKTASK. In addition, set 'bill_ptr' X--- X> * clock task is running, 'cur_proc' = CLOCKTASK.) In addition, set 'bill_ptr' X318c330,333 X< if ( (xp = rdy_head[q]) == NIL_PROC) return; X--- X> if ( (xp = rdy_head[q]) == NIL_PROC) { X> restore(); X> return; X> } X322c337 X< pick_proc(); X--- X> if (rp == proc_ptr) pick_proc(); X328c343,346 X< if ( (xp = xp->p_nextready) == NIL_PROC) return; X--- X> if ( (xp = xp->p_nextready) == NIL_PROC) { X> restore(); X> return; X> } + END-OF-FILE proc.c.diff chmod 'u=rw,g=r,o=r' 'proc.c.diff' set `wc -c 'proc.c.diff'` count=$1 case $count in 1775) :;; *) echo 'Bad character count in ''proc.c.diff' >&2 echo 'Count should be 1775' >&2 esac echo Extracting 'proc.h.diff' sed 's/^X//' > 'proc.h.diff' << '+ END-OF-FILE ''proc.h.diff' X11c11 X< struct pc_psw p_pcpsw; /* pc and psw as pushed by interrupt */ X--- X> struct pc_psw p_pcpsw; /* pc and psw as pushed by interrupt */ X36a37 X> #define PENDING 020 /* set when process has signals pending */ + END-OF-FILE proc.h.diff chmod 'u=rw,g=r,o=r' 'proc.h.diff' set `wc -c 'proc.h.diff'` count=$1 case $count in 225) :;; *) echo 'Bad character count in ''proc.h.diff' >&2 echo 'Count should be 225' >&2 esac echo Extracting 'protect.c.diff' sed 's/^X//' > 'protect.c.diff' << '+ END-OF-FILE ''protect.c.diff' X138c138 X< /* Given a pointer to an inode, 'rip', and the accessed desired, determine X--- X> /* Given a pointer to an inode, 'rip', and the access desired, determine X181c181 X< PRIVATE int read_only(ip) X--- X> PUBLIC int read_only(ip) + END-OF-FILE protect.c.diff chmod 'u=rw,g=r,o=r' 'protect.c.diff' set `wc -c 'protect.c.diff'` count=$1 case $count in 231) :;; *) echo 'Bad character count in ''protect.c.diff' >&2 echo 'Count should be 231' >&2 esac echo Extracting 'putc.c.diff' sed 's/^X//' > 'putc.c.diff' << '+ END-OF-FILE ''putc.c.diff' X49c49 X< sendrec(TTY, &putchmsg); X--- X> rw_dev(TTY, &putchmsg); + END-OF-FILE putc.c.diff chmod 'u=rw,g=r,o=r' 'putc.c.diff' set `wc -c 'putc.c.diff'` count=$1 case $count in 67) :;; *) echo 'Bad character count in ''putc.c.diff' >&2 echo 'Count should be 67' >&2 esac echo Extracting 'read.c.diff' sed 's/^X//' > 'read.c.diff' << '+ END-OF-FILE ''read.c.diff' X9c9 X< * read_map: given an inode and file position, lookup its zone number X--- X> * read_map: given an inode and file position, look up its zone number X56c56 X< int r, chunk, virg, mode_word, usr, seg; X--- X> int r, chunk, mode_word, usr, seg, block_spec, char_spec; X73,74c73,76 X< if (nbytes == 0) return(0); /* so char special files need not check for 0*/ X< if (who != MM_PROC_NR && nbytes < 0) return(EINVAL); /* only MM > 32K */ X--- X> #ifdef i8088 X> if (who != MM_PROC_NR) /* only MM > 32K */ X> #endif X> if (nbytes < 0) return(EINVAL); X77a80 X> if (nbytes == 0) return(0); /* so char special files need not check for 0*/ X84d86 X< virg = TRUE; X86c88,90 X< if (mode_word == I_BLOCK_SPECIAL && f_size == 0) f_size = MAX_P_LONG; X--- X> char_spec = (mode_word == I_CHAR_SPECIAL ? 1 : 0); X> block_spec = (mode_word == I_BLOCK_SPECIAL ? 1 : 0); X> if (block_spec && f_size == 0) f_size = MAX_P_LONG; X90c94 X< if (mode_word == I_CHAR_SPECIAL) { X--- X> if (char_spec) { X98c102 X< if (rw_flag == WRITING && mode_word != I_BLOCK_SPECIAL) { X--- X> if (rw_flag == WRITING && block_spec == 0) { X111,113c115,117 X< if (rip->i_pipe && (r = pipe_check(rip, rw_flag, virg, X< nbytes, &position)) <= 0) return(r); X< X--- X> if (rip->i_pipe && X> (r = pipe_check(rip, rw_flag, nbytes, position)) <= 0) X> return r; X120c124 X< if (rw_flag == READING) { X--- X> if (rw_flag == READING || (block_spec && rw_flag == WRITING)) { X137d140 X< virg = FALSE; /* tells pipe_check() that data has been copied */ X143,144c146 X< if (mode_word != I_CHAR_SPECIAL && mode_word != I_BLOCK_SPECIAL && X< position > f_size) X--- X> if (char_spec == 0 && block_spec == 0 && position > f_size) X220c222,223 X< if(rw_flag == WRITING && off == 0 && position >= rip->i_size) n=NO_READ; X--- X> if(rw_flag == WRITING && !block_spec && X> off == 0 && position >= rip->i_size) n=NO_READ; X263c266 X< if ( (z = rip->i_zone[zone]) == NO_ZONE) return(NO_BLOCK); X--- X> if ( (z = rip->i_zone[(int) zone]) == NO_ZONE) return(NO_BLOCK); X280c283 X< z = bp->b_ind[excess/NR_INDIRECTS]; /* z is zone # for single ind */ X--- X> z = bp->b_ind[(int)(excess/NR_INDIRECTS)];/*z is zone # for single ind*/ X285c288 X< /* 'z' is zone number for single indirect block; 'excess' is index into it. */ X--- X> /* 'z' is zone num for single indirect block; 'excess' is index into it. */ X289,290c292,293 X< z = bp->b_ind[excess]; X< put_block(bp, INDIRECT_BLOCK); /* release single indirect blk */ X--- X> z = bp->b_ind[(int) excess]; X> put_block(bp, INDIRECT_BLOCK); /* release single indir blk */ + END-OF-FILE read.c.diff chmod 'u=rw,g=r,o=r' 'read.c.diff' set `wc -c 'read.c.diff'` count=$1 case $count in 2579) :;; *) echo 'Bad character count in ''read.c.diff' >&2 echo 'Count should be 2579' >&2 esac echo Extracting 'super.c.diff' sed 's/^X//' > 'super.c.diff' << '+ END-OF-FILE ''super.c.diff' X125c125 X< a = i + (wptr - &bp->b_int[0])*INT_BITS X--- X> a = i + (int)(wptr - &bp->b_int[0])*INT_BITS X153c153 X< /* Return a zone or inode by turning on its bitmap bit. */ X--- X> /* Return a zone or inode by turning off its bitmap bit. */ X166c166 X< bp->b_int[w] &= ~(1 << bit); /* turn the bit on */ X--- X> bp->b_int[w] &= ~(1 << bit); /* turn the bit off */ + END-OF-FILE super.c.diff chmod 'u=rw,g=r,o=r' 'super.c.diff' set `wc -c 'super.c.diff'` count=$1 case $count in 369) :;; *) echo 'Bad character count in ''super.c.diff' >&2 echo 'Count should be 369' >&2 esac echo Extracting 'super.h.diff' sed 's/^X//' > 'super.h.diff' << '+ END-OF-FILE ''super.h.diff' X30c30 X< int s_magic; /* magic number to recognize super-blocks */ X--- X> short s_magic; /* magic number to recognize super-blocks */ + END-OF-FILE super.h.diff chmod 'u=rw,g=r,o=r' 'super.h.diff' set `wc -c 'super.h.diff'` count=$1 case $count in 139) :;; *) echo 'Bad character count in ''super.h.diff' >&2 echo 'Count should be 139' >&2 esac echo Extracting 'system.c.diff' sed 's/^X//' > 'system.c.diff' << '+ END-OF-FILE ''system.c.diff' X15a16 X> * SYS_KILL cause a signal to be sent via MM X42a44,45 X> * | SYS_KILL | proc_nr | sig | | | X> * ------------------------------------------------------ X95a99 X> case SYS_KILL: r = do_kill(&m); break; X215c219 X< set_name(k, sp); /* save command string for F1 display */ X--- X> set_name(k, (char *)sp); /* save command string for F1 display */ X241d244 X< unready(rc); X242a246 X> if (rc->p_flags == 0) unready(rc); X372a377,395 X> * do_kill * X> *===========================================================================*/ X> PRIVATE int do_kill(m_ptr) X> message *m_ptr; /* pointer to request message */ X> { X> /* Handle sys_kill(). Cause a signal to be sent to a process via MM. */ X> X> int proc_nr; /* process number */ X> int sig; /* signal number 1-16 */ X> X> proc_nr = m_ptr->PR; /* process being signalled */ X> sig = m_ptr->SIGNUM; /* signal number, 1 to 16 */ X> if (proc_nr < LOW_USER || proc_nr >= NR_PROCS) return(E_BAD_PROC); X> cause_sig(proc_nr, sig); X> return(OK); X> } X> X> X> /*===========================================================================* X424,425c447,448 X< * free, a message is sent. The calling task always gets control back from X< * cause_sig() immediately. X--- X> * free, a message is sent. The calling process is blocked as long as X> * p_pending is non-zero. X428c451 X< register struct proc *rp; X--- X> register struct proc *rp, *mmp; X431c454,457 X< if (rp->p_pending == 0) sig_procs++; /* incr if a new proc is now pending */ X--- X> if ((rp->p_flags & PENDING) == 0) X> sig_procs++; /* incr if a new proc is now pending */ X> if (rp->p_flags == 0) unready(rp); X> rp->p_flags |= PENDING; X433c459,463 X< inform(MM_PROC_NR); /* see if MM is free */ X--- X> X> mmp = proc_addr(MM_PROC_NR); X> if ( ((mmp->p_flags & RECEIVING) == 0) || mmp->p_getfrom != ANY) X> return; X> inform(); X440,441c470 X< PUBLIC inform(proc_nr) X< int proc_nr; /* MM_PROC_NR or FS_PROC_NR */ X--- X> PUBLIC inform() X450c479 X< register struct proc *rp, *mmp; X--- X> register struct proc *rp; X452,455d480 X< /* If MM is not waiting for new input, forget it. */ X< mmp = proc_addr(proc_nr); X< if ( ((mmp->p_flags & RECEIVING) == 0) || mmp->p_getfrom != ANY) return; X< X458c483 X< if (rp->p_pending != 0) { X--- X> if (rp->p_flags & PENDING) { X463c488 X< if (mini_send(HARDWARE, proc_nr, &m) != OK) X--- X> if (mini_send(HARDWARE, MM_PROC_NR, &m) != OK) X465a491,492 X> rp->p_flags &= ~PENDING; X> if (rp->p_flags == 0) ready(rp); X504c531 X< seg_base = seg_base << CLICK_SHIFT; /* segment orgin in bytes */ X--- X> seg_base = seg_base << CLICK_SHIFT; /* segment origin in bytes */ + END-OF-FILE system.c.diff chmod 'u=rw,g=r,o=r' 'system.c.diff' set `wc -c 'system.c.diff'` count=$1 case $count in 2682) :;; *) echo 'Bad character count in ''system.c.diff' >&2 echo 'Count should be 2682' >&2 esac echo Extracting 'table.c.diff' sed 's/^X//' > 'table.c.diff' << '+ END-OF-FILE ''table.c.diff' X15c15 X< * be declared for real somewhere. That is done here, but redefining X--- X> * be declared for real somewhere. That is done here, by redefining X27a28 X> #include "../h/com.h" X36a38,41 X> #ifdef AM_KERNEL X> extern int amoeba_task(); X> extern int amint_task(); X> #endif X42,44c47,99 X< int (*task[NR_TASKS+INIT_PROC_NR+1])() = { X< printer_task, tty_task, winchester_task, floppy_task, mem_task, X< clock_task, sys_task, 0, 0, 0, 0 X--- X> #define SMALL_STACK 256 X> X> #define TTY_STACK SMALL_STACK X> #define PRINTER_STACK SMALL_STACK X> #define WINCH_STACK SMALL_STACK X> #define FLOP_STACK SMALL_STACK X> #define MEM_STACK SMALL_STACK X> #define CLOCK_STACK SMALL_STACK X> #define SYS_STACK SMALL_STACK X> X> X> X> #ifdef AM_KERNEL X> # define AMINT_STACK SMALL_STACK X> # define AMOEBA_STACK 1532 X> # define AMOEBA_STACK_SPACE (AM_NTASKS*AMOEBA_STACK + AMINT_STACK) X> #else X> # define AMOEBA_STACK_SPACE 0 X> #endif X> X> #define TOT_STACK_SPACE (TTY_STACK + AMOEBA_STACK_SPACE + \ X> PRINTER_STACK + WINCH_STACK + FLOP_STACK + \ X> MEM_STACK + CLOCK_STACK + SYS_STACK) X> X> /* X> ** some notes about the following table: X> ** 1) The tty_task should always be first so that other tasks can use printf X> ** if their initialisation has problems. X> ** 2) If you add a new kernel task, add it after the amoeba_tasks and before X> ** the printer task. X> ** 3) The task name is used for process status (F1 key) and must be six (6) X> ** characters in length. Pad it with blanks if it is too short. X> */ X> X> PUBLIC struct tasktab tasktab[] = { X> tty_task, TTY_STACK, "TTY ", X> #ifdef AM_KERNEL X> amint_task, AMINT_STACK, "AMINT ", X> amoeba_task, AMOEBA_STACK, "AMTASK", X> amoeba_task, AMOEBA_STACK, "AMTASK", X> amoeba_task, AMOEBA_STACK, "AMTASK", X> amoeba_task, AMOEBA_STACK, "AMTASK", X> #endif X> printer_task, PRINTER_STACK, "PRINTR", X> winchester_task, WINCH_STACK, "WINCHE", X> floppy_task, FLOP_STACK, "FLOPPY", X> mem_task, MEM_STACK, "RAMDSK", X> clock_task, CLOCK_STACK, "CLOCK ", X> sys_task, SYS_STACK, "SYS ", X> 0, 0, "HARDWR", X> 0, 0, "MM ", X> 0, 0, "FS ", X> 0, 0, "INIT " X45a101,123 X> X> int t_stack[TOT_STACK_SPACE/sizeof (int)]; X> X> int k_stack[K_STACK_BYTES/sizeof (int)]; /* The kernel stack. */ X> X> X> /* X> ** The number of kernel tasks must be the same as NR_TASKS. X> ** If NR_TASKS is not correct then you will get the compile error: X> ** multiple case entry for value 0 X> ** The function ___dummy is never called. X> */ X> X> #define NKT (sizeof tasktab / sizeof (struct tasktab) - (INIT_PROC_NR + 1)) X> ___dummy() X> { X> switch(0) X> { X> case 0: X> case (NR_TASKS == NKT): X> ; X> } X> } + END-OF-FILE table.c.diff chmod 'u=rw,g=r,o=r' 'table.c.diff' set `wc -c 'table.c.diff'` count=$1 case $count in 2671) :;; *) echo 'Bad character count in ''table.c.diff' >&2 echo 'Count should be 2671' >&2 esac echo Extracting 'time.c.diff' sed 's/^X//' > 'time.c.diff' << '+ END-OF-FILE ''time.c.diff' X42a43 X> if (read_only(rip) != OK) r = EROFS; /* not even su can touch if R/O */ + END-OF-FILE time.c.diff chmod 'u=rw,g=r,o=r' 'time.c.diff' set `wc -c 'time.c.diff'` count=$1 case $count in 82) :;; *) echo 'Bad character count in ''time.c.diff' >&2 echo 'Count should be 82' >&2 esac echo Extracting 'type.h.diff' sed 's/^X//' > 'type.h.diff' << '+ END-OF-FILE ''type.h.diff' X7d6 X< X20a20,25 X> X> PUBLIC struct tasktab { X> int (*initial_pc)(); X> int stksize; X> char name[8]; X> }; + END-OF-FILE type.h.diff chmod 'u=rw,g=r,o=r' 'type.h.diff' set `wc -c 'type.h.diff'` count=$1 case $count in 107) :;; *) echo 'Bad character count in ''type.h.diff' >&2 echo 'Count should be 107' >&2 esac echo Extracting 'utility.c.diff' sed 's/^X//' > 'utility.c.diff' << '+ END-OF-FILE ''utility.c.diff' X45,46c45,48 X< sp->s_time = clock_mess.NEW_TIME; /* update super block time */ X< if (sp->s_rd_only == FALSE) sp->s_dirt = DIRTY; X--- X> if (sp) { X> sp->s_time = clock_mess.NEW_TIME; /* update super block time */ X> if (sp->s_rd_only == FALSE) sp->s_dirt = DIRTY; X> } + END-OF-FILE utility.c.diff chmod 'u=rw,g=r,o=r' 'utility.c.diff' set `wc -c 'utility.c.diff'` count=$1 case $count in 274) :;; *) echo 'Bad character count in ''utility.c.diff' >&2 echo 'Count should be 274' >&2 esac echo Extracting 'write.c.diff' sed 's/^X//' > 'write.c.diff' << '+ END-OF-FILE ''write.c.diff' X61c61 X< rip->i_zone[zone] = new_zone; X--- X> rip->i_zone[(int) zone] = new_zone; X112c112 X< bp->b_ind[excess] = new_zone; X--- X> bp->b_ind[(int) excess] = new_zone; + END-OF-FILE write.c.diff chmod 'u=rw,g=r,o=r' 'write.c.diff' set `wc -c 'write.c.diff'` count=$1 case $count in 168) :;; *) echo 'Bad character count in ''write.c.diff' >&2 echo 'Count should be 168' >&2 esac echo Extracting 'xt_wini.c.diff' sed 's/^X//' > 'xt_wini.c.diff' << '+ END-OF-FILE ''xt_wini.c.diff' X35c35 X< #define AU TO_BIOS TRUE /* TRUE: use Western's autoconfig BIOS */ X--- X> /*#define AUTO_BIOS TRUE /* TRUE: use Western's autoconfig BIOS */ X771,772c771,774 X< if (w_do_rdwt(&w_mess) != BLOCK_SIZE) X< panic("Can't read partition table of winchester ", i); X--- X> if (w_do_rdwt(&w_mess) != BLOCK_SIZE) { X> printf("Can't read partition table of winchester %d ", i); X> continue; X> } + END-OF-FILE xt_wini.c.diff chmod 'u=rw,g=r,o=r' 'xt_wini.c.diff' set `wc -c 'xt_wini.c.diff'` count=$1 case $count in 403) :;; *) echo 'Bad character count in ''xt_wini.c.diff' >&2 echo 'Count should be 403' >&2 esac exit 0