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