linux kernel rewrite

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.
Post Reply
new_world
Posts: 5
Joined: Wed Jan 05, 2005 12:00 am

linux kernel rewrite

Post by new_world »

Hello

I'm interested in a new linux kernel, based on the existing :).
For that reason, i want to write a new compiler (because:
1. C and C++ aren't very good for kernel programming
1. b) the best language i know is java - but i can't write a kernel in java :D
2. the gas (assembler) language is awful

So i want to use yasm (or nasm).
I first want to implement a new language.
For that reason, i ask who is also interested in that.
The language will be similar to C/C++ with some details changed ...

I'll write soon :P
[AlAdDiN]
Member
Member
Posts: 107
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re: linux kernel rewrite

Post by [AlAdDiN] »

the idea is good if you want to reimplement the architecture (for example to write a microkernel for linux instead of classic monolitic), but the aproach is not to convencing ...

1. C and C++ aren't very good for kernel programing

wrong : C was especially writen for Unix kernel programing, it is the best language for OS coding, C++ is derivated from C and it is the best choice for oriented object kernels

1. b) the best language i know is java - but i can't write a kernel in java :D

hmm... I prefer python ;p (can't imagine ? virtual machine running on my OS to be able to run programs)

2. the gas (assembler) language is awful

all assembly languages give generally similar performances, it's up to programmer to hoose his assembler (generally for syntax reasons).


So i want to use yasm (or nasm).

OK


I first want to implement a new language.

good luck


I first want to implement a new language.
For that reason, i ask who is also interested in that.
The language will be similar to C/C++ with some details changed ...

have you allready written a compiler ???



Conclusion : go ahead and good luck XD
-----------------------
There are 10 types of people in this world... those that understand binary, and those that don't.
User avatar
JAAman
Member
Member
Posts: 877
Joined: Wed Oct 27, 2004 11:00 pm
Location: WA

Re: linux kernel rewrite

Post by JAAman »

I concur: c was designed explicitly for OS dev and its quite good at it

JAVA is horrible (but then again, i hate OOP so that may just be me)

you can use intel syntax with gas
you can use nasm(or yasm afaik) with GCC(just not for inline)
the asmbler in use has nothing to do with the language: just the programmers choice of tools

or if you dont like GCC use something else(there are thousands of C compilers)

writing your own language is just as big a project as writing an OS: so choose one (plus you wont get much help if you use a custom language because no one else knows it and wont want to learn it just to help you)
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Re: linux kernel rewrite

Post by Legend »

I agree with language design being a seperate field.
However, I would not call C the end of development for OS coding languages, and C++ not the end of object oriented kernels. Probably they are the best for now! And if those too are not good enough, then, it is time to create your own. But these two have one specific advantage - it is basically possible at all to write nearly everything in that language!

Java for os development is possible too - at a high enough level. It needs a good deal of C or C++ framework (garbage collection etc., bootstrap classloader I guess etc.) As a result, you would build a java virtual machine kernel in C. Drivers might go in Java.

However, I agree with being gcc's inline asm syntax being awful - saving 0,00001% performance as I heard a lot of times now with being proposed as the best since sliced bread while making it 500% harder to use it.

And yet a simpler OOP (as I think OOP is a must for projects bigger then your average hack, i.e. when you really need to solve a problem and you need to create a model of it) language for system development might be a good idea.

However, if you say you are interested in a new linux kernel, do you mean you want to follow the same design (monolithic etc.)? Why bother then anyway?
*post*
new_world
Posts: 5
Joined: Wed Jan 05, 2005 12:00 am

Re: linux kernel rewrite

Post by new_world »

About the compiler:

I think i only have in mind to "only" improve it (XOR operation / flag enumeration)

The kernel should be very modular with API. One module could be the core (bootup + memory).
Last edited by new_world on Fri Jan 07, 2005 12:00 am, edited 1 time in total.
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Re: linux kernel rewrite

Post by Legend »

That is basically already in the Linux kernel, on the development side, and is still in a process of development. The largest issue would be that the APIs constantely change ...
*post*
new_world
Posts: 5
Joined: Wed Jan 05, 2005 12:00 am

Re: linux kernel rewrite

Post by new_world »

Finally I have enough time to write ...

JAAman wrote:you can use nasm(or yasm afaik) with GCC(just not for inline)

It's important for me to write inline assembly (it's more comfortable, you haven't to write large assembler hacks).

About the improvments I think:

- XOR operation
- flag handling (optimized by compiler)
- limited macros -> they only apply in some sections of the code
- more warnings (redeclaration in inner functions !!!)
... I will write the compiler in the next time ...
I know this topic shouldn't be here, but if you have suggestions, please tell me!

About the kernel:

A Primary hierarchy:
*Core*
- PCI, AGP, Floppy Controller etc. (busses)
They provide interfaces like USB, FDC, HDC, Firewire etc.

A Secondary hierarchy:
*USB* (interfaces)
- different device drivers like storage

So there won't be lots of API changes, because if you write a USB device driver, you just care the USB-Interface (you register your driver and it would be loaded if your device is found).

The modules are linked to the API, so you just can download a driver from the internet and load it, without compiling it first! (But the API's may change, so they should be written backward compatible i. e. for one year)
Legend
Member
Member
Posts: 195
Joined: Tue Nov 02, 2004 12:00 am
Contact:

Re: linux kernel rewrite

Post by Legend »

Yes, this would be something, this is something that the linux kernel hacker especially avoid - for ideologic reasons mainly. At least for closed source drivers, there might be issues with the GPL as well (when you load them into the kernel address space).
*post*
new_world
Posts: 5
Joined: Wed Jan 05, 2005 12:00 am

Re: linux kernel rewrite

Post by new_world »

I don't think so about the law.

The GPL would affect *only* the kernel.
It don't care if you enhance it by commercial (closed source) modules *just* in memory (you don't compile them together).
I think it's like you run commercial (closed source) programs under Linux.
Last edited by new_world on Sat Jan 08, 2005 12:00 am, edited 1 time in total.
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Re: linux kernel rewrite

Post by carbonBased »

I've taken an interest in compiler development recently, myself... ultimately, I'd like to have a fully fledged compiler that I can write apps for my OS in... BUT, having said that, my kernel continues to be written in C.

Why? Because C is an extremely good low-level language for writting OSs, and I can (more or less) garauntee that the compiler is generating correct code.

My own language is already in development, and supports several different constructs, etc... but... being in development, I can't garauntee it's producing 100% accurate binary code.

To boil it down; to write an OS in a new language (to me) is much like creating an enigma, using an engima. It's nice to take out as much elements of the unknown as possible, and work with known, and highly-tested, options as much as possible.

As-per Java... entirely possible, of course. I work in a company that's developed a Java virtual machine that can run apps within a 25Mhz, 2MB RAM digital cable box... anything's possible...

In any event, I'd be inclined to think Eiffel is the best OO language out there.
[AlAdDiN]
Member
Member
Posts: 107
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re: linux kernel rewrite

Post by [AlAdDiN] »

instead of thinking to enhance the C/C++ compiler urself i think it will be more interesting to join exising project such as C-- ;)

it's only my opinion
-----------------------
There are 10 types of people in this world... those that understand binary, and those that don't.
alphakiller
Posts: 1
Joined: Tue Oct 26, 2004 11:00 pm

Re: linux kernel rewrite

Post by alphakiller »

Well, I currently have an Operating System Approach. It's called the Damn Small OS. It has a lower-level core written in C/Asm, with VFS, etc, providing resources to a libc (currently diet libc) that enable us to make an awesome usage of the Waba Virtual Machine. So the rest of the system, including the kernel it self, is being finished on top of such Machine in Java. So the lowest level part of it is in C/Asm, where Java can't deal with the machine. It's based on some aspects of microkernel and exokernel designs.
And yes, it's completely possible making an OS based on Java (not completely written on it), and you should try it... It might have IRC running on it soon. http://comos.sf.net/tdsos (sources) and http://comos.sf.net/download/commando.tar.bz2 (tree tarball). Feel free.
Post Reply