[comp.os.minix] New Bootstrapper Part 3 of 3

ncoverby@ndsuvax.UUCP (Glen Overby) (05/11/89)

#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	fs/main.c.diff
#	fs/misc.c.diff
#	fs/super.c.diff
#	fs/utility.c.diff
#	mm/main.diff
#	h/com.diff
#	lib/syslib.diff
#	MANIFEST
# This archive created: Tue May  9 12:01:34 1989
export PATH; PATH=/bin:$PATH
echo shar: extracting "'fs/main.c.diff'" '(12806 characters)'
if test -f 'fs/main.c.diff'
then
    echo shar: will not over-write existing file "'fs/main.c.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'fs/main.c.diff'
X*** /usr/src/minix/fs/main.c	Sat Aug 13 14:21:01 1988
X--- main.c	Sat Apr 22 02:03:55 1989
X***************
X*** 32,38 ****
X  #endif FASTLOAD
X  
X  #define M64K     0xFFFF0000L	/* 16 bit mask for DMA check */
X! #define INFO               2	/* where in data_org is info from build */
X  #define MAX_RAM        16384	/* maximum RAM disk size in blocks */
X  #define RAM_IMAGE (dev_nr)0x303	/* major-minor dev where root image is kept */
X  
X--- 32,38 ----
X  #endif FASTLOAD
X  
X  #define M64K     0xFFFF0000L	/* 16 bit mask for DMA check */
X! /*#define INFO               2	/* where in data_org is info from build */
X  #define MAX_RAM        16384	/* maximum RAM disk size in blocks */
X  #define RAM_IMAGE (dev_nr)0x303	/* major-minor dev where root image is kept */
X  
X***************
X*** 40,50 ****
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  
X  /*===========================================================================*
X   *				main					     *
X   *===========================================================================*/
X! PUBLIC main()
X  {
X  /* This is the main program of the file system.  The main loop consists of
X   * three major activities: getting new work, processing the work, and sending
X--- 40,52 ----
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+ dev_nr root_dev;
X  
X  /*===========================================================================*
X   *				main					     *
X   *===========================================================================*/
X! PUBLIC main(argc, argv)
X! 	int argc; int **argv;
X  {
X  /* This is the main program of the file system.  The main loop consists of
X   * three major activities: getting new work, processing the work, and sending
X***************
X*** 53,59 ****
X    int error;
X    extern int (*call_vector[NCALLS])();
X  
X!   fs_init();
X  
X    /* This is the main loop that gets work, processes it, and sends replies. */
X    while (TRUE) {
X--- 55,61 ----
X    int error;
X    extern int (*call_vector[NCALLS])();
X  
X!   fs_init(argc, argv);
X  
X    /* This is the main loop that gets work, processes it, and sends replies. */
X    while (TRUE) {
X***************
X*** 132,153 ****
X  /*===========================================================================*
X   *				fs_init					     *
X   *===========================================================================*/
X! PRIVATE fs_init()
X! {
X! /* Initialize global variables, tables, etc. */
X! 
X    register struct inode *rip;
X    int i;
X    extern struct inode *get_inode();
X  
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  
X    /* Initialize the 'fproc' fields for process 0 and process 2. */
X    for (i = 0; i < 3; i+= 2) {
X  	fp = &fproc[i];
X! 	rip = get_inode(ROOT_DEV, ROOT_INODE);
X  	fp->fp_rootdir = rip;
X  	dup_inode(rip);
X  	fp->fp_workdir = rip;
X--- 134,170 ----
X  /*===========================================================================*
X   *				fs_init					     *
X   *===========================================================================*/
X! PRIVATE fs_init(argc, argv)
X! 	int argc, **argv;
X! {
X! /* Initialize global variables, tables, etc. */
X! /*
X!  * Arguments are: (for both process and this function)
X!  *	0	Device to load root image from
X!  *		(0 if the root image doesn't need pre-loading)
X!  *	1	Device to mount as root
X!  *	2	PC RAM disk size
X!  *	3	Extended (AT) RAM disk size
X!  *	4	EMS RAM disk size
X!  *		the ram disk that is auto-loaded will be sized from the root
X!  *		filesystem's super-block and should have it's default size
X!  *		set to 0 at all times.
X!  */
X    register struct inode *rip;
X    int i;
X    extern struct inode *get_inode();
X  
X    buf_pool();			/* initialize buffer pool */
X!   printf("FS: 0x%x 0x%x 0x%x 0x%x 0x%x\n", *argv[0], *argv[1], *argv[2], *argv[3], *argv[4]);
X!   root_dev = *argv[1];		/* set the root device */
X!   if(*argv[0] != 0)
X! 	load_ram(*argv[0]);	/* Load RAM disk from root image diskette. */
X    load_super();			/* Load super block for root device */
X  
X    /* Initialize the 'fproc' fields for process 0 and process 2. */
X    for (i = 0; i < 3; i+= 2) {
X  	fp = &fproc[i];
X! 	rip = get_inode(root_dev, ROOT_INODE);
X  	fp->fp_rootdir = rip;
X  	dup_inode(rip);
X  	fp->fp_workdir = rip;
X***************
X*** 165,170 ****
X--- 182,189 ----
X    if (NR_FDS > 127) panic("NR_FDS > 127", NO_NUM);
X    if (NR_BUFS < 6) panic("NR_BUFS < 6", NO_NUM);
X    if (sizeof(d_inode) != 32) panic("inode size != 32", NO_NUM);
X+   printf("FS: 0x%x 0x%x 0x%x 0x%x 0x%x\n", *argv[0], *argv[1], *argv[2], *argv[3], *argv[4]);
X+   printf("FS: Init Done\n");
X  }
X  
X  /*===========================================================================*
X***************
X*** 228,234 ****
X  /*===========================================================================*
X   *				load_ram				     *
X   *===========================================================================*/
X! PRIVATE load_ram()
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--- 247,254 ----
X  /*===========================================================================*
X   *				load_ram				     *
X   *===========================================================================*/
X! PRIVATE load_ram(image)
X! 	dev_nr image;	/* device to load root image from */
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*** 239,256 ****
X    long k_loaded;
X    struct super_block *sp;
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!   extern struct buf *get_block();
X! 
X!   /* Get size of INIT by reading block on diskette where 'build' put it. */
X!   init_org = data_org[INFO];
X!   init_text_clicks = data_org[INFO + 1];
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     * First read block 0 from the floppy.  If this is a valid file system, use
X--- 259,268 ----
X    long k_loaded;
X    struct super_block *sp;
X    block_nr i;
X!   dev_nr usr_image;
X!   phys_clicks ram_clicks;
X!   long base;
X!   extern struct buf *get_block();
X  
X    /* Get size of RAM disk by reading root file system's super block.
X     * First read block 0 from the floppy.  If this is a valid file system, use
X***************
X*** 260,280 ****
X    printf("Booting MINIX-ST 1.1.  Copyright 1988 Prentice-Hall, Inc.\n");
X  #endif ATARI_ST
X  #ifdef ASKDEV
X!   root_device = (dev_nr)askdev();
X!   if (root_device == 0)
X! #endif ASKDEV
X!   root_device = BOOT_DEV;	/* try floppy disk first */
X!   bp = get_block(root_device, SUPER_BLOCK, NORMAL);  /* get RAM super block */
X    copy(super_block, bp->b_data, sizeof(struct super_block));
X    sp = &super_block[0];
X    if (sp->s_magic != SUPER_MAGIC) {
X! 	put_block(bp, FULL_DATA_BLOCK);
X! 	root_device = RAM_IMAGE;
X! 	bp = get_block(root_device, SUPER_BLOCK, NORMAL);  /* get RAM super block */
X! 	copy(super_block, bp->b_data, sizeof(struct super_block));
X! 	sp = &super_block[0];
X! 	if (sp->s_magic != SUPER_MAGIC)
X! 		panic("Invalid root file system", NO_NUM);
X    }
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--- 272,289 ----
X    printf("Booting MINIX-ST 1.1.  Copyright 1988 Prentice-Hall, Inc.\n");
X  #endif ATARI_ST
X  #ifdef ASKDEV
X!   usr_image = (dev_nr)askdev();
X!   if (usr_image != 0)
X! 	image = usr_image;
X! #endif ASKDEV
X!   if(image == 0)
X!   /*image = BOOT_DEV;	/* try floppy disk first */
X!   image = RAM_IMAGE;	/* try hard disk (hd0,3) first */
X!   bp = get_block(image, SUPER_BLOCK, NORMAL);  /* get RAM super block */
X    copy(super_block, bp->b_data, sizeof(struct super_block));
X    sp = &super_block[0];
X    if (sp->s_magic != SUPER_MAGIC) {
X! 	panic("Invalid root file system", NO_NUM);
X    }
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***************
X*** 291,312 ****
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!    * system plus RAM disk combined, so it can remove all of it from the map.
X!    */
X!   m1.m_type = BRK2;
X!   m1.m1_i1 = init_text_clicks;
X!   m1.m1_i2 = init_data_clicks;
X!   m1.m1_i3 = init_org + init_text_clicks + init_data_clicks + ram_clicks;
X! #ifdef ATARI_ST
X!   m1.m1_p1 = (char *) (int) init_org;	/* Bug in Alcyon 4.14 C */
X! #else
X!   m1.m1_p1 = (char *) init_org;
X! #endif
X!   if (sendrec(MM_PROC_NR, &m1) != OK) panic("FS Can't report to MM", NO_NUM);
X  
X    /* Tell RAM driver where RAM disk is and how big it is. */
X    m1.m_type = DISK_IOCTL;
X--- 300,326 ----
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!   } else {			/* allocate core from mm */
X! #endif
X! 
X!   /* 
X!    * Ask MM for memory for the RAM disk
X!    *	This is the one and only call FROM FS TO MM.
X!    */
X! 
X!   m1.m_type = BRK2;
X!   m1.m2_i1 = 1;
X!   m1.m2_i2 = ram_clicks;
X!   if (sendrec(MM_PROC_NR, &m1) != OK) panic("FS Can't report to MM", NO_NUM);
X! 
X!   base = (long) m1.m2_p1;
X!   base = base << CLICK_SHIFT;
X! 
X!   printf("Ram disk of %d clicks at click 0x%x (%ld)\n",ram_clicks, m1.m2_p1, base);
X! 
X! #ifdef i8088
X!   }	/* end of core allocation */
X! #endif
X  
X    /* Tell RAM driver where RAM disk is and how big it is. */
X    m1.m_type = DISK_IOCTL;
X***************
X*** 321,332 ****
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    printf("Loading RAM disk.                          Loaded:   0K ");
X    for (i = 0; i < count; i++) {
X! 	bp = get_block(root_device, (block_nr) i, NORMAL);
X! 	bp1 = get_block(ROOT_DEV, i, NO_READ);
X  	copy(bp1->b_data, bp->b_data, BLOCK_SIZE);
X  	bp1->b_dirt = DIRTY;
X  	put_block(bp, I_MAP_BLOCK);
X--- 335,346 ----
X  	printf("RAM disk of %d blocks is in extended memory\n\n", count);
X  #endif
X  #ifdef FASTLOAD
X!   fastload(image, (char *)base);
X  #else
X    printf("Loading RAM disk.                          Loaded:   0K ");
X    for (i = 0; i < count; i++) {
X! 	bp = get_block(image, (block_nr) i, NORMAL);
X! 	bp1 = get_block(root_dev, i, NO_READ);
X  	copy(bp1->b_data, bp->b_data, BLOCK_SIZE);
X  	bp1->b_dirt = DIRTY;
X  	put_block(bp, I_MAP_BLOCK);
X***************
X*** 336,342 ****
X    }
X  #endif FASTLOAD
X  
X!   if (root_device == BOOT_DEV)
X  	printf("\rRAM disk loaded.    Please remove root diskette.           \n\n");
X    else
X  	printf("\rRAM disk loaded.                                           \n\n");
X--- 350,356 ----
X    }
X  #endif FASTLOAD
X  
X!   if (image == BOOT_DEV)
X  	printf("\rRAM disk loaded.    Please remove root diskette.           \n\n");
X    else
X  	printf("\rRAM disk loaded.                                           \n\n");
X***************
X*** 359,367 ****
X  
X    /* Read in super_block for the root file system. */
X    sp = &super_block[0];
X!   sp->s_dev = ROOT_DEV;
X!   rw_super(sp,READING);
X!   rip = get_inode(ROOT_DEV, ROOT_INODE);	/* inode for root dir */
X  
X    /* Check super_block for consistency (is it the right diskette?). */
X    if ( (rip->i_mode & I_TYPE) != I_DIRECTORY || rip->i_nlinks < 3 ||
X--- 373,381 ----
X  
X    /* Read in super_block for the root file system. */
X    sp = &super_block[0];
X!   sp->s_dev = root_dev;		/* Root = /dev/ram */
X!   rw_super(sp,READING);
X!   rip = get_inode(root_dev, ROOT_INODE);	/* inode for root dir */
X  
X    /* Check super_block for consistency (is it the right diskette?). */
X    if ( (rip->i_mode & I_TYPE) != I_DIRECTORY || rip->i_nlinks < 3 ||
X***************
X*** 372,378 ****
X    dup_inode(rip);
X    sp->s_isup = rip;
X    sp->s_rd_only = 0;
X!   if (load_bit_maps(ROOT_DEV) != OK)
X  	panic("init: can't load root bit maps", NO_NUM);
X  }
X  
X--- 386,392 ----
X    dup_inode(rip);
X    sp->s_isup = rip;
X    sp->s_rd_only = 0;
X!   if (load_bit_maps(root_dev) != OK)
X  	panic("init: can't load root bit maps", NO_NUM);
X  }
X  
SHAR_EOF
if test 12806 -ne "`wc -c < 'fs/main.c.diff'`"
then
    echo shar: error transmitting "'fs/main.c.diff'" '(should have been 12806 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'fs/misc.c.diff'" '(544 characters)'
if test -f 'fs/misc.c.diff'
then
    echo shar: will not over-write existing file "'fs/misc.c.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'fs/misc.c.diff'
X*** /usr/src/minix/fs/misc.c	Sat Aug 13 14:21:05 1988
X--- misc.c	Tue Apr 18 11:36:53 1989
X***************
X*** 84,90 ****
X     */
X  
X    /* Update the time in the root super_block. */
X!   sp = get_super(ROOT_DEV);
X    if (sp != NIL_SUPER) {
X  	  sp->s_time = clock_time();
X  	  if (sp->s_rd_only == FALSE) sp->s_dirt = DIRTY;
X--- 84,90 ----
X     */
X  
X    /* Update the time in the root super_block. */
X!   sp = get_super(root_dev);
X    if (sp != NIL_SUPER) {
X  	  sp->s_time = clock_time();
X  	  if (sp->s_rd_only == FALSE) sp->s_dirt = DIRTY;
SHAR_EOF
if test 544 -ne "`wc -c < 'fs/misc.c.diff'`"
then
    echo shar: error transmitting "'fs/misc.c.diff'" '(should have been 544 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'fs/super.c.diff'" '(879 characters)'
if test -f 'fs/super.c.diff'
then
    echo shar: will not over-write existing file "'fs/super.c.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'fs/super.c.diff'
X*** /usr/src/minix/fs/super.c	Sat Aug 13 14:21:34 1988
X--- super.c	Fri Apr 21 10:40:21 1989
X***************
X*** 22,27 ****
X--- 22,28 ----
X  #include "buf.h"
X  #include "inode.h"
X  #include "super.h"
X+ #include "glo.h"
X  
X  #define INT_BITS (sizeof(int)<<3)
X  #define BIT_MAP_SHIFT     13	/* (log2 of BLOCK_SIZE) + 3; 13 for 1k blocks */
X***************
X*** 198,204 ****
X    register dev_nr dev;
X  
X    dev = (dev_nr) rip->i_zone[0];
X!   if (dev == ROOT_DEV) return(TRUE);	/* inode is on root file system */
X  
X    for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++)
X  	if (sp->s_dev == dev) return(TRUE);
X--- 199,205 ----
X    register dev_nr dev;
X  
X    dev = (dev_nr) rip->i_zone[0];
X!   if (dev == root_dev) return(TRUE);	/* inode is on root file system */
X  
X    for (sp = &super_block[0]; sp < &super_block[NR_SUPERS]; sp++)
X  	if (sp->s_dev == dev) return(TRUE);
SHAR_EOF
if test 879 -ne "`wc -c < 'fs/super.c.diff'`"
then
    echo shar: error transmitting "'fs/super.c.diff'" '(should have been 879 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'fs/utility.c.diff'" '(792 characters)'
if test -f 'fs/utility.c.diff'
then
    echo shar: will not over-write existing file "'fs/utility.c.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'fs/utility.c.diff'
X*** /usr/src/minix/fs/utility.c	Sat Aug 13 14:21:41 1988
X--- utility.c	Tue Apr 18 11:37:32 1989
X***************
X*** 41,47 ****
X    if ( (k = sendrec(CLOCK, &clock_mess)) != OK) panic("clock_time err", k);
X  
X    /* Since we now have the time, update the super block.  It is almost free. */
X!   sp = get_super(ROOT_DEV);
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--- 41,47 ----
X    if ( (k = sendrec(CLOCK, &clock_mess)) != OK) panic("clock_time err", k);
X  
X    /* Since we now have the time, update the super block.  It is almost free. */
X!   sp = get_super(root_dev);
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;
SHAR_EOF
if test 792 -ne "`wc -c < 'fs/utility.c.diff'`"
then
    echo shar: error transmitting "'fs/utility.c.diff'" '(should have been 792 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'mm/main.diff'" '(6968 characters)'
if test -f 'mm/main.diff'
then
    echo shar: will not over-write existing file "'mm/main.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'mm/main.diff'
X3,8c3,9
X<  * initializing itself and its tasks, and then it runs MM.  MM at this point
X<  * does not know where FS is in memory and how big it is.  By convention, FS
X<  * must start at the click following MM, so MM can deduce where it starts at
X<  * least.  Later, when FS runs for the first time, FS makes a pseudo-call,
X<  * BRK2, to tell MM how big it is.  This allows MM to figure out where INIT
X<  * is.
X---
X>  * initializing itself and its tasks, and then it runs MM.  
X>  * MM at this point calls the SYSTEM task to retrieve the memory map
X>  * of HARDWARE, MM, FS and INIT. It uses the map of these three processes
X>  * to determine how much memory has been taken up by the system, and
X>  * removes that memory from the allocation pool.  The brk2 call has been
X>  * changed from telling MM how much memory is allocated to a call usable by
X>  * any process to ask for any ammount memory outside of it's segments.
X42c43
X< 
X---
X>   printf("MM: init done\n");
X109a111,113
X>   phys_clicks tot_clicks;
X>   int i;
X>   int mem1, mem2, mem3;
X113,114c117
X<   /* Find out how much memory the machine has and set up core map.  MM and FS
X<    * are part of the map.  Tell the kernel.
X---
X>   /* Find out how much memory the machine has and set up core map.
X121,123c124,158
X<   mproc[FS_PROC_NR].mp_flags |= IN_USE;
X<   mproc[INIT_PROC_NR].mp_flags |= IN_USE;
X<   procs_in_use = 3;
X---
X>   sys_mapget(MM_PROC_NR, mproc[MM_PROC_NR].mp_seg);
X>   mproc[FS_PROC_NR].mp_flags |= IN_USE;
X>   sys_mapget(FS_PROC_NR, mproc[FS_PROC_NR].mp_seg);
X>   mproc[INIT_PROC_NR].mp_flags |= IN_USE;
X>   sys_mapget(INIT_PROC_NR, mproc[INIT_PROC_NR].mp_seg);
X>   if (mproc[INIT_PROC_NR].mp_seg[T].mem_len != 0)
X> 	mproc[INIT_PROC_NR].mp_flags |= SEPARATE;
X>   sys_mapget(HARDWARE, mproc[3].mp_seg);	/* use proc slot 3 for tmp storage */
X>   procs_in_use = 3;
X> 
X>   printf("%c[H%c[J",033, 033);	/* go to top of screen and clear screen */
X> /* Pid  T(vir phys len) D(vir phys len) S(vir phys len) */
X>   printf("Process Sizes:\n");
X>   for(i=0;i<=3;i++) {		/* Iterate thru processes */
X>     int j;
X>     printf("%d:  ",i);
X>     for(j=0;j<3;j++)		/* Iterate thru T, D, S */
X>       printf("%x %x %x    ",mproc[i].mp_seg[j].mem_vir,
X> 	mproc[i].mp_seg[j].mem_phys,mproc[i].mp_seg[j].mem_len);
X>     printf("\n");
X>   }
X> 
X> /* stats (stolen from brk2) */
X>   tot_clicks = mproc[INIT_PROC_NR].mp_seg[S].mem_phys; /* last proc stack */
X>   alloc_mem(tot_clicks+1);
X> 
X>   mem1 = tot_mem/CLICK_TO_K;			/* system memory */
X>   mem2 = tot_clicks/CLICK_TO_K;			/* Minix's hunk */
X>   printf("Memory size = %dK     ", mem1);
X>   printf("MINIX = %dK     ", mem2);
X>   printf("Available = %dK\n\n", mem1 - mem2);
X>   if (mem1 - mem2 < 32) {
X> 	printf("\nNot enough memory to run MINIX\n\n", NO_NUM);
X> 	sys_abort();
X>   }
X135,215c170,209
X<  * again by anyone.  It contains the origin and size of INIT, and the combined
X<  * size of the 1536 bytes of unused mem, MINIX and RAM disk.
X<  *   m1_i1 = size of INIT text in clicks
X<  *   m1_i2 = size of INIT data in clicks
X<  *   m1_i3 = number of bytes for MINIX + RAM DISK
X<  *   m1_p1 = origin of INIT in clicks
X<  */
X< 
X<   int mem1, mem2, mem3;
X<   register struct mproc *rmp;
X<   phys_clicks init_org, init_clicks, ram_base, ram_clicks, tot_clicks;
X<   phys_clicks init_text_clicks, init_data_clicks;
X< 
X<   if (who != FS_PROC_NR) return(EPERM);	/* only FS make do BRK2 */
X< 
X<   /* Remove the memory used by MINIX and RAM disk from the memory map. */
X<   init_text_clicks = mm_in.m1_i1;	/* size of INIT in clicks */
X<   init_data_clicks = mm_in.m1_i2;	/* size of INIT in clicks */
X<   tot_clicks = mm_in.m1_i3;		/* total size of MINIX + RAM disk */
X<   init_org = (phys_clicks) mm_in.m1_p1;	/* addr where INIT begins in memory */
X<   init_clicks = init_text_clicks + init_data_clicks;
X<   ram_base = init_org + init_clicks;	/* start of RAM disk */
X<   ram_clicks = tot_clicks - ram_base;	/* size of RAM disk */
X<   alloc_mem(tot_clicks);		/* remove RAM disk from map */
X< 
X<   /* Print memory information. */
X<   mem1 = tot_mem/CLICK_TO_K;
X<   mem2 = (ram_base + 512/CLICK_SIZE)/CLICK_TO_K;	/* MINIX, rounded */
X<   mem3 = ram_clicks/CLICK_TO_K;
X< #ifndef ATARI_ST
X<   printf("%c[H%c[J",033, 033);	/* go to top of screen and clear screen */
X< #endif
X<   printf("Memory size = %3dK     ", mem1);
X<   printf("MINIX = %3dK     ", mem2);
X<   printf("RAM disk = %3dK     ", mem3);
X<   printf("Available = %dK\n\n", mem1 - mem2 - mem3);
X<   if (mem1 - mem2 - mem3 < 32) {
X< 	printf("\nNot enough memory to run MINIX\n\n", NO_NUM);
X< 	sys_abort();
X<   }
X< 
X<   /* Initialize INIT's table entry. */
X<   rmp = &mproc[INIT_PROC_NR];
X<   rmp->mp_seg[T].mem_phys = init_org;
X<   rmp->mp_seg[T].mem_len  = init_text_clicks;
X<   rmp->mp_seg[D].mem_phys = init_org + init_text_clicks;
X<   rmp->mp_seg[D].mem_len  = init_data_clicks;
X<   rmp->mp_seg[S].mem_phys = init_org + init_clicks;
X< #ifdef ATARI_ST
X<   rmp->mp_seg[T].mem_vir  = rmp->mp_seg[T].mem_phys;
X<   rmp->mp_seg[D].mem_vir  = rmp->mp_seg[D].mem_phys;
X<   rmp->mp_seg[S].mem_vir  = rmp->mp_seg[S].mem_phys;
X< #else
X<   rmp->mp_seg[S].mem_vir  = init_clicks;
X< #endif
X<   if (init_text_clicks != 0) rmp->mp_flags |= SEPARATE;
X< 
X<   return(OK);
X< }
X< 
X< #ifdef ATARI_ST
X< /*===========================================================================*
X<  *				get_tot_mem				     *
X<  *===========================================================================*/
X< /*
X<  * Current memory size is set by TOS in variable 'phystop'.
X<  * The TOS variable '_memtop' compensates for VIDEO memory.
X<  */
X< PUBLIC phys_clicks get_tot_mem()
X< {
X<   long i;
X< 
X<   if (mem_copy(
X< 	HARDWARE, D, (long)0x0436,	/* TOS variable _memtop */
X< 	MM_PROC_NR, D, (long)&i,
X< 	(long)sizeof(i)
X<   ) != OK)
X< 	panic("get_tot_mem", NO_NUM);
X<   return((phys_clicks)(i >> CLICK_SHIFT));
X< }
X< #endif
X---
X>  * again by anyone.  It allocates a large (possibly > 64K) ammount of memmory
X>  * for the RAM disk.
X>  *   m2_i1 = allocate or free
X>  *   m2_i2 = number of clicks
X>  *   m2_p1 = click address
X>  */
X> 
X>   register struct mproc *rmp;
X> 
X>   if(mm_in.m2_i1 == 1) {	/* allocate memory */
X> 	res_ptr = alloc_mem(mm_in.m2_i2);
X>       printf("brk2 Allocated %d clicks at click address %d\n", mm_in.m2_i2, res_ptr);
X>   } else {
X> 	free_mem(mm_in.m2_p1,mm_in.m2_i2);
X>   }
X> 	
X>   return(OK);
X> }
X> 
X> #ifdef ATARI_ST
X> /*===========================================================================*
X>  *				get_tot_mem				     *
X>  *===========================================================================*/
X> /*
X>  * Current memory size is set by TOS in variable 'phystop'.
X>  * The TOS variable '_memtop' compensates for VIDEO memory.
X>  */
X> PUBLIC phys_clicks get_tot_mem()
X> {
X>   long i;
X> 
X>   if (mem_copy(
X> 	HARDWARE, D, (long)0x0436,	/* TOS variable _memtop */
X> 	MM_PROC_NR, D, (long)&i,
X> 	(long)sizeof(i)
X>   ) != OK)
X> 	panic("get_tot_mem", NO_NUM);
X>   return((phys_clicks)(i >> CLICK_SHIFT));
X> }
X> #endif
SHAR_EOF
if test 6968 -ne "`wc -c < 'mm/main.diff'`"
then
    echo shar: error transmitting "'mm/main.diff'" '(should have been 6968 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'h/com.diff'" '(481 characters)'
if test -f 'h/com.diff'
then
    echo shar: will not over-write existing file "'h/com.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'h/com.diff'
X*** /usr/src/minix/h/com.h	Sat Aug 13 14:15:46 1988
X--- com.h	Tue Jan 10 01:30:33 1989
X***************
X*** 83,88 ****
X--- 83,89 ----
X  #	define SYS_ABORT   9	/* fcn code for sys_abort() */
X  #	define SYS_FRESH  10	/* fcn code for sys_fresh()  (Atari only) */
X  #	define SYS_KILL   11	/* fcn code for sys_kill(proc, sig) */
X+ #	define SYS_GETMAP 12	/* fcn code for sys_getmap(procno, map_ptr) */
X  
X  #define HARDWARE          -1	/* used as source on interrupt generated msgs */
X  
SHAR_EOF
if test 481 -ne "`wc -c < 'h/com.diff'`"
then
    echo shar: error transmitting "'h/com.diff'" '(should have been 481 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'lib/syslib.diff'" '(270 characters)'
if test -f 'lib/syslib.diff'
then
    echo shar: will not over-write existing file "'lib/syslib.diff'"
else
sed 's/^X//' << \SHAR_EOF > 'lib/syslib.diff'
X102a103,111
X> PUBLIC sys_mapget(proc, ptr)
X> int proc;			/* proc whose map is to be changed */
X> char *ptr;			/* pointer to new map */
X> {
X> /* Get the memory map of a proc from the Kernel */
X> 
X>   callm1(SYSTASK, SYS_GETMAP, proc, 0, 0, ptr, NIL_PTR, NIL_PTR);
X> }
X> 
SHAR_EOF
if test 270 -ne "`wc -c < 'lib/syslib.diff'`"
then
    echo shar: error transmitting "'lib/syslib.diff'" '(should have been 270 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'MANIFEST'" '(1004 characters)'
if test -f 'MANIFEST'
then
    echo shar: will not over-write existing file "'MANIFEST'"
else
sed 's/^X//' << \SHAR_EOF > 'MANIFEST'
XFile Name                 Kit Number
X--------------            ----------
XMANIFEST                     1
XMANIFEST                     3
XREADME                       1
Xb1/bootblok.asm3             1
Xb1/bootblok.uu               1
Xb2b/Makefile                 1
Xb2b/bsu.s                    1
Xb2b/hdparam.h                1
Xb2b/loader.c                 2
Xb2b/main.c                   1
Xb2b/partition.h              1
Xb2b/stack.c                  1
Xb2b/standalone.c             1
Xb2b/type.h                   1
Xfs/cache.c.diff              1
Xfs/glo.h.diff                2
Xfs/inode.c.diff              2
Xfs/main.c.diff               3
Xfs/makefile                  2
Xfs/misc.c.diff               3
Xfs/super.c.diff              3
Xfs/utility.c.diff            3
Xh/com.diff                   3
Xkernel/main.c.diff           1
Xkernel/makefile              2
Xkernel/memory.c.diff         2
Xkernel/mpx88.s               2
Xkernel/system.c.diff         2
Xlib/syslib.diff              3
Xmm/main.diff                 3
SHAR_EOF
if test 1004 -ne "`wc -c < 'MANIFEST'`"
then
    echo shar: error transmitting "'MANIFEST'" '(should have been 1004 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0