Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!think!ames!amdcad!sun!pitstop!sundc!seismo!uunet!munnari!otc!metro!ipso!runx!brucee From: brucee@runx.ips.oz (Bruce Evans) Newsgroups: comp.os.minix Subject: Re: Minix on 386 machines Message-ID: <1912@runx.ips.oz> Date: 27 Dec 88 05:31:22 GMT References: <5998@louie.udel.EDU> <15061@mimsy.UUCP> Reply-To: brucee@runx.OZ (Bruce Evans) Organization: RUNX Un*x Timeshare. Sydney, Australia. Lines: 67 I now have Minix working well in protected mode on the 386. The main limits are that segments are still 64K and no use is made of paging. I have some support for 32 bit executables and a 32 bit compiler to produce these (and itself) within the old limit of 64K text and 64K data. The 64K limit will eventually vanish when mpx88.s and klib88.s are rewritten and kernel/mm/fs are recompiled with 32 bit sizes. I plan to post the changes necessary for the 16 bit protected mode system sometime in January (after my RS232 stuff). These will provide increased system reliability and access to lots of memory. This should be valuable even without 32 bit sizes. The diffs may be a lot smaller than for RS232, but my kernel diffs are now 237K (counting RS232) and I'm concerned about separating what's needed. Also, there is a fair amount of 386 assembler (much easier to work with than 286) which will have to be reduced to asld's level. (Does asld even have the '&', '|' C operators? I don't think it has #if.) The system retains the ability to run unprotected and configures this way automatically for 286's and 88's (apart from *wini.c). Because of this, I haven't worried much about putting #ifdef i80386 everywhere it belongs. The cost is 5 to 10K of unused code/data on an 88, and (very) few extra decisions at run time based on the 'processor' variable. My debugger (just posted) works on the protected mode and 32 bit code by switching to real mode, limited to addresses below 1M. Apart from this, real mode is not used so the system could be made to run 286 protected mode by modifying the TSS structure and eliminating the 386 assembler code. Techical details ---------------- Users run at privilege 3 Servers 1 Interrupt handlers 0 Servers could be run at privilege 0 with less interrupt latency but the level switch gives a convenient stack frame (straight into proc table - less dangerous than on 88). I have an out of date version which does task switching. This is superficially nicer, perhaps not requiring any assembler in interrupt handlers, but what I wrote came out larger and slower (context switch 10-20% slower. Protected mode switching is already 10-20% slower). Minix centralizes the task switching, unlike the hardware. The process table has extra entries for FSREG, GSREG and all register slots are expanded to longs. The process table also holds the LDT register (constant after init) and a 2 entry LDT to hold segment descriptors for code and data. New kernel files: const386.h - addendum to const.h pm.c - mainly initialization of GDT entries and interrupt handler stubs (asm) Changed kernel files: mpx88.s - 8088 version already rewritten, new savep and restartp klib88.s - everywhere it uses physical addresses redone directly (flat 4G seg) system.c - fork and exec need to build segment descriptors. This is the main dynamic difference and is "simple". proc.c - "unnecessary" large changes supported by mpx88.s clock.c - "unnecessary" small changes supported by mpx88.s others - minor changes in const.h, proc.h, type.h, dmp.c, main.c ... Changed mm/fs/lib files: A new magic number in the exec header for 386 executables has to be fetched and passed to the kernel so the 32-bit bit can be set if required. Both mm and fs have to ask kernel about memory allocation. Bruce Evans Internet: brucee@runx.ips.oz.au UUCP: uunet!runx.ips.oz.au!brucee