worsley@ditmela.oz (Andrew Worsley) (05/18/89)
#! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of archive 2 (of 10)." # Contents: kerneldif/CHANGES fsdif/cache.c.cdif fsdif/inode.c.cdif # fsdif/main.c.cdif fsdif/misc.c.cdif fsdif/pipe.c.cdif # fsdif/super.c.cdif fsdif/table.c.cdif fsdif/utility.c.cdif # hdif/boot.h.cdif hdif/com.h.cdif hdif/const.h.cdif # kerneldif/Bconsole.c.cdi kerneldif/Brs232.c.cdif # Wrapped by sys@besplex on Sun Mar 26 06:33:48 1989 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'kerneldif/CHANGES' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'kerneldif/CHANGES'\" else echo shar: Extracting \"'kerneldif/CHANGES'\" \(13586 characters\) sed "s/^X//" >'kerneldif/CHANGES' <<'END_OF_FILE' XGeneral: X o Used the macros in proc.h to avoid magic numbers all over. X The old macro for proc_addr() was slow (array indexing). X The old conversion from a proc pointer to a proc number was even X slower (pointer subtraction). X The new macro for proc_addr() is unfortunately slower for constant X process numbers so cproc_addr() is used for those. X o Eliminated most of the hardware segment arithmetic. X This was the main thing standing between the C code and protected X mode. X WARNING: Amoeba still has some, so won't work with this kernel. X o Changed interrupt handling to better suit level sensitive X interrupts on PS/2's and to reduce latency. X WARNING: even PS/2-30's (which used to work) may be broken. X WARNING: The ethernet driver needs some minor changes to match. X o Converted all assembler (.s) files to preprocessor (.x) files. X This greatly simplifies the maintenance of constants across C and X assembler code. X The header file 'sglo.h' is used to centralize all declarations X of assembler variables. X o Started to remove saving and restoring of the interrupt enable X state (1.2 did it better). X The state should always be known since disabling interrupts for a X whole function call is bad. Xaxmakefile: X o NEW, the complicated makefile which I use to build many variations X of the kernel. X See the installation guide. Xconst.h: X o Changed almost everything. X o INIT_SP is fixed. X o Hardware VECTOR's are parametrized by IRQ's since this kernel needs X to change the vector bases. X o Introduced HCLICK_SIZE since CLICK_SIZE was being confused with X the hardware click size. X o Made the requirement for stack alignment explicit. Xglo.h: X o Removed globals realtime, lost_ticks, cur_proc, prev_proc, int_mess. X Interrupt() no longer has to know about the internals of the X clock task. X Much time is saved by always using proc_ptr to access the current X process. X Interrupt messages are no longer necessary, they are passed around X as numbers. X o Added some new globals and centralized some other declarations. X Things like umap() are redeclared too often. X The 'snow' flag should be set for cheap CGA's (in console.c). X The old console driver incorrectly assumed snow removal was X necessary on non-mono non-EGA's. Xproc.h: X o Replaced the array of registers by a union and merged the pc_psw X structure with it. X It was inconsistent to treat pc_psw specially (the processor X decides the order of pc_psw but in practice pc_psw is copied X elsewhere in real mode and the processor decides the best order X of all the registers in protected mode). X The union could be a structure in this implementation. X o Added fields for p_ldt_sel and p_ldt for protected mode segments. X o Added fields p_int_blocked, p_int_held and p_next_held for new X interrupt handling. X o Added field p_pendcount and defined SIG_PENDING for signal handling X bug fix. X o Defined many macros to eliminate magic numbers. X o Eliminated busy_map and task_message globals. X The use of these was the worst bottleneck in the old interrupt(). Xsconst.h: X o NEW, constants and macros not already defined in the C header X files are defined here along with some macros for 286 code. X There are also macros to let me use my 386 assembler instead X of asld. X Unfortunately, DOS assemblers like MASM are too different to X use the same trick. X Unfortunately, asld wants "[]" for parentheses in expressions, X so some of the C definitions had to be explicit constants X rather than expressions, to avoid breaking either cc or asld. X o WARNING: there are still lots of magic numbers in the old klib88 X code. Xsglo.h: X o NEW, ALL globals used by the assembler code are declared here. X A macro trick like "#define EXTERN" for the C code is used to X set up the correct .define's and .extern's. Xtype.h: X o Deleted struct pc_psw (now part of stack frame structure). X o Deleted struct sig_info (already no longer used). X o Added typedef's for scalar types of size 8, 16, 32 bits. X Using chars, shorts, ints and longs directly leaves too many X things dependent on the compiler. X o Added stack frame structure suitable for 8088 through 80286. X o Added segment descriptor structure for protected mode. X Most protected mode things are in protect.h and protect.c, but X this structure is needed in the process table. Xat_wini.c: X o Deleted all explicit locking. X The task provides adequate protection. X o Changed dma_read() to port_read() for protected mode. X o Same for dma_write(). X o Fixed bug with port_read() and win_results() done in wrong order. X The interrupt happens when the data is ready, not when it is read. X o Changed win_results() to old_win_results() so new one could do more. X o Wrapped some code with #ifdef STUPID_WINI_ADJUST. X The offending code causes the first sector on partitions starting X on an odd boundary to be lost. X There is still a problem if the total number of sectors on the X partition is odd. X o Added a new win_results() for the new interrupt handling scheme. X Same as old one except that it clears the AT wini interrupt mask. X There are too many exit points in the old win_results() to do this X conveniently directly. Xclock.c: X o Replaced CLOCK_TICK with HARD_INT. X It was slower to distinguish them. X o Deleted FLUSH_MASK and flush_flag. X They really belong to TTY. X o Defined TIMER_COUNT for cleaner init. X o Made globals realtime and lost_ticks into private variables. X The locking is tricky enough when they are private! X Lost_ticks is renamed pending_ticks and made a long. X o Moved printer restart logic to PRINTER task. X o Rewrote init_clock(). X o Did accounting() inline. X o Added low level clock interrupt handler. X See code for comments - there are many races to guard against. Xconsole.c: X WARNING: These changes are half-hearted since I usually use the X console.c posted with my tty driver. X o Extra initialization for protected mode. X Special video segments have to be used for protected mode. X COLOR_BASE and MONO_BASE are defined (differently, in phys_bytes) X in const.h for experimentally using screen memory for programs. X o Added locking to keyboard(). X Keyboard() may now be interrupted by RS232. X o Removed segment arithmetic and replaced get_byte() by X get_physbyte() for protected mode. X o Added enable_irq() so main.c doesn't have to enable keyboard X interrupt too early. X o Added scan_keyboard() for wreboot to use. Xdmp.c: X o Changed output formatting for larger numbers in protected mode. X o Changed references to registers in process table. X o Cleaned up click to K conversions. X o Fixed wild array index in aout[NSIZE]. X o Made other unnecessary changes to simplify code. Xexception.c: X o NEW, replaces some exception handlers in main.c X This should eventually contain stack fault handlers and page X fault handlers, etc. Xfloppy.c: X o Deleted redundant olivetti variable. X o Deleted all explicit locking, changed fdc_results(). X Same as for at_wini.c Xi8259.c: X o NEW, handles initialization of the interrupt controller. X Needed since the BIOS init mixes hardware interrupts into vectors X reserved for exceptions (and used on 286's and above). Xklib286.x: X o NEW, duplicates all functions in klib88.x which have to be X implemented differently in protected mode. X It contains an initialization routine which applies the necessary X patches. Xklib88.x: X o NEW, a rewrite of klib88.s. X Many routines are new or totally rewritten and/or renamed X for compatibility with protected mode. X WARNING: klib88.s will be obliterated when 'make' is run. Xmain.c: X o Moved trap() and unexpected_int() to exception.c. X o Included boot.h to get at limit on processor type. X 386 and 286 systems need to be run as 8088's for testing. X o Included debugger support. X Rest of debugger is not in this posting. X o Made many small changes. X The memory maps were not initialized right. X The 8259 mask was not initialized right. Xmemory.c: X o Fixed bugs in initialization of /dev/kmem. X The bad use of get_base() is a good example of how the wrong X approach leads to trouble for protected mode - and larger changes. X o Initialized /dev/mem with size depending on processor. X WARNING: the inode has the wrong size of 640K. X o Added /dev/port. X o Deleted special treatment of extended memory. X Phys_copy() has extra intelligence to deal with it, and MM X can map it now CLICK_SIZE is 256. Xmisc.c: X o NEW, now contains only a routine to initialize tables of memory. Xmpx286.x: X o NEW, duplicates all interrupt handlers and functions in mpx88.x X which have to be implemented differently in protected mode. X A few patches are necessary (they are done by klib286). X The interrupt vectors do not need patching since a new interrupt X table is set up in protect.c and loaded just once in p_restart. Xmpx88.x: X o NEW, a rewrite of mpx88.s. X o The startup code copies the boot parameters (if any) provided by X the boot loader. X o All interrupt handlers now use the 8259 to stop nested interrupts X from the same device, but allow interrupts from other devices. X o Save and restart are rewritten for speed and to save registers X in the same order as for protected mode (where the correct order X is more important). Xprinter.c: X WARNING: these changes are not well tested since I rarely use the X printer. X o Fixed bug with no reply in default case of message handler. X o Changed locking to use mask rather than lock everything. X The printer code is still awful. X o Eliminated segment arithmetic as for console.c. X o Put message content in variable 'done_status' since new interrupt X messages can have no content. X o Checked for printer restart here instead of clock.c. X The locking is very tricky and it is best for clock.c not to know. Xproc.c: X o Converted most of the public routines to locked variants. X The way the system task (privilege 1 in protected mode) calls X the kernel (context switcher, privilege 0) is potentially X dangerous. X o Rewrote interrupt() for speed. X The method is simpler (particularly the way blocked interrupts X are dispatched by the check in mini_rec()), but this is obscured X by the complications needed to allow interrupt() to run with X interrupts enabled. X o Made many small changes to use proc pointers instead of proc X numbers. X o Passed return code from syscall() back to assembly code to handle. X This is faster and reduces the number of registers that the C X code has to know about. X o Speeded up most of the smaller functions by avoiding index X calculations. X o Simplified pick_proc() by making IDLE a normal process. X o Added function unhold() to finish off the new interrupt handling. Xprotect.c: X o NEW, initialization and segment building for protected mode. Xprotect.h: X o NEW, various constants for protected mode. Xrs2.x: X o NEW, replaces rs2.s for my tty driver. Xrs232.c: X WARNING: These changes are half-hearted since I usually use the X rs232.c posted with my tty driver. X This one remains full of bugs, mostly old but it's hard to tell. X o Added lock()'s after calling interrupt() since new interrupt() X may unlock(). X o Eliminated segment arithmetic as for console.c. X o Fix attempted lock() around whole system call in tty_o_done(). X The new syscall handler unlocks, so a safer lock is required. X o Added glue routines to match new interrupt handling. Xsystem.c: X o Added SYS_GBOOT, SYS_UMAP and SYS_MEM system calls. X SYS_GBOOT to pass boot parameters to FS. X SYS_UMAP and SYS_MEM to replace improper memory handling in FS X and MM. X o Changed references to registers in process table. X WARNING: the types used by MM to share the stack pointer and X signal catcher are bogus. X There is only a conventional relationship between C pointers X and machine registers. X o Made many small changes to use register pointers more and eliminate X local variables. X o Locked access to user and system times in do_exec() and do_times(). X This is necessary because these times are now updated below the X task level in the clock interrupt handler. X o Changed do_fork(), do_exec(), do_sig() and cause_sig() as part X of fix of signal handling bug. X Processes undergoing signal handling are now kept off the ready X queue by the SIG_PENDING flag and the p_pendcount count. X MM has to send a message to say it is finished. X A kludged form of SYS_SIG is used. X o Called lockpick_proc() from inform() to run MM soon if inform() X was invoked by an exception in a user process. X o Added alloc_segments(). X All segment register setup is now done here. X This is the only place in the old C code which is fundamentally X different for protected mode. Xtable.c: X o Added IDLE task. X o Moved declaration of kernel stack to assembler code. X o Used a char array to allocate task stacks out of. X The int array is only a kludge for word alignment and complicates X the arithmetic in main.c and is inadequate for doubleword X alignment for 386's. Xtty.c: X WARNING: These changes are half-hearted since I usually use the X tty.c posted with my tty driver. X There a few known bugs in tty, but it's probably safe to use it X with the console driver (but not RS232). X o Avoided getting the tty_driver_buf pointer out of the interrupt X message since the new interrupt messages can have no content. Xxt_wini.c: X o Deleted all explicit locking, changed win_results(). X Same as for at_wini.c X o Fixed the misspelled copy_param. X This bug has been known for years. X o Wrapped some code with #ifdef STUPID_WINI_ADJUST, as for at_wini.c. END_OF_FILE if test 13586 -ne `wc -c <'kerneldif/CHANGES'`; then echo shar: \"'kerneldif/CHANGES'\" unpacked with wrong size! fi # end of 'kerneldif/CHANGES' fi if test -f 'fsdif/cache.c.cdif' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'fsdif/cache.c.cdif'\" else echo shar: Extracting \"'fsdif/cache.c.cdif'\" \(629 characters\) sed "s/^X//" >'fsdif/cache.c.cdif' <<'END_OF_FILE' X*** fs-1.3/cache.c Wed Aug 3 21:05:10 1988 X--- fs/cache.c Thu Jul 7 00:53:11 1988 X*************** X*** 17,18 **** X--- 17,19 ---- X #include "../h/error.h" X+ #include "../h/boot.h" X #include "const.h" X*************** X*** 212,217 **** X minor = (int) (sp->s_dev >> MINOR) & BYTE; X! if (sp->s_dev == ROOT_DEV) X! printf("No space on root device (RAM disk)\n"); X! else X! printf("No space on device %d/%d\n", major, minor); X return(NO_ZONE); X--- 213,216 ---- X minor = (int) (sp->s_dev >> MINOR) & BYTE; X! printf("No space on %sdevice %d/%d\n", X! sp->s_dev == ROOT_DEV ? "root " : "", major, minor); X return(NO_ZONE); END_OF_FILE if test 629 -ne `wc -c <'fsdif/cache.c.cdif'`; then echo shar: \"'fsdif/cache.c.cdif'\" unpacked with wrong size! fi # end of 'fsdif/cache.c.cdif' fi if test -f 'fsdif/inode.c.cdif' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'fsdif/inode.c.cdif'\" else echo shar: Extracting \"'fsdif/inode.c.cdif'\" \(651 characters\) sed "s/^X//" >'fsdif/inode.c.cdif' <<'END_OF_FILE' X*** fs-1.3/inode.c Thu Oct 6 22:19:28 1988 X--- fs/inode.c Fri Oct 7 22:28:02 1988 X*************** X*** 17,18 **** X--- 17,19 ---- X #include "../h/error.h" X+ #include "../h/boot.h" X #include "const.h" X*************** X*** 118,123 **** X minor = (int) (sp->s_dev >> MINOR) & BYTE; X! if (sp->s_dev == ROOT_DEV) X! printf("Out of i-nodes on root device (RAM disk)\n"); X! else X! printf("Out of i-nodes on device %d/%d\n", major, minor); X return(NIL_INODE); X--- 119,122 ---- X minor = (int) (sp->s_dev >> MINOR) & BYTE; X! printf("Out of i-nodes on %sdevice %d/%d\n", X! sp->s_dev == ROOT_DEV ? "root " : "", major, minor); X return(NIL_INODE); END_OF_FILE if test 651 -ne `wc -c <'fsdif/inode.c.cdif'`; then echo shar: \"'fsdif/inode.c.cdif'\" unpacked with wrong size! fi # end of 'fsdif/inode.c.cdif' fi if test -f 'fsdif/main.c.cdif' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'fsdif/main.c.cdif'\" else echo shar: Extracting \"'fsdif/main.c.cdif'\" \(7501 characters\) sed "s/^X//" >'fsdif/main.c.cdif' <<'END_OF_FILE' X*** fs-1.3/main.c Thu Oct 6 22:25:19 1988 X--- fs/main.c Wed Mar 22 15:15:27 1989 X*************** X*** 19,20 **** X--- 19,21 ---- X #include "../h/error.h" X+ #include "../h/boot.h" X #include "const.h" X*************** X*** 39,42 **** X #ifdef i8088 X! #define EM_ORIGIN 0x100000 /* origin of extended memory RAM disk on AT */ X! #define MAX_CRD 255 /* if root fs > MAX_CRD, use extended mem */ X #endif X--- 40,42 ---- X #ifdef i8088 X! FORWARD phys_bytes get_physbase(); X #endif X*************** X*** 143,145 **** X buf_pool(); /* initialize buffer pool */ X! load_ram(); /* Load RAM disk from root diskette. */ X load_super(); /* Load super block for root device */ X--- 143,146 ---- X buf_pool(); /* initialize buffer pool */ X! get_boot_parameters(); X! load_ram(); /* init RAM disk, load if it is root */ X load_super(); /* Load super block for root device */ X*************** X*** 184,186 **** X phys_bytes org; X- extern phys_clicks get_base(); X #endif X--- 185,186 ---- X*************** X*** 203,205 **** X for (bp = &buf[0]; bp < &buf[NR_BUFS]; bp++) { X! org = get_base() << CLICK_SHIFT; /* phys addr where FS is */ X low_off = (vir_bytes) bp->b_data; X--- 203,205 ---- X for (bp = &buf[0]; bp < &buf[NR_BUFS]; bp++) { X! org = get_physbase(); /* phys addr where FS is */ X low_off = (vir_bytes) bp->b_data; X*************** X*** 232,235 **** X { X! /* The root diskette contains a block-by-block image of the root file system X! * starting at 0. Go get it and copy it to the RAM disk. X */ X--- 232,236 ---- X { X! /* If the root device is the RAM disk, copy the entire root image device X! * block-by-block to a RAM disk with the same size as the image. X! * Otherwise, just allocate a RAM disk with size given in the boot parameters. X */ X*************** X*** 241,245 **** X block_nr i; X! dev_nr root_device; X phys_clicks ram_clicks, init_org, init_text_clicks, init_data_clicks; X- long base; X extern phys_clicks data_org[INFO + 2]; X--- 242,245 ---- X block_nr i; X! dev_nr root_device; /* this should be called boot_device */ X phys_clicks ram_clicks, init_org, init_text_clicks, init_data_clicks; X extern phys_clicks data_org[INFO + 2]; X*************** X*** 251,255 **** X init_data_clicks = data_org[INFO + 2]; X- base = (long) init_org + (long) init_text_clicks + (long) init_data_clicks; X- base = base << CLICK_SHIFT; X X /* Get size of RAM disk by reading root file system's super block. X--- 251,259 ---- X init_data_clicks = data_org[INFO + 2]; X X+ /* If the root device is specified in the boot parameters, use it. */ X+ if (ROOT_DEV != DEV_RAM) { X+ count = boot_parameters.bp_ramsize; X+ goto got_root_dev; /* kludge to avoid excessive indent/diffs */ X+ } X+ X /* Get size of RAM disk by reading root file system's super block. X*************** X*** 279,297 **** X count = sp->s_nzones << sp->s_log_zone_size; /* # blocks on root dev */ X if (count > MAX_RAM) panic("RAM disk is too big. # blocks = ", count); X ram_clicks = count * (BLOCK_SIZE/CLICK_SIZE); X- put_block(bp, FULL_DATA_BLOCK); X X- #ifdef i8088 X- /* There are two possibilities now (by convention): X- * count < MAX_CRD ==> RAM disk is in core X- * count >=MAX_CRD ==> RAM disk is in extended memory (AT only) X- * In the latter case, tell MM that RAM disk size is 0 and tell the ram disk X- * driver than the device begins at 1MB. X- */ X- if (count > MAX_CRD) { X- ram_clicks = 0; /* MM does not have to allocate any core */ X- base = EM_ORIGIN; /* tell RAM disk driver RAM disk origin */ X- } X- #endif X- X /* Tell MM the origin and size of INIT, and the amount of memory used for the X--- 283,289 ---- X count = sp->s_nzones << sp->s_log_zone_size; /* # blocks on root dev */ X+ put_block(bp, FULL_DATA_BLOCK); X+ got_root_dev: X if (count > MAX_RAM) panic("RAM disk is too big. # blocks = ", count); X ram_clicks = count * (BLOCK_SIZE/CLICK_SIZE); X X /* Tell MM the origin and size of INIT, and the amount of memory used for the X*************** X*** 310,315 **** X X! /* Tell RAM driver where RAM disk is and how big it is. */ X m1.m_type = DISK_IOCTL; X m1.DEVICE = RAM_DEV; X- m1.POSITION = base; X m1.COUNT = count; X--- 302,308 ---- X X! /* Tell RAM driver where RAM disk is and how big it is. The BRK2 call has X! * filled in the m1.POSITION field. X! */ X m1.m_type = DISK_IOCTL; X m1.DEVICE = RAM_DEV; X m1.COUNT = count; X*************** X*** 317,325 **** X X /* Copy the blocks one at a time from the root diskette to the RAM */ X- #ifdef i8088 X- if (ram_clicks == 0) X- printf("RAM disk of %d blocks is in extended memory\n\n", count); X- #endif X #ifdef FASTLOAD X! fastload(root_device, (char *)base); X #else X--- 310,318 ---- X X+ /* If the root device is not the RAM disk, it doesn't need loading. */ X+ if (ROOT_DEV != DEV_RAM) X+ return; X+ X /* Copy the blocks one at a time from the root diskette to the RAM */ X #ifdef FASTLOAD X! fastload(root_device, (char *) m1.POSITION); /* assumes 32 bit pointers */ X #else X*************** X*** 327,328 **** X--- 320,341 ---- X for (i = 0; i < count; i++) { X+ /* Prefetch blocks into cache according to interleave. X+ * The floppy driver should be rewritten to do this and should attain X+ * an interleave of 1 even on slow PC's. X+ * Here we can only handle interleave > 1. X+ * 2 is good for AT's, but nothing seems to help PC's. X+ * Assume standard DOS format with interleave of 1. X+ */ X+ #define N_PREFETCH 11 /* prime > blocks/track on all floppy types */ X+ #define INTERLEAVE 2 X+ if (i % N_PREFETCH == 0) { X+ int j, k; X+ X+ for (k = j = 0; j < N_PREFETCH; ++j, k += INTERLEAVE) { X+ if (k > N_PREFETCH) X+ k -= N_PREFETCH; X+ if (i + k < count) X+ put_block(get_block(root_device, i + k, X+ NORMAL), NORMAL); X+ } X+ } X bp = get_block(root_device, (block_nr) i, NORMAL); X*************** X*** 338,340 **** X X! if (root_device == BOOT_DEV) X printf("\rRAM disk loaded. Please remove root diskette. \n\n"); X--- 351,353 ---- X X! if ( ((root_device ^ DEV_FD0) & ~BYTE) == 0 ) X printf("\rRAM disk loaded. Please remove root diskette. \n\n"); X*************** X*** 506 **** X--- 519,559 ---- X #endif FASTLOAD X+ X+ /*===========================================================================* X+ * get_boot_parameters * X+ *===========================================================================*/ X+ PUBLIC struct bparam_s boot_parameters = /* overwritten if new kernel */ X+ { X+ DROOTDEV, DRAMIMAGEDEV, DRAMSIZE, DSCANCODE, X+ }; X+ X+ PRIVATE get_boot_parameters() X+ { X+ /* Ask kernel for boot parameters. */ X+ X+ struct bparam_s temp_parameters; X+ X+ m1.m_type = SYS_GBOOT; X+ m1.PROC1 = FS_PROC_NR; X+ m1.MEM_PTR = (char *) &temp_parameters; X+ if (sendrec(SYSTASK, &m1) == OK && m1.m_type == OK) X+ boot_parameters = temp_parameters; X+ } X+ X+ #ifdef i8088 X+ /*===========================================================================* X+ * get_physbase * X+ *===========================================================================*/ X+ PRIVATE phys_bytes get_physbase() X+ { X+ /* Ask kernel for base of fs data space. */ X+ X+ m1.m_type = SYS_UMAP; X+ m1.SRC_PROC_NR = FS_PROC_NR; X+ m1.SRC_SPACE = D; X+ m1.SRC_BUFFER = 0; X+ m1.COPY_BYTES = 1; X+ if (sendrec(SYSTASK, &m1) != OK || m1.SRC_BUFFER == 0) X+ panic("Can't get fs base", NO_NUM); X+ return m1.SRC_BUFFER; X+ } X+ #endif END_OF_FILE if test 7501 -ne `wc -c <'fsdif/main.c.cdif'`; then echo shar: \"'fsdif/main.c.cdif'\" unpacked with wrong size! fi # end of 'fsdif/main.c.cdif' fi if test -f 'fsdif/misc.c.cdif' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'fsdif/misc.c.cdif'\" else echo shar: Extracting \"'fsdif/misc.c.cdif'\" \(200 characters\) sed "s/^X//" >'fsdif/misc.c.cdif' <<'END_OF_FILE' X*** fs-1.3/misc.c Wed Aug 3 21:05:13 1988 X--- fs/misc.c Thu Jul 7 02:14:48 1988 X*************** X*** 18,19 **** X--- 18,20 ---- X #include "../h/error.h" X+ #include "../h/boot.h" X #include "const.h" END_OF_FILE if test 200 -ne `wc -c <'fsdif/misc.c.cdif'`; then echo shar: \"'fsdif/misc.c.cdif'\" unpacked with wrong size! fi # end of 'fsdif/misc.c.cdif' fi if test -f 'fsdif/pipe.c.cdif' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'fsdif/pipe.c.cdif'\" else echo shar: Extracting \"'fsdif/pipe.c.cdif'\" \(733 characters\) sed "s/^X//" >'fsdif/pipe.c.cdif' <<'END_OF_FILE' X*** fs-1.3/pipe.c Wed Aug 3 21:05:15 1988 X--- fs/pipe.c Wed Oct 26 21:08:12 1988 X*************** X*** 23,24 **** X--- 23,25 ---- X #include "type.h" X+ #include "dev.h" X #include "file.h" X*************** X*** 247,251 **** X mess.PROC_NR = proc_nr; X! mess.COUNT = f->filp_mode; /* tell kernel whether R or W */ X mess.m_type = CANCEL; X! rw_dev(task, &mess); X revive(proc_nr, EINTR); /* signal interrupted call */ X--- 248,253 ---- X mess.PROC_NR = proc_nr; X! /* Tell kernel whether R or W. Mode is from current call, not open. */ X! mess.COUNT = (rfp->fp_fd & BYTE) == READ ? R_BIT : W_BIT; X mess.m_type = CANCEL; X! (*dmap[(dev >> MAJOR) & BYTE].dmap_rw)(task, &mess); X revive(proc_nr, EINTR); /* signal interrupted call */ END_OF_FILE if test 733 -ne `wc -c <'fsdif/pipe.c.cdif'`; then echo shar: \"'fsdif/pipe.c.cdif'\" unpacked with wrong size! fi # end of 'fsdif/pipe.c.cdif' fi if test -f 'fsdif/super.c.cdif' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'fsdif/super.c.cdif'\" else echo shar: Extracting \"'fsdif/super.c.cdif'\" \(202 characters\) sed "s/^X//" >'fsdif/super.c.cdif' <<'END_OF_FILE' X*** fs-1.3/super.c Wed Aug 3 21:05:17 1988 X--- fs/super.c Wed Feb 15 02:12:27 1989 X*************** X*** 19,20 **** X--- 19,21 ---- X #include "../h/error.h" X+ #include "../h/boot.h" X #include "const.h" END_OF_FILE if test 202 -ne `wc -c <'fsdif/super.c.cdif'`; then echo shar: \"'fsdif/super.c.cdif'\" unpacked with wrong size! fi # end of 'fsdif/super.c.cdif' fi if test -f 'fsdif/table.c.cdif' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'fsdif/table.c.cdif'\" else echo shar: Extracting \"'fsdif/table.c.cdif'\" \(596 characters\) sed "s/^X//" >'fsdif/table.c.cdif' <<'END_OF_FILE' X*** fs-1.3/table.c Wed Aug 3 21:05:17 1988 X--- fs/table.c Sat Oct 22 22:08:16 1988 X*************** X*** 117,119 **** X * next entry is major device 1, etc. Character and block devices can be X! * intermixed at random. If this ordering is changed, BOOT_DEV and ROOT_DEV X * must be changed to correspond to the new values. Note that the major X--- 117,119 ---- X * next entry is major device 1, etc. Character and block devices can be X! * intermixed at random. If this ordering is changed, the devices in h/boot.h X * must be changed to correspond to the new values. Note that the major END_OF_FILE if test 596 -ne `wc -c <'fsdif/table.c.cdif'`; then echo shar: \"'fsdif/table.c.cdif'\" unpacked with wrong size! fi # end of 'fsdif/table.c.cdif' fi if test -f 'fsdif/utility.c.cdif' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'fsdif/utility.c.cdif'\" else echo shar: Extracting \"'fsdif/utility.c.cdif'\" \(206 characters\) sed "s/^X//" >'fsdif/utility.c.cdif' <<'END_OF_FILE' X*** fs-1.3/utility.c Wed Aug 3 21:05:18 1988 X--- fs/utility.c Wed Feb 15 02:09:50 1989 X*************** X*** 15,16 **** X--- 15,17 ---- X #include "../h/error.h" X+ #include "../h/boot.h" X #include "const.h" END_OF_FILE if test 206 -ne `wc -c <'fsdif/utility.c.cdif'`; then echo shar: \"'fsdif/utility.c.cdif'\" unpacked with wrong size! fi # end of 'fsdif/utility.c.cdif' fi if test -f 'hdif/boot.h.cdif' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'hdif/boot.h.cdif'\" else echo shar: Extracting \"'hdif/boot.h.cdif'\" \(1346 characters\) sed "s/^X//" >'hdif/boot.h.cdif' <<'END_OF_FILE' X*** /dev/null Thu Oct 13 22:40:42 1988 X--- h/boot.h Wed Mar 1 14:26:46 1989 X*************** X*** 0 **** X--- 1,43 ---- X+ /* boot.h */ X+ X+ /* Redefine root and root image devices as variables. X+ * This keeps the diffs small but may cause future confusion. X+ */ X+ #define BOOT_DEV (boot_parameters.bp_ramimagedev) X+ #define ROOT_DEV (boot_parameters.bp_rootdev) X+ X+ /* Device numbers of RAM, floppy and hard disk devices. X+ * h/com.h defines RAM_DEV but only as the minor number. X+ */ X+ #define DEV_FD0 0x200 X+ #define DEV_HD0 0x300 X+ #define DEV_RAM 0x100 X+ X+ /* Default device numbers for root and root image. X+ * Root image is only used when root is /dev/ram. X+ */ X+ #define DRAMIMAGEDEV (DEV_FD0 + 0) X+ #define DROOTDEV (DEV_RAM + 0) X+ X+ /* Default RAM disk size. X+ * Not used if root is /dev/ram when size is from root image. X+ */ X+ #define DRAMSIZE 0 X+ X+ /* Default scan code to fake a PC keyboard. */ X+ #define DSCANCODE 13 X+ X+ /* Default processor type for no restriction (88 would force 386 to 88). */ X+ #define DPROCESSOR 0xFFFF X+ X+ /* Structure to hold boot parameters. */ X+ struct bparam_s X+ { X+ dev_nr bp_rootdev; X+ dev_nr bp_ramimagedev; X+ unsigned bp_ramsize; X+ unsigned bp_scancode; /* still put into BX for kernel */ X+ unsigned bp_processor; X+ }; X+ X+ extern struct bparam_s boot_parameters; END_OF_FILE if test 1346 -ne `wc -c <'hdif/boot.h.cdif'`; then echo shar: \"'hdif/boot.h.cdif'\" unpacked with wrong size! fi # end of 'hdif/boot.h.cdif' fi if test -f 'hdif/com.h.cdif' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'hdif/com.h.cdif'\" else echo shar: Extracting \"'hdif/com.h.cdif'\" \(1355 characters\) sed "s/^X//" >'hdif/com.h.cdif' <<'END_OF_FILE' X*** h-1.3/com.h Wed Aug 3 21:15:03 1988 X--- h/com.h Thu Mar 23 01:39:55 1989 X*************** X*** 50,51 **** X--- 50,53 ---- X X+ #define IDLE (AMOEBA_CLASS+1) /* task to run when there's nothing to run */ X+ X #define PRINTER -7 /* printer I/O class */ X*************** X*** 55,57 **** X #define FLOPPY -5 /* floppy disk class */ X- # define DISKINT 1 /* fcn code for disk interrupt */ X # define DISK_READ 3 /* fcn code to DISK (must equal TTY_READ) */ X--- 57,58 ---- X*************** X*** 65,66 **** X--- 66,70 ---- X # define NULL_DEV 3 /* minor device for /dev/null */ X+ #ifdef i8088 X+ # define PORT_DEV 4 /* minor device for /dev/port */ X+ #endif X X*************** X*** 68,70 **** X # define SET_ALARM 1 /* fcn code to CLOCK, set up alarm */ X- # define CLOCK_TICK 2 /* fcn code for clock tick */ X # define GET_TIME 3 /* fcn code to CLOCK, get real time */ X--- 72,73 ---- X*************** X*** 85,86 **** X--- 88,92 ---- X # define SYS_KILL 11 /* fcn code for sys_kill(proc, sig) */ X+ # define SYS_GBOOT 12 /* fcn code for sys_gboot(procno, bootptr) */ X+ # define SYS_UMAP 13 /* fcn code for sys_umap(procno, etc) */ X+ # define SYS_MEM 14 /* fcn code for sys_mem() */ X X*************** X*** 154 **** X--- 160,162 ---- X #endif AMOEBA X+ X+ #define HARD_INT 2 /* fcn code for all hardware interrupts */ END_OF_FILE if test 1355 -ne `wc -c <'hdif/com.h.cdif'`; then echo shar: \"'hdif/com.h.cdif'\" unpacked with wrong size! fi # end of 'hdif/com.h.cdif' fi if test -f 'hdif/const.h.cdif' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'hdif/const.h.cdif'\" else echo shar: Extracting \"'hdif/const.h.cdif'\" \(1785 characters\) sed "s/^X//" >'hdif/const.h.cdif' <<'END_OF_FILE' X*** h-1.3/const.h Thu Oct 6 03:32:57 1988 X--- h/const.h Wed Jan 18 23:13:40 1989 X*************** X*** 31,37 **** X #ifdef AM_KERNEL X! #define NR_TASKS 13 /* must be 5 more than without amoeba */ X #else X! #define NR_TASKS 8 /* number of tasks in the transfer vector */ X #endif X! #define NR_PROCS 16 /* number of slots in proc table */ X #define NR_SEGS 3 /* # segments per process */ X--- 31,37 ---- X #ifdef AM_KERNEL X! #define NR_TASKS 14 /* must be 5 more than without amoeba */ X #else X! #define NR_TASKS 9 /* number of tasks in the transfer vector */ X #endif X! #define NR_PROCS 32 /* number of slots in proc table */ X #define NR_SEGS 3 /* # segments per process */ X*************** X*** 45,48 **** X #ifdef i8088 X! #define CLICK_SIZE 0020 /* unit in which memory is allocated */ X! #define CLICK_SHIFT 4 /* log2 of CLICK_SIZE */ X #endif X--- 45,48 ---- X #ifdef i8088 X! #define CLICK_SIZE 256 /* unit in which memory is allocated */ X! #define CLICK_SHIFT 8 /* log2 of CLICK_SIZE */ X #endif X*************** X*** 53,54 **** X--- 53,62 ---- X X+ #define click_to_round_k(n) \ X+ ((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024)) X+ #if CLICK_SIZE < 1024 X+ #define k_to_click(n) ((n) * (1024 / CLICK_SIZE)) X+ #else X+ #define k_to_click(n) ((n) / (CLICK_SIZE / 1024)) X+ #endif X+ X /* Process numbers of some important processes */ X*************** X*** 77,82 **** X #define MAX_ISTACK_BYTES 2048 /* maximum initial stack size for EXEC */ X- X- /* Device numbers of root (RAM) and boot (fd0) devices. */ X- #define ROOT_DEV (dev_nr) 256 /* major-minor device number of root dev */ X- #define BOOT_DEV (dev_nr) 512 /* major-minor device number of boot diskette */ X X--- 85,86 ---- END_OF_FILE if test 1785 -ne `wc -c <'hdif/const.h.cdif'`; then echo shar: \"'hdif/const.h.cdif'\" unpacked with wrong size! fi # end of 'hdif/const.h.cdif' fi if test -f 'kerneldif/Bconsole.c.cdi' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'kerneldif/Bconsole.c.cdi'\" else echo shar: Extracting \"'kerneldif/Bconsole.c.cdi'\" \(7608 characters\) sed "s/^X//" >'kerneldif/Bconsole.c.cdi' <<'END_OF_FILE' X*** kernel-1.3B/console.c Mon Jan 2 03:07:19 1989 X--- kernel/console.c Sun Mar 12 15:29:17 1989 X*************** X*** 13,14 **** X--- 13,15 ---- X #include "proc.h" X+ #include "protect.h" X #include "tty.h" X*************** X*** 20,23 **** X /* Definitions used by the console driver. */ X- #define COLOR_BASE 0xB800 /* video ram paragraph for color display */ X- #define MONO_BASE 0xB000 /* video ram address for mono display */ X #define C_VID_MASK 0x3FFF /* mask for 16K video RAM */ X--- 21,22 ---- X*************** X*** 164,165 **** X--- 163,169 ---- X X+ #ifdef DEBUGGER X+ /* Call debugger? (as early as practical, not in TTY which may be hung) */ X+ if (code == F10) db(); X+ #endif X+ X /* Store the character in memory so the task can get at it later. */ X*************** X*** 168,170 **** X if (kb->iptr < kb->ibufend) { X! tty_events += EVENT_THRESHOLD; X ++kb->iptr; X--- 172,176 ---- X if (kb->iptr < kb->ibufend) { X! lock(); /* protect shared variable */ X! tty_events += EVENT_THRESHOLD; /* C doesn't guarantee atomic */ X! unlock(); X ++kb->iptr; X*************** X*** 275,276 **** X--- 281,285 ---- X X+ if ( c >= ' ' ) X+ goto into_slow_switch; X+ X switch(c) { X*************** X*** 329,330 **** X--- 338,340 ---- X default: /* printable chars are stored in ramqueue */ X+ into_slow_switch: X #ifndef LINEWRAP X*************** X*** 825,826 **** X--- 835,837 ---- X */ X+ #if 0 X port_out(vid_port + INDEX, reg); /* set the index register */ X*************** X*** 829,830 **** X--- 840,844 ---- X port_out(vid_port + DATA, val&BYTE); /* output low byte */ X+ #else X+ porti_out(vid_port + INDEX, (reg + 1) | (reg << 8), val); X+ #endif X } X*************** X*** 933,935 **** X if (color) { X! vid_base = COLOR_BASE; X vid_mask = C_VID_MASK; X--- 947,949 ---- X if (color) { X! vid_base = COLOR_BASE >> HCLICK_SHIFT; X vid_mask = C_VID_MASK; X*************** X*** 938,940 **** X } else { X! vid_base = MONO_BASE; X vid_mask = M_VID_MASK; X--- 952,954 ---- X } else { X! vid_base = MONO_BASE >> HCLICK_SHIFT; X vid_mask = M_VID_MASK; X*************** X*** 949,950 **** X--- 963,969 ---- X X+ #ifdef i80286 X+ if (processor >= 286) X+ vid_base = color ? COLOR_SELECTOR : MONO_SELECTOR; X+ #endif X+ X set_6845(CUR_SIZE, CURSOR_SHAPE); /* set cursor shape */ X*************** X*** 971,972 **** X--- 990,992 ---- X X+ scan_keyboard(); /* stop lockup from leftover keystroke */ X set_leds(); /* don't accept BIOS state */ X*************** X*** 1024,1025 **** X--- 1044,1046 ---- X X+ #ifndef DEBUGGER X /*===========================================================================* X*************** X*** 1038,1039 **** X--- 1059,1061 ---- X } X+ #endif /* DEBUGGER - putc() */ X X*************** X*** 1070 **** X--- 1092,1234 ---- X } X+ X+ X+ /****************************************************************************/ X+ X+ X+ /* Bug fix for keyboard initialization. */ X+ X+ #ifndef DEBUGGER /* debugger already has it */ X+ /*==========================================================================* X+ * scan_keyboard * X+ *==========================================================================*/ X+ PUBLIC int scan_keyboard() X+ { X+ /* Fetch the character from the keyboard hardware and acknowledge it. X+ * Code extracted from keyboard(). Keyboard() should call it instead. X+ */ X+ X+ int code; X+ int val; X+ X+ port_in(KEYBD, &code); /* get the scan code for the key struck */ X+ port_in(PORT_B, &val); /* strobe the keyboard to ack the char */ X+ port_out(PORT_B, val | KBIT); /* strobe the bit high */ X+ port_out(PORT_B, val); /* now strobe it low */ X+ return code; X+ } X+ #endif /* DEBUGGER false - scan_keyboard() */ X+ X+ X+ /****************************************************************************/ X+ X+ X+ /* debugger hooks */ X+ X+ #ifdef DEBUGGER /* CONSOLE <--> debugger glue routines */ X+ /*==========================================================================* X+ * kputc * X+ *==========================================================================*/ X+ PUBLIC void kputc(c) X+ int c; X+ { X+ out_char(&tty_struct[0], c); X+ } X+ X+ X+ typedef void (*pfv_t)(); /* helps broken compilers */ X+ PRIVATE pfv_t putc_func = kputc; /* swapped when debugger is active */ X+ X+ X+ /*==========================================================================* X+ * putc * X+ *==========================================================================*/ X+ PUBLIC void putc(c) X+ int c; X+ { X+ /* Make putc() variable so dmp.c routines can be used by debugger. */ X+ (*putc_func)(c); X+ } X+ X+ X+ /* Db needs private tty variables since some hardware regs are write-only. X+ * Use standard BIOS data area to communicate so db works on DOS too. X+ */ X+ X+ #define BIOS_DATA_SEG 0x40 /* click */ X+ #define ACTIVE_PAGE 0x62 /* offset to unsigned char */ X+ #define ADDR_6845 0x63 /* offset to port_t (2 bytes) */ X+ #define CRT_COLS 0x4A /* offset to unsigned */ X+ #define CRT_LEN 0x4C /* offset to unsigned char */ X+ #define CRT_MODE 0x49 /* offset to unsigned char */ X+ #define CRT_MODE_SET 0x65 /* offset to unsigned char */ X+ #define CRT_START 0x4E /* offset to screenptr_t (2 bytes) */ X+ #define CURSOR_MODE 0x60 /* offset to unsigned */ X+ #define CRT_PALETTE 0x66 /* offset to unsigned char */ X+ #define CURSOR_POSN 0x50 /* offset to screenptr_t [8] */ X+ X+ #define KB_FLAG 0x17 /* offset to unsigned char */ X+ #define CAPS_SH 6 /* shifts for some state bits */ X+ #define NUM_SH 5 X+ #define SCROL_SH 4 X+ #define KB_FLAG_1 0x18 /* offset to unsigned char */ X+ X+ X+ /*==========================================================================* X+ * get_kbd_state * X+ *==========================================================================*/ X+ PUBLIC void get_kbd_state() X+ { X+ if ( vid_port != 0 ) X+ pokew( BIOS_DATA_SEG, KB_FLAG, (numlock<<NUM_SH) | (capslock<<CAPS_SH) ); X+ } X+ X+ X+ /*==========================================================================* X+ * get_scr_state * X+ *==========================================================================*/ X+ PUBLIC void get_scr_state() X+ { X+ if ( vid_port != 0 ) /* console (just about) all initialized */ X+ { X+ pokeb( BIOS_DATA_SEG, ACTIVE_PAGE, 0 ); X+ pokew( BIOS_DATA_SEG, ADDR_6845, vid_port ); X+ pokew( BIOS_DATA_SEG, CRT_COLS, LINE_WIDTH ); X+ pokeb( BIOS_DATA_SEG, CRT_MODE, color ? 3 : 7 ); X+ pokew( BIOS_DATA_SEG, CRT_START, tty_struct[0].tty_org ); X+ pokew( BIOS_DATA_SEG, CURSOR_MODE, CURSOR_SHAPE); X+ pokew( BIOS_DATA_SEG, CURSOR_POSN + 0, X+ tty_struct[0].tty_column | (tty_struct[0].tty_row << 8) ); X+ } X+ } X+ X+ X+ /*==========================================================================* X+ * reset_kbd_state * X+ *==========================================================================*/ X+ PUBLIC void reset_kbd_state() X+ { X+ control = alt = FALSE; X+ if ( vid_port != 0 ) X+ set_leds(); X+ } X+ X+ X+ /*==========================================================================* X+ * set_db_putc * X+ *==========================================================================*/ X+ PUBLIC void set_db_putc() X+ { X+ extern void outbyte(); X+ X+ putc_func = outbyte; X+ } X+ X+ X+ /*==========================================================================* X+ * set_ker_putc * X+ *==========================================================================*/ X+ PUBLIC void set_ker_putc() X+ { X+ putc_func = kputc; X+ } X+ #endif /* DEBUGGER - glue routines */ END_OF_FILE if test 7608 -ne `wc -c <'kerneldif/Bconsole.c.cdi'`; then echo shar: \"'kerneldif/Bconsole.c.cdi'\" unpacked with wrong size! fi # end of 'kerneldif/Bconsole.c.cdi' fi if test -f 'kerneldif/Brs232.c.cdif' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'kerneldif/Brs232.c.cdif'\" else echo shar: Extracting \"'kerneldif/Brs232.c.cdif'\" \(314 characters\) sed "s/^X//" >'kerneldif/Brs232.c.cdif' <<'END_OF_FILE' X*** kernel-1.3B/rs232.c Sat Dec 31 05:43:21 1988 X--- kernel/rs232.c Sat Mar 11 19:51:54 1989 X*************** X*** 669,671 **** X--- 669,673 ---- X rs->ostate ^= (ODONE | OQUEUED); /* ODONE on, OQUEUED off */ X+ unlock(); /* safe, for complicated reasons */ X tty_wakeup(); X+ lock(); X } END_OF_FILE if test 314 -ne `wc -c <'kerneldif/Brs232.c.cdif'`; then echo shar: \"'kerneldif/Brs232.c.cdif'\" unpacked with wrong size! fi # end of 'kerneldif/Brs232.c.cdif' fi echo shar: End of archive 2 \(of 10\). cp /dev/null ark2isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 10 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 10 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0 -- Division of Information Technology (Melbourne), Phone +61 3 347 8644 C.S.I.R.O. Fax +61 3 347 8987 55 Barry St. Telex AA 152914 Carlton, Vic, 3053, Australia E-mail: worsley@ditmela.oz.au