Kernel internal language

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
AbstractYouShudNow
Member
Member
Posts: 92
Joined: Tue Aug 14, 2012 8:51 am

Kernel internal language

Post by AbstractYouShudNow »

Here's the point.
All kernels I have ever seen consist of a Hardware Abstraction Layer (with device drivers), and other concepts built on top on it. So I thought of a thing; once we have all those pieces, wouldn't it be better to code the kernel itself using a custom language that would be platform-independant (using a bitcode system such as Java's one) but interoperable with other languages such as C. The basic idea is that we would write platform-dependant thing in classic languages such as C, but generic things (such as scheduling algorithm, task management, logical device coordination...) in a platform-independant language that would just allow us to organize the kernel, while calling the C routines for everything that is actually platform-specific. This would allow us to port our kernels to other architectures by just rewriting a bitcode compiler and all those platform-specific things, but the kernel would work just fine without a single code change.

I searched Google, and found a similar project at Microsoft Research, called Pebble, and even though I don't like Microsoft so much, I'm glad to know that there are professionnals thinking alike me. So do you think it would be worth it ?
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Kernel internal language

Post by bluemoon »

With proper design, a C kernel and its drivers is mostly source-level architecture independent.

With strict interface enforcement (for passing abstract API pointers), a C binary driver might be OS-independent if the architecture is same, although it's of less interest for many people and greatly limit the flexibility.

Then, the usefulness of fully architecture independent binary-level portability, which you're talking about, is an open decision - but chances are that for different architecture the device might already be meaningless (you won't talk about PS2 controller on ARM).
Antti
Member
Member
Posts: 923
Joined: Thu Jul 05, 2012 5:12 am
Location: Finland

Re: Kernel internal language

Post by Antti »

AbstractYouShudNow wrote:This would allow us to port our kernels to other architectures by just rewriting a bitcode compiler and all those platform-specific things
Currently we only have to rewrite all those platform-specific things. Of course "a bitcode system" might be interesting if source code for these platform-independent modules are kept under wraps even from people who port the system for some other architecture. Might be a valid reason for big companies.
rdos
Member
Member
Posts: 3297
Joined: Wed Oct 01, 2008 1:55 pm

Re: Kernel internal language

Post by rdos »

AbstractYouShudNow wrote:Here's the point.
All kernels I have ever seen consist of a Hardware Abstraction Layer (with device drivers), and other concepts built on top on it.
Count mine out. I don't have a HAL. I don't see the point for such a layer. Unless the user-API is the HAL.
linguofreak
Member
Member
Posts: 510
Joined: Wed Mar 09, 2011 3:55 am

Re: Kernel internal language

Post by linguofreak »

Antti wrote:
AbstractYouShudNow wrote:This would allow us to port our kernels to other architectures by just rewriting a bitcode compiler and all those platform-specific things
Currently we only have to rewrite all those platform-specific things. Of course "a bitcode system" might be interesting if source code for these platform-independent modules are kept under wraps even from people who port the system for some other architecture. Might be a valid reason for big companies.
I think his idea is that you wouldn't have to even recompile anything but the bytecode compiler and the platform-specific stuff to do a port.

But recompiling isn't *that* hard.
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: Kernel internal language

Post by dozniak »

linguofreak wrote:you wouldn't have to even recompile anything but the bytecode compiler and the platform-specific stuff to do a port.
So you effectively move the HAL to the bytecode compiler or its support library. There's still difference between device support on arches that only support MMIO (arm) and using port IO (x86).
Learn to read.
Post Reply