Annotation of coherent/d/kernel/USRSRC/i8086/src/mmain.c, revision 1.1.1.1

1.1       root        1: /* $Header: /newbits/kernel/USRSRC/i8086/src/RCS/mmain.c,v 1.3 91/10/31 08:41:00 bin Exp Locker: bin $ */
                      2: /* (lgl-
                      3:  *     The information contained herein is a trade secret of Mark Williams
                      4:  *     Company, and  is confidential information.  It is provided  under a
                      5:  *     license agreement,  and may be  copied or disclosed  only under the
                      6:  *     terms of  that agreement.  Any  reproduction or disclosure  of this
                      7:  *     material without the express written authorization of Mark Williams
                      8:  *     Company or persuant to the license agreement is unlawful.
                      9:  *
                     10:  *     COHERENT Version 2.3.37
                     11:  *     Copyright (c) 1982, 1983, 1984.
                     12:  *     An unpublished work by Mark Williams Company, Chicago.
                     13:  *     All rights reserved.
                     14:  -lgl) */
                     15: /*
                     16:  * 8086/8088 Coherent.
                     17:  * All machines.
                     18:  * Machine dependent stuff.
                     19:  *
                     20:  * $Log:       mmain.c,v $
                     21:  * Revision 1.3  91/10/31  08:41:00  bin
                     22:  * provided by hal for 3204{k} kernels
                     23:  * 
                     24:  * Revision 1.2  91/06/20  14:40:23  bin
                     25:  * update provided by hal
                     26:  * 
                     27:  * Revision 1.2        88/08/05  15:43:42      src
                     28:  * Bug:        Spawning large number of processes would cause system to crash.
                     29:  * Fix:        Kernel alloc space no longer overlaps loadable driver data.
                     30:  * 
                     31:  * Revision 1.1        88/03/24  17:39:46      src
                     32:  * Initial revision
                     33:  * 
                     34:  * 88/02/24    Allan Cornish           /usr/src/sys/i8086/src/mmain.c
                     35:  * corebot is now aligned on a 512 byte boundary.
                     36:  *
                     37:  * 87/11/30    Allan Cornish           /usr/src/sys/i8086/src/mmain.c
                     38:  * Check for kernel data space > 64 Kbytes now done AFTER rounding up.
                     39:  *
                     40:  * 87/11/21    Allan Cornish           /usr/src/sys/i8086/src/mmain.c
                     41:  * Use of bruc/ctob macros eliminated since no longer valid in protected mode.
                     42:  *
                     43:  * 87/11/14    Allan Cornish           /usr/src/sys/i8086/src/mmain.c
                     44:  * Init code+data now split into icodep/icodes and idatap/idatas.
                     45:  *
                     46:  * 87/11/12    Allan Cornish           /usr/src/sys/i8086/src/mmain.c
                     47:  * Corebot/coretop now paddr_t rather than saddr_t to support protected mode.
                     48:  *
                     49:  * 87/10/05    Allan Cornish           /usr/src/sys/i8086/src/mmain.c
                     50:  * Loadable driver data slot allocation added.
                     51:  *
                     52:  * 87/05/08    Allan Cornish           /usr/src/sys/i8086/src/mmain.c
                     53:  * Ctob(sds) is now cast as ctob((paddr_t)sds) to avoid address truncation.
                     54:  *
                     55:  * 86/07/23    Allan Cornish
                     56:  * Added check for kernel data space exceeding 64 Kbytes.
                     57:  */
                     58: #include <sys/coherent.h>
                     59: #include <sys/i8086.h>
                     60: #include <sys/clist.h>
                     61: #include <errno.h>
                     62: #include <sys/inode.h>
                     63: #include <sys/proc.h>
                     64: #include <sys/seg.h>
                     65: #include <signal.h>
                     66: #include <sys/uproc.h>
                     67: #include <sys/buf.h>
                     68: #include <sys/typed.h>
                     69: 
                     70: /* Arguments are passed into the kernel through boot_gift.
                     71:  * If you start getting "Not enough room for all arguments." messages
                     72:  * at boot time, just increase the BG_LEN  to whatever you need.
                     73:  * This structure is EXACTLY BG_LEN bytes long.
                     74:  */
                     75: #define BG_LEN 512
                     76: TYPED_SPACE(boot_gift, BG_LEN, T_FIFO_SIC);
                     77: 
                     78: saddr_t uasa;  /* Currently active uarea */
                     79: 
                     80: /*
                     81:  * General initialisation.
                     82:  */
                     83: i8086()
                     84: {
                     85:        register unsigned allocp;
                     86:        extern vaddr_t  aicodep;
                     87:        extern vaddr_t  aicodes;
                     88:        extern vaddr_t  aidatap;
                     89:        extern vaddr_t  aidatas;
                     90:        extern vaddr_t  etext;
                     91:        extern vaddr_t  end;
                     92:        auto faddr_t    fp;
                     93:        long datsize;
                     94:        unsigned bsize, csize, isize, ssize;
                     95: 
                     96:        /*
                     97:         * Set up memory bases.
                     98:         * Align the buffers modulo BSIZE (512) in the physical space,
                     99:         * so that any machines that have only 16 bit DMA counters will
                    100:         * work out.
                    101:         */
                    102:        datsize = (long)&end;
                    103:        datsize += ALLSIZE;
                    104:        datsize += NBUF * sizeof(BUF);
                    105:        datsize += ssize = NSLOT*(sizeof(int) + slotsz);
                    106:        datsize += isize = NINODE*sizeof(INODE);
                    107:        datsize += csize = NCLIST*sizeof(CLIST);
                    108:        datsize += bsize = NBUF*BSIZE;
                    109:        datsize = (datsize + 511) & ~511;
                    110:        if ( datsize >= 0x10000L )
                    111:                panic("Kernel data exceeds 64 Kbytes");
                    112: 
                    113:        blockp  = datsize - bsize - ((sds&0x1F)<<4);
                    114:        clistp  = (unsigned)blockp - csize;
                    115:        inodep  = (unsigned)clistp - isize;
                    116:        slotp   = (unsigned)inodep - ssize;
                    117:        allocp = &end;
                    118:        blockp += (sds << 4L);
                    119:        if ((unsigned)allocp > (unsigned)slotp)
                    120:                panic("No alloc space");
                    121:        corebot = ((sds << 4L) + datsize + 511) & ~511;
                    122:        asize = (unsigned)slotp - allocp;
                    123:        msize = (coretop-holetop+holebot-corebot) / 1024;
                    124:        allkp = setarena(allocp, asize);
                    125:        icodep = (char *)&aicodep;
                    126:        icodes = (int)&aicodes;
                    127:        idatap = (char *)&aidatap;
                    128:        idatas = (int)&aidatas;
                    129:        fp = ptov( corebot, (fsize_t) UPASIZE );
                    130:        uasa   = FP_SEL(fp);
                    131: }
                    132: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.