For lack of a better word: Virtual Kernel?

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
User avatar
Brackets
Posts: 13
Joined: Sun Apr 29, 2007 12:22 pm

For lack of a better word: Virtual Kernel?

Post by Brackets »

Alright, my OS is designed around a x64 architecture so assuming space and speed are not an issue I've been toying with an idea that I thought might be an interesting idea to implement. Has anyone ever thought of something like a virtual kernel? Like a virtual machine enables you to load a kernel on a 'fake' portion of the hard drive, could a kernel have a procedure to load a version of itself?

My idea kind of breaksdown like this:
1. The base kernel is booted
2. A function in the base kernel set to run on boot runs
3. That function sets the base kernel's I/O ports (I am uneducated at this point, trying to learn, regarding what to call the addresses that the kernel interacts with so I'll say I/O ports) to a secondary position where they wont get in the way.
4. The function boots a second kernel, identical to the first but without the function that loads the virtual kernel
5. The empty I/O ports and other values for the hardware and stuff from the base kernel are assigned to the virtual kernel
6. Use continues as normal except that all processes are directed through the virtual kernel with the function used to start it running in the background.
7. Should a serious kernel error occur, a trigger in the function used to start the virtual kernel will terminate the virtual kernel, return the base kernel to the proper I/O ports and stuff and direct process through that until the virtual kernel is ready to work again at which point the process is repeated.

I'll try to make a flowchart:

Once virtual kernel is running:
_____________
|user interface| ----- Virtual Kernel ------ Process 1,2,3,etc
|_____________|,,,,,,,,,,,,,,,,,|
......................................| Function running the virtual kernel
......................................|
...............................Base Kernel

If an error occurs:

_____________
|user interface| ----- Virtual Kernel ------ Process 1,2,3,UH OH BADNESS!
|_____________|................|
.....................................X Function running the virtual kernel terminates
.....................................|
...............................Base Kernel

After the error:

_____________
|user interface| ----- Base Kernel ------ Process 1,2,3,minus the error giver
|_____________|

Then the base kernel rebuilds the virtual kernel

I know that this may be difficult and impractical, but it seems like an interesting idea for system stability. Can anyone supply me with an absolute deterrent besides 'it would slow stuff down' to try to implement this in Fenrir?

**EDIT**Not just deterrents but also suggestions would be nice too**EDIT**
Crazed123
Member
Member
Posts: 248
Joined: Thu Oct 21, 2004 11:00 pm

Post by Crazed123 »

So you're just virtualizing the kernel-level CPU privileges? What do you mean by I/O ports (since that's a defined term)?

Here's a suggestion: abstract over kernel-level CPU functionality with a Hardware Abstraction Layer, and then virtualize that.
User avatar
Brackets
Posts: 13
Joined: Sun Apr 29, 2007 12:22 pm

Post by Brackets »

By I/O ports, I mean whatever the proper term is for wherever/whatever the kernel uses to interface with hardware etc. I currently do not know the proper term for those locations, but I'm looking into that right now.
Post Reply