Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!husc6!bbn!rochester!rocksanne!rocksvax!martyl From: martyl@rocksvax.UUCP Newsgroups: comp.os.minix,comp.sys.ibm.pc,comp.sys.intel Subject: protected mode 80286 questions Message-ID: <93@rocksvax.UUCP> Date: Fri, 2-Oct-87 13:13:08 EDT Article-I.D.: rocksvax.93 Posted: Fri Oct 2 13:13:08 1987 Date-Received: Sun, 4-Oct-87 07:12:06 EDT Organization: Xerox: Henrietta, NY Lines: 50 Xref: utgpu comp.os.minix:1695 comp.sys.ibm.pc:7441 comp.sys.intel:334 I'm trying to get a protected mode implementation of Minix running. Programs using split I & D (max 64K code, 64K max combined data/bss/stack) require a code segment (execute only), a data segment and a stack segment. Using 16 bit pointers on a 286 requires the data segment to include the stack segment. It therefore seems necessary to always allocate 64k of data to a process whether it needs it or not. The stack begins (I believe) at 0xffff and extends downward to a segment limit (stack access below the limit will cause protection exceptions). The data segment would have to end at 0xffff to include the stack. Writes on top of the stack by an errant process would not be detected at the time of fault. Presumably the process would go errant some other way later. I'm toying with the idea of setting the initial stack pointer to a process to be something less than 0xffff. For example, if a program needs 16k of data and bss and 16k of stack, the data segment size would be 32K and the stack limit would be at 16k, with the initial stack pointer being at 32k. The only problem is if this program begins to execute: label: pop ax jmp short label for some brain-damaged reason. I don't see a way the hardware is going to generate an exception until the stackpointer reaches 0xffff -- which is 32k beyond the limit of our initial stack segment and probably in the address space of some other process. 32 bit pointers solve the problem, since the stack is not part of the data segment. But it injects other problems (like loading), which I don't want to handle off the bat. It seems I need to allocate 64K to all data segments where the stack is aliased on top of the data segment. This isn't a big problem once I start to hang Megabytes of ram on my 286. Any comments to confirm/deny my intuition in this issue. Any other ideas? Thanks -- marty leisner xerox corp. ARPA: leisner.henr@xerox.com UUCP: martyl@rocksvax.uucp -- marty leisner xerox corp leisner.henr@xerox.com martyl@rocksvax.uucp