Supporting both Intel 8088/8086 and 80x86 CPUs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Brendan »

Hi,
Deprecated wrote:For the 8086 targets I had initially considered limiting the kernel and associated modules to having a total of 64k of memory for data. With the Watcom compiler that is no longer necessary and each module can have it's own data segment while still having access to global kernel memory. By specifying __loadds in addition to __far for all functions used as entry points there should be few if any issues with inter-module calls. Although Watcom does support the __huge specifier for data that crosses segment boundaries it's still too early to consider it's usage.
As an exercise, I want you to consider how you'd design a bitmap graphics editor (like MS Paint, GIMP, etc).

You'd have something to load a file's header and decode it, then you'd do something "pixel_data = malloc(vertical_size * horizontal_size * sizeof(PIXEL) );" to allocate a buffer, then you'd decode the rest of the file into the buffer. After that you'd have a bunch of routines to work on the pixel data (in the buffer) - things like setting pixels, drawing lines, filling areas, etc; and maybe some more stuff that works on the image as a whole (resize, blur/sharpen, lighter/darker, etc). You'd also have code to save the file (generate appropriate headers, etc for a specific file format, and write the pixel data from the buffer to the file); plus some user interface code, etc. It all seems relatively simple really.

Of course the code to load the file would convert the pixels into a generic format, so that all of the rest of the code only needs to handle that generic format (so you don't need 10 different routines to draw a line in 10 different pixel formats, for example). The generic pixel format would need alpha/transparency plus 4 more fields for colour data (whether it's "RGB" or something else). You could get away with 8 bits per component here (or 4 bytes per pixel for "ARGB"), but for things like gamma correction, etc you'd probably want something larger (maybe a "float" for each component) to minimise error and get the best results. I don't know, but it all still seems relatively simple.

To make it portable (so you can compile it as a 16-bit version, a 32-bit version and a 64-bit version) all you need to do is tell the compiler to use a "large" or "huge" memory model, and put things like "__loadds" and " __far" at appropriate places.

It all just seems simple. I mean, that's all you'd have to do right?

Assuming we're only using 4 bytes per pixel, with 640 KiB of RAM (the absolute maximum possible for 8086, leaving no RAM for any code or anything else) it'd be limited to 163840 pixels. That's enough for a 400 * 400 image, which is fine for, um, icons? Oops. Even for a 8086 you'd want to try to support images that are 640 * 350 or more (even before VGA, most "EGA compatible" cards supported 640 * 480).

The main problem is the memory allocation "pixel_data = malloc(vertical_size * horizontal_size * sizeof(PIXEL) );". It just can't work - even with multiple data segments you run out of RAM; and because we're talking about real mode it's impossible for the OS to implement anything like swap space. To get around that I'd probably consider creating a temporary file for the pixel data, and using whatever RAM I could get my hands on for a "most recently used" pixel data cache. Every piece of code that touches the pixel data would have to be changed to make the "pixel cache" work, which is everything except the user interface code. Basically you'd have to radically redesign the entire application to make it work. Doh.

Ok, so we redesign the thing to use a pixel data cache or something. Now it's slower than it could/should be for 80386 and later. How do we get around that? I've got an idea: let's just make 2 different versions - one version for 8086 and one version that people would actually use. :D


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Deprecated
Posts: 12
Joined: Wed Jul 27, 2011 1:57 pm

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Deprecated »

Brendan wrote:Ok, so we redesign the thing to use a pixel data cache or something. Now it's slower than it could/should be for 80386 and later. How do we get around that? I've got an idea: let's just make 2 different versions - one version for 8086 and one version that people would actually use.

You are obviously dead set again such a project so why bother babbling on about it? Your long winded "exercise" isn't very applicable and is an extremely poor example. Perhaps if it had been put into the context of actual kernel level tasks it would have been a bit more applicable. I do however have to question the overall value of a forum with a moderator that acts like an elitist prick towards other members.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by gerryg400 »

Brendan hasn't approved my (synchronous, message-passing) :-$ OS either. But the forum is still valuable.

IIRC, there was a version of Minix that could be built for 8086 or 80386. There were only a handful of files that were different between the two builds. If my memory is correct, this proves that it's possible to do what you want to do.

Because of the feature and functionality gap, it's not really possible to write an OS that runs on say an 8086 and an Intel i7 and uses each to its potential. You're going to have vastly reduced functionality in your 8086 port. It sounds like this may not be an issue for you.
If a trainstation is where trains stop, what is a workstation ?
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Solar »

Not a good way to dispell a very valid point, Deprecated. Brendan is right: The memory constraints of Real Mode make themselves felt for any kind of "serious" work. How about a 'diff' utility? A C compiler? A text editor? You'll have to face both the segmentation issue and the total memory limit. Claiming that his "poor" example of a graphics package "isn't very applicable" doesn't make the issues go away. How do you intend to address them?
Every good solution is obvious once you've found it.
Deprecated
Posts: 12
Joined: Wed Jul 27, 2011 1:57 pm

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Deprecated »

Solar wrote:Not a good way to dispell a very valid point, Deprecated. Brendan is right: The memory constraints of Real Mode make themselves felt for any kind of "serious" work. How about a 'diff' utility? A C compiler? A text editor? You'll have to face both the segmentation issue and the total memory limit. Claiming that his "poor" example of a graphics package "isn't very applicable" doesn't make the issues go away. How do you intend to address them?

It isn't applicable. THIS thread has nothing to do with the applications that will run on the OS. Even talking about them at this point is putting the chicken before the egg. This is about the kernel, it's associated modules, how data will be accessed and shared between them, how the modules will call into each other and how much of the code base is will be specific to a particular architecture.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Combuster »

Ever heard of that banker that collected his million today, retired tomorrow, and let the economy crash the week after?

The kernel exists to serve applications. If you don't take into account what they need, you are better off already scheduling a full rewrite into your agenda. That's true for 8086, it's true for 386s, it's true for any architecture.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Solar »

Unless, of course, you write that kernel solely for the kernel's sake. Somewhat like a proof-of-concept, practicability-be-damned.
Every good solution is obvious once you've found it.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Brendan »

Hi,
Solar wrote:Not a good way to dispell a very valid point, Deprecated. Brendan is right: The memory constraints of Real Mode make themselves felt for any kind of "serious" work. How about a 'diff' utility? A C compiler? A text editor? You'll have to face both the segmentation issue and the total memory limit. Claiming that his "poor" example of a graphics package "isn't very applicable" doesn't make the issues go away. How do you intend to address them?
That's exactly where I was going.

In this topic and in the "8086 Development tools " topic (e.g. "The __far and __loadds modifiers alone will help tremendously in allowing the code to target both 16 bit and 32/64 bit platforms.") I got the impression that Deprecated thinks a few compiler directives will solve all the problems. Experience tells me that limited resources means very different techniques (that often aren't suitable when resources aren't as limited).
Deprecated wrote:You are obviously dead set again such a project so why bother babbling on about it? Your long winded "exercise" isn't very applicable and is an extremely poor example. Perhaps if it had been put into the context of actual kernel level tasks it would have been a bit more applicable. I do however have to question the overall value of a forum with a moderator that acts like an elitist prick towards other members.
The first step in avoiding problems is to identify them. Once potential problems have been identified they can be solved (or accepted and managed if they can't be solved); and after all potential problems have been solved (or accepted and managed) you end up with a much stronger design. The alternative is to fail to identify problems until it's too late, which is far more expensive.

For example, earlier in this topic I voiced concerns about a potential "development time vs. efficiency" compromise (I identified a potential problem); then Owen reminded us of a better way that avoids the potential "development time vs. efficiency" compromise I was worried about, and my very next post begins "You're right" and summarizes a way of avoiding the "development time vs. efficiency" compromise completely. See how that works?

The funny thing is that I think you understood the "identify -> solve -> better design" cycle before you even posted. I honestly don't think you would've created this topic if you weren't interested in finding problems (and ways to avoid them).

So, let's try again.

Let's consider a floppy driver. For performance reasons (on modern machines) I normally implement a floppy driver with a built-in "track cache" to minimise the number of seeks (head movement, head settle time, rotational latency, etc). It also allows me to allocate RAM that's suitable for the ISA DMA controllers (e.g. doesn't cross 64 KiB boundaries, etc) and keep it (rather than constantly freeing/reallocating); and makes it easier to reorder operations (e.g. postpone writes while reads are pending). For modern machines the cost of the "track cache" is negligible - if you cache 16 tracks, then for a normal 1440 KiB floppy (18 sectors per track) it only costs 144 KiB and the performance difference more than justifies it. For an 8086 that's about 20% of RAM gone just for one device driver. There's no way I'd implement a track cache in that case (but of course that'd mean changing the entire design of the driver to suit 8086 and losing performance on later machines, unless you had 2 different floppy drivers).

I think you'll find the same problem occurs with all storage device drivers (hard drives, CD, tape, etc). They almost always have a queue of pending requests, some sort of block/sector cache, etc.

Then there's networking. To be honest that's probably one of the first things I'd want - get the little old 8086 machines using NFS over the network, with a more modern file server or NAS or something on the LAN to really speed up file IO for the 8086 machines. For most ethernet cards (even ancient old ISA cards) you normally have something like a pair of ring buffers (one for packets to be sent and one for packets received). They're probably 16 KiB each. On top of that you end up with packets all over the place - some in an extra queue waiting to be put in the "sending" ring buffer, some that have been received and are being processed and/or delivered to the task they're intended for, some in a "packet re-ordering" buffers (for TCP), some that have already been sent but need to be kept in case there's an error and they need to be re-sent, etc. For ethernet (even the old 10base2 stuff) a packet is up to about 1.5 KiB. You get 50 of them floating around and it's going to cost you 75 KiB, then add both ring buffers and you end up with about 100 KiB of RAM (or 15% of RAM for an 8086). Too expensive? You could redesign everything - get rid of the queue of packets waiting to be sent (make processes block until the driver is able to send their packet?), reduce the size of the ring buffers as much as you can, cripple TCP streams so that you wait for any ACK before letting a process send another packet (so you don't need to keep more than one packet in case re-sending is needed), etc.

Do you really want me to talk about video drivers? Software rendering with triple buffering and font engines for proportional fonts and Unicode support? How about sound? 1 byte per sample with a sample rate of 44 Khz, with a buffer big enough to do mixing in software without audible glitches? Printer and scanner drivers?

So, lets have a look. Most of the devices drivers (except for keyboard, mouse, joystick, and maybe serial port - they're fine "as is") are probably going to have to be redesigned specially to suit 8086 (with unnecessary performance losses on 80386, unless there's separate "80386 or later" versions of each driver). Anything that involves graphics or sound is going to be a problem too - everything from WYSIWYG word processors, to web browsers to GUIs. Then there's any of the heavier tools and utilities - file archival and compression, compilers (and virtual machines and interpreters), database engines, HTTP/FTP/NNTP/mail servers, etc.

What are we left with? An OS for 8086 that runs a text editor and not much else in "ASCII only" 80 * 50 text mode; and an entirely different OS for 80386 and later (which also happens to be able to run the same text editor in a terminal)?

Ok, so I think I've identified a problem. What are the possible solutions?

I can already see two solutions - write different code for different systems and give up on source code portability; or let "80386 and later" suck because of the limitations on 8086. Another solution would be to give up on writing an OS and write an "embedded OS" instead (some tiny little binary that lazy people can use for scheduling and memory management for their bootable embedded applications) - ironically, something like that would be more likely to succeed than something that attempts to compete against established desktop/server OSs. Another alternative might be to have a "thin client" version of the OS for low-end machines, where all applications are run on larger/more modern servers - that way you wouldn't even need storage device drivers on the clients.

Can you (Deprecated) think of any reason why this won't be a problem? If it will be, can you think of other ways to work around the problem or solve the problem? Of course you could always just call me names - I'm fine with that too.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Deprecated
Posts: 12
Joined: Wed Jul 27, 2011 1:57 pm

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Deprecated »

Combuster wrote:The kernel exists to serve applications. If you don't take into account what they need, you are better off already scheduling a full rewrite into your agenda. That's true for 8086, it's true for 386s, it's true for any architecture.
In my original post I included a list of hardware and CPU items for discussion concerning the amount of platform specific code in the kernel. If I wanted to discuss how applications would operate in a segmented memory model I would have asked about it. It's not that deciding how applications will work is irrelevant to an operating system it's just irrelevant to this particular discussion.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Brendan »

Hi,
Deprecated wrote:In my original post I included a list of hardware and CPU items for discussion concerning the amount of platform specific code in the kernel. If I wanted to discuss how applications would operate in a segmented memory model I would have asked about it. It's not that deciding how applications will work is irrelevant to an operating system it's just irrelevant to this particular discussion.
Did you know that I can fly?

All I have to do is jump off of a tall building, and ignore the part about the landing...


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Deprecated
Posts: 12
Joined: Wed Jul 27, 2011 1:57 pm

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Deprecated »

Brendan wrote:Let's consider a floppy driver. For performance reasons (on modern machines) I normally implement a floppy driver with a built-in "track cache" to minimise the number of seeks (head movement, head settle time, rotational latency, etc). It also allows me to allocate RAM that's suitable for the ISA DMA controllers (e.g. doesn't cross 64 KiB boundaries, etc) and keep it (rather than constantly freeing/reallocating);
This is actually split between the driver and the file manager...

At the driver level the request may be for a specific type or "color" of memory. In the case of DMA or other task specific memory requirements the kernel may set aside a certain amount and/or specific region of memory (configurable). Optimally this memory could be allocated for common usage (general kernel or user space) as a last resort.

General caching will occur in a separate module controlled primarily by the file manager as it has direct knowledge of the file system and read/write modes for specific file descriptors. When the data is loaded by the driver either by polling or driven by interrupts it gets passed up to the file manager with a weight value and a hint indicating it's how caching should be applied. This allows caching to be balanced between devices as well as different file systems on low memory systems and reduces code duplication.
Brendan wrote:Then there's networking. [snip] Software rendering with triple buffering and font engines for proportional fonts and Unicode support? How about sound? 1 byte per sample with a sample rate of 44 Khz, with a buffer big enough to do mixing in software without audible glitches? Printer and scanner drivers? [snip] everything from WYSIWYG word processors, to web browsers to GUIs. Then there's any of the heavier tools and utilities - file archival and compression, compilers (and virtual machines and interpreters), database engines, HTTP/FTP/NNTP/mail servers, etc.
You certainly are asking a lot of an 8086 CPU. This is where you go off the reservation with unrealistic expectations of a specific platform. You're confusing the ability to support a lesser environment with the inability to properly support a more capable platform. If an OS is running with a limited environment it should handle it gracefully. If it runs out of memory for networking it will simply have to wait until something is freed up before it can continue sending data. If that means blocking the application or returning an error it should do that regardless of whether it's an 8086 or an 80x86. Just because it's less likely to happen on one platform than it is on another doesn't mean the OS itself will run poorly on a more capable machine.

BWT, I'm curious when the OS you're working on will have a full network stack and be capable of running a web browser, mail application, and a WYSIWYG text editor.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Solar »

Let's try a different angle.

@Deprecated:

What kind of use do you picture for the 8086 engines you'll support?

You want your OS to "support" them. You want to "enable" the users of your OS to do something with them. What will that be? Certainly not a GUI desktop (for obvious reasons). You must have a general idea as for why you want to support those dinos; and yes, this is topical for this discussion, as no kernel exists "in limbo".
Every good solution is obvious once you've found it.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Brendan »

Hi,
Deprecated wrote:
Brendan wrote:Let's consider a floppy driver. For performance reasons (on modern machines) I normally implement a floppy driver with a built-in "track cache" to minimise the number of seeks (head movement, head settle time, rotational latency, etc). It also allows me to allocate RAM that's suitable for the ISA DMA controllers (e.g. doesn't cross 64 KiB boundaries, etc) and keep it (rather than constantly freeing/reallocating);
This is actually split between the driver and the file manager...

At the driver level the request may be for a specific type or "color" of memory. In the case of DMA or other task specific memory requirements the kernel may set aside a certain amount and/or specific region of memory (configurable). Optimally this memory could be allocated for common usage (general kernel or user space) as a last resort.

General caching will occur in a separate module controlled primarily by the file manager as it has direct knowledge of the file system and read/write modes for specific file descriptors. When the data is loaded by the driver either by polling or driven by interrupts it gets passed up to the file manager with a weight value and a hint indicating it's how caching should be applied. This allows caching to be balanced between devices as well as different file systems on low memory systems and reduces code duplication.
I'm more used to "3 layer" systems; with a VFS (Virtual File System) at the top that caches file data; the file system/s themselves in the middle (which don't cache anything); then the device driver/s at the bottom which cache sectors/blocks/tracks. There's a variety of cases where data that isn't file data (that isn't cached at the VFS level) is used, including file system meta-data (e.g. the "cluster allocation table" in FAT), partition tables, direct access (e.g. "cp /dev/hda1 /backup" and specialised stuff like database engines), parity/CRC data for software RAID, etc. Of course "3 layers" isn't always 3 layers - typically you should be able to do things like mount files (disk images), etc.

Having a global system for freeing "freeable" RAM is a good idea; but it needs to cover everything (not just file caches, but all caches/buffers used for any purpose, discardable data used to improve search performance, any garbage collected RAM), and also needs to interact with things like swap space and memory mapped files and the "out-of-memory" killer. For example, if a process has allocated a lot of RAM that is only used very rarely, then you probably want to send the process' data to swap space so that you can use the RAM to cache file data that is accessed often. For real mode you can't really do most of it (no memory mapped files, no swap space, no allocation on demand, no copy on write, etc), so in that case it devolves down to just freeing stuff.


Deprecated wrote:
Brendan wrote:Then there's networking. [snip] Software rendering with triple buffering and font engines for proportional fonts and Unicode support? How about sound? 1 byte per sample with a sample rate of 44 Khz, with a buffer big enough to do mixing in software without audible glitches? Printer and scanner drivers? [snip] everything from WYSIWYG word processors, to web browsers to GUIs. Then there's any of the heavier tools and utilities - file archival and compression, compilers (and virtual machines and interpreters), database engines, HTTP/FTP/NNTP/mail servers, etc.
You certainly are asking a lot of an 8086 CPU. This is where you go off the reservation with unrealistic expectations of a specific platform. You're confusing the ability to support a lesser environment with the inability to properly support a more capable platform. If an OS is running with a limited environment it should handle it gracefully. If it runs out of memory for networking it will simply have to wait until something is freed up before it can continue sending data. If that means blocking the application or returning an error it should do that regardless of whether it's an 8086 or an 80x86. Just because it's less likely to happen on one platform than it is on another doesn't mean the OS itself will run poorly on a more capable machine.
Am I asking a lot for 8086, or am I asking an average amount for modern machines and wondering how you're going to use any of that software on an 8086? It's a trick question - it's the same thing from different perspectives.
Deprecated wrote:BWT, I'm curious when the OS you're working on will have a full network stack and be capable of running a web browser, mail application, and a WYSIWYG text editor.
My project is different in that I want to make a clean break from past/current technologies and redesign everything with the benefit of hindsight. With this in mind I never want to see a traditional web browser or mail client on my OS. A full networking stack is hard to say - it's going to take a lot of research into things like mesh networks before I determine what it will look like; and initially it'll probably only have direct packet interfaces (with no IP, TCP or UDP). A WYSIWYG word processor or text editor would take a lot of work in the video driver/s (software rendering and font engine), and I want to implement a toolchain before then, so probably (hopefully) I'll get to that in about 5 more years. Ironically the last time a version of my OS had a text editor was about 8 years ago (but it allowed multiple users editing the same document at the same, such that users see each others changes immediately and could use the text editor as a chat window).

My project is also different in that I've done the "hobbyist" thing already, and now I'm trying to make sure the end result is better than both Windows and Linux. It's a slow process, but I've learnt from past mistakes that "slow implementation with thorough design" is much better than "fast implementation that has to be redesigned and rewritten from scratch because the design sucked". What I really need is a time machine, so I can go back about 10 years and slap my younger self silly.. ;)


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by Owen »

Solar wrote:Let's try a different angle.

@Deprecated:

What kind of use do you picture for the 8086 engines you'll support?

You want your OS to "support" them. You want to "enable" the users of your OS to do something with them. What will that be? Certainly not a GUI desktop (for obvious reasons). You must have a general idea as for why you want to support those dinos; and yes, this is topical for this discussion, as no kernel exists "in limbo".
I get the impression (from his original post) that the 8086 usage has something to do with robotics. Now, most robots I know of run on far more limited processors than the 8086, so I see something completely feasible there
Brendan wrote: Having a global system for freeing "freeable" RAM is a good idea; but it needs to cover everything (not just file caches, but all caches/buffers used for any purpose, discardable data used to improve search performance, any garbage collected RAM), and also needs to interact with things like swap space and memory mapped files and the "out-of-memory" killer. For example, if a process has allocated a lot of RAM that is only used very rarely, then you probably want to send the process' data to swap space so that you can use the RAM to cache file data that is accessed often. For real mode you can't really do most of it (no memory mapped files, no swap space, no allocation on demand, no copy on write, etc), so in that case it devolves down to just freeing stuff.
You can most certainly implement swapping in real mode. As a result, you can also most certainly implement memory mapping. The implementation is going to be completely different from it would be on a system designed purely for virtual memory architecture, but it is entirely possible.

The method is simple: Rather than allocating memory directly, you allocate a memory handle. The application then locks either the whole handle, or a region of that memory handle to get its address. When the application has finished working with the memory object, it unlocks the region. You can extend this to memory mapping of files. You can also take advantage of this scheme to move memory around and reduce fragmentation

Macintosh System 1 did this on a 68000. I'm sure the Lisa did as well. 16-bit Windows did it too; you can see the legacy of this in the Win32 Local* and Global* APIs, which are a part of Win32 just to simplify porting Win16 applications.

I'm also sure that you could create some system involving thunks in order to support paging of code segments as well. It would be crazy, but it would be workable
jbu
Posts: 2
Joined: Mon Jan 05, 2009 2:44 pm
Location: France

Re: Supporting both Intel 8088/8086 and 80x86 CPUs

Post by jbu »

Hello,

I haven't been very active regarding osdev for months , but this topic jumped into my eyes -- ouch! -- since my osdev project targets the PC-XT platform.

My intention is not to create a full fledged, modern operating system, and it seems that Deprecated wants to write an os ressembling OS/9, so not one of the latest OSes either...

The 8086 platform is interesting, because quite simple, but in the same time very extensible both in hardware and software.
Minix v1 was targetted to XTs IIRC, and I've had much fun with it (on a 286 though!) .
DOS (MS and IBM) was targetted to PCs at first, and v3.2x was very usable on my XT with only 512 kb of memory

For sure, an 8086 PC is very slow compared to modern PCs, but we've worked with them for years. With the right tools 8086 based PCs are still very usable, as long as you don't go too far away beyond their limits. For example Psion has made great machines around the Nec V30 (8086 clone) with a real mode multitasking , graphical operating system, and all kinds (for that time) of applications, including its own programming language.

An OS/9 alike system seems to be inside these limits too.

I don't know OS/9 beyond what I've read about it , but I'd be happy to help. I have two Amstrad XTs (PC1512 and PC1640, both with hard disk) just waiting to be switched on . BTW, I'm looking for interesting XT and/or 8086 things like the Amstrad PC2086, Sinclair PC200, and Psion sibo and pre-sibo laptops/palmtops in france (can't afford the shipping).
Post Reply