Kernel Design - Opinions wanted
Posted: Sat May 31, 2014 12:39 pm
As I stated int the title I do encourage opinions, as most of kernel design is opinion anyways...
So, unfortunately I haven't worked on code in 4-5 days due to not being able to make up my mind on where to go.
I have a working, mostly, x86 kernel currently Monolithic - and I have realized I have a "huge" decision to make, How do I want my kernel to work. Most my ideas are unorthodox and my thoughts are sometimes random - Hope you can follow this.
Using Code box to hopefully organize a little
1.)
2.)
The only downfall I see with a MicroKernel is the kernel loader must be a kernel itself handling IRQs and ISRs and FDD (& HDD) drivers due to limitation in real mode on memory.
---------------
And part two MultiTasking Resource Management and INTs
I have no task or thread management, yet, I have TSS setup just enough to get to Ring 3 and I currently have my kernel mapped with Ring 3 access - will be changing this soon.
I by no means want HW Task Switching due to wanting this to run on a larger range of systems, so I will be implementing this in software linked to the PIC (currently set at ~100Hz)
This is mostly going to be about Resource I/Os.
I believe I understand how linux is handling all inputs and outputs, but please correct me if I'm wrong. Linux handles most if not all devices attached to the system as a file available for read and/or write (such as /dev/tty0 for the first terminal and /dev/sda for the first HDD) and the kernel handles whether the task has permission to access the file or not (also R/W).
I do see why it was done this way and how it simplifies the API, but I like being weird so here are a couple of my ideas
1)
2)
3)
4)
Yes it was a long post... but I cannot do any work with this rolling through my head constantly. And this is not even half of it but I will not bring it up at-least yet.
This was real brief and not very detailed all I'm interested in is the opinions of my fellow OSDEVers to help me make a decision so I can get back to work on code
--
If your opinion does not match anything above I would still love to hear it, but PLEASE keep this topic Civil - don't get mad if someone else's opinion differs from your own or standard practices.
- Brian
So, unfortunately I haven't worked on code in 4-5 days due to not being able to make up my mind on where to go.
I have a working, mostly, x86 kernel currently Monolithic - and I have realized I have a "huge" decision to make, How do I want my kernel to work. Most my ideas are unorthodox and my thoughts are sometimes random - Hope you can follow this.
Using Code box to hopefully organize a little
1.)
Code: Select all
Continue with the Monolithic Kernel Design and implement all "Common" drivers (VGA, PS/2, FDD, HDD, etc...) and allow drivers for other devices or replacements be installed via System Int to make the the PIC to the code needed for IRQx
Added drives will still be in Ring3 except for the IR which will be running in Ring0 when called from IDT allowing use of privileged commands and full HW control to an extent
Yes this can cause a security hole, which can be slightly patched by signing
Code: Select all
Remove all drivers from my Kernel and only have the bare core for the CPU to run and make a pure MicroKernel.
This would involve creating a stage 3 loader to open a file (text or fs like binary) listing all drivers and relative IRQ# and Load into memory, all while keeping track of it on a table in memory - possibly a temporary IDT that the kernel can just move and map. OR writing in pure ASM and expanding stage 2 (or better yet finding a way to link 16 and 32 bit together with LD)
And as before can still add drivers via System Int
---------------
And part two MultiTasking Resource Management and INTs
I have no task or thread management, yet, I have TSS setup just enough to get to Ring 3 and I currently have my kernel mapped with Ring 3 access - will be changing this soon.
I by no means want HW Task Switching due to wanting this to run on a larger range of systems, so I will be implementing this in software linked to the PIC (currently set at ~100Hz)
This is mostly going to be about Resource I/Os.
I believe I understand how linux is handling all inputs and outputs, but please correct me if I'm wrong. Linux handles most if not all devices attached to the system as a file available for read and/or write (such as /dev/tty0 for the first terminal and /dev/sda for the first HDD) and the kernel handles whether the task has permission to access the file or not (also R/W).
I do see why it was done this way and how it simplifies the API, but I like being weird so here are a couple of my ideas
1)
Code: Select all
Have a shared buffer in memory for each device driver installed with input or outputs and make the API handle everything
The location of buffer can be got from a Sys Int
2)
Code: Select all
Having a shared buffer for device drivers and local buffer for keyboard and video and have the kernel decide where the K/B data goes and which video buffer to use
3)
Code: Select all
Have a System Int for each installed driver and require a system call for all inputs outputs etc.
4)
Code: Select all
My favorite one, Create a Driver struct in the kernel and allow all inputs and outputs to be mapped into said table and kernel controls which task is linked or can use the device.
This is similar to Linux in a way, but it would be separate from the VFS and would have a few more options (at least in my own opinion)
This was real brief and not very detailed all I'm interested in is the opinions of my fellow OSDEVers to help me make a decision so I can get back to work on code
--
If your opinion does not match anything above I would still love to hear it, but PLEASE keep this topic Civil - don't get mad if someone else's opinion differs from your own or standard practices.
- Brian