Protected Mode?

So both me and my son have been reading a lot on how to build an operating system and both him and me realized that if we were to build a usefull multi-threading operating system we need some kind of memory & io device protection. Simply put a Protected Mode that ensures that only the kernel can change/setup memory pages, call IO devices or other IO related stuff.

But how do you do that on an 8-bit processor that was designed without any kind of multi-threading in mind or any kind of operating system safety at all?

Well… An evening a couple of days ago, my son comes in to me and says he has been thinking about how to do Protected Mode on our 6309. He had been looking at Andy Hu (https://www.youtube.com/@andyhu9542) and his Z80 based HEC that he build with Protected Mode suport. And my son thougth he found a way to make something similar but for the µLind. So I looked thru his schematics and the ide seemed possible. So for Stage 3 we are going to make support for Protective mode.

His idea was actually very simple, disable the IO_EN signal unless it is requested right after a SWI interrupt and let the interupt handle all IO operations. I principle:

  • Set up an ID of what “protected” operation you want to do in X register.
  • Call SWI (this will change state of BS to indicate interrupt)
  • The logic enables Protected Mode (ie. enables IO_EN signal)
  • The SWI interrupt decodes what to do from the X register.
  • Performs requested action (If allowed)
  • Resets Protected Mode by writning to the PM register (resets the Protected Mode latch)
  • Returns to normal operation.

This is actually very simple to do with the current Stage 3 design, I only needed to add a 3-8 decoder for the enable signals (all pins on the logic chip that will perform the PM check was occupied) and a transistor to pull a bit of the databus low to indicate PM when reading the PM register.

So will this actually work in real life, well that will remains to be seen… In Stage 3!

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.