From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Cox Subject: Re: Memory issues and USB support? Date: Sun, 19 Mar 2017 14:27:45 +0000 Message-ID: <20170319142745.5795a8a4@www.etchedpixels.co.uk> References: Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-8086-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" To: Derek Johansen Cc: ELKS On Sun, 19 Mar 2017 00:02:20 -0600 Derek Johansen wrote: > Just out of curiosity: > > 1) Why the restriction to ~640K of memory for running ELKS. Lots of > implementations banging up against this lately. Can ELKS be modified > to use all available memory (e,g, my virtual system has ~1 GB > available; could ELKS be modified to use all of that)? Actually applications are hitting the 64K code / 64K data limit. The total system limit is 1MB for an 8086 but on most 8086 platforms a chunk of that is video, MMIO and BIOS so you get 640K. Beyond that 640K you can swap, so for a normal sane system from that era running appropriate apps 640K should be plenty of memory. On a 286 in protected mode (which ELKS kind of supports) you should be able to go to 16MB (again you don't get 384K of it on a PC). There is some minimal 286 protected mode support in ELKS but only for 64K/64K binaries. Getting bigger user applications means teaching the compiler to generate protected mode safe larger mode binaries. For code that's actually not too horrible providing you understand the LDT/GDT have to be OS managed to allow for swap and memory compaction. For data it's a lot more exciting if you want to support objects bigger than 64Kbyte in size, and still quite 'interesting' from a compiler perspective anyway. On an 8086 the other option is to support EMM boards. That allows you up to 4MB or so of which 64K at a time is visible in a fixed memory window - that's actually ideal for ELKS but fiddly for memory management as any application that's got split code/data and can be over 64K will need to be arranged so only half of it lives in EMM space. > 2) Does ELKS support USB devices? Will it ever? Is it even possible? No and USB is actually very hard for three reasons 1. There is almost no ISA USB hardware so you'll need to design your own 2. USB adds device hotplug to your system, something ELKS and older OSs - older Linux included simply have no concept of. That's a major rework, although you can dodge some of it with restricted functionality 3. The USB stack itself is a complicated beast needing a lot of memory And if you are trying to do a small OS on an old 386 or later x86 platform I'd just grab NetBSD/OpenBSD. They've not inflated in the same way Linux (and in particular the Linux user space) has. Alan