|
|
1.1 ! root 1: /* $Header: /kernel/kersrc/i286/RCS/mmain.c,v 1.1 92/07/17 15:21:33 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.1 92/07/17 15:21:33 bin ! 22: * Initial revision ! 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/buf.h> ! 67: #include <sys/typed.h> ! 68: ! 69: /* Arguments are passed into the kernel through boot_gift. ! 70: * If you start getting "Not enough room for all arguments." messages ! 71: * at boot time, just increase the BG_LEN to whatever you need. ! 72: * This structure is EXACTLY BG_LEN bytes long. ! 73: */ ! 74: #define BG_LEN 512 ! 75: TYPED_SPACE(boot_gift, BG_LEN, T_FIFO_SIC); ! 76: ! 77: saddr_t uasa; /* Currently active uarea */ ! 78: ! 79: /* ! 80: * General initialisation. ! 81: */ ! 82: i8086() ! 83: { ! 84: register unsigned allocp; ! 85: extern vaddr_t aicodep; ! 86: extern vaddr_t aicodes; ! 87: extern vaddr_t aidatap; ! 88: extern vaddr_t aidatas; ! 89: extern vaddr_t etext; ! 90: extern vaddr_t end; ! 91: auto faddr_t fp; ! 92: long datsize; ! 93: unsigned bsize, csize, isize, ssize; ! 94: ! 95: /* ! 96: * Set up memory bases. ! 97: * Align the buffers modulo BSIZE (512) in the physical space, ! 98: * so that any machines that have only 16 bit DMA counters will ! 99: * work out. ! 100: */ ! 101: datsize = (long)&end; ! 102: datsize += ALLSIZE; ! 103: datsize += NBUF * sizeof(BUF); ! 104: datsize += ssize = NSLOT*(sizeof(int) + slotsz); ! 105: datsize += isize = NINODE*sizeof(INODE); ! 106: datsize += csize = NCLIST*sizeof(CLIST); ! 107: datsize += bsize = NBUF*BSIZE; ! 108: datsize = (datsize + 511) & ~511; ! 109: if ( datsize >= 0x10000L ) ! 110: panic("Kernel data exceeds 64 Kbytes"); ! 111: ! 112: blockp = datsize - bsize - ((sds&0x1F)<<4); ! 113: clistp = (unsigned)blockp - csize; ! 114: inodep = (unsigned)clistp - isize; ! 115: slotp = (unsigned)inodep - ssize; ! 116: allocp = &end; ! 117: blockp += (sds << 4L); ! 118: if ((unsigned)allocp > (unsigned)slotp) ! 119: panic("No alloc space"); ! 120: corebot = ((sds << 4L) + datsize + 511) & ~511; ! 121: asize = (unsigned)slotp - allocp; ! 122: msize = (coretop-holetop+holebot-corebot) / 1024; ! 123: allkp = setarena(allocp, asize); ! 124: icodep = (char *)&aicodep; ! 125: icodes = (int)&aicodes; ! 126: idatap = (char *)&aidatap; ! 127: idatas = (int)&aidatas; ! 128: fp = ptov( corebot, (fsize_t) UPASIZE ); ! 129: uasa = FP_SEL(fp); ! 130: ! 131: /* outb(0x65, 0x9e); /* MLK set Planar Control Register */ ! 132: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.