www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - D as System Language

reply "Columbus" <notworking notworking.com> writes:
I'm not so much into the D Projects, but am familiar with the
concepts of the language.
I want to use D as the language of a hobby operating system.
There isn't much documentation about doing so, and the question
already got asked: "When D is a system language, why hasn't
anyone made an OS in it yet?".
So I ask it again, maybe a bit differently:

"Is there usefull documentation about using D as OS language?"

I know there's https://github.com/xomboverlord , but this is for
D1, and didn't get updated to D2.
It won't get updated by me (in the near future), because I don't
know enough of D and the inner workings of it, to do such a thing.
For your interest: At first, the OS should run on x86_64.
Don't expect any repositories hosted by me about an OS in D, it's
just a hobbyistic interest of me.
Mar 30 2015
next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Monday, 30 March 2015 at 15:32:25 UTC, Columbus wrote:
 "Is there usefull documentation about using D as OS language?"
I wrote briefly in my book some stuff that might help get you started https://www.packtpub.com/application-development/d-cookbook Basically you can start with an empty runtime and then add back missing functions as needed to get it to compile.
 For your interest: At first, the OS should run on x86_64.
Though I did 32 bit, I haven't worked with 64 bit. Probably not that much different though.
Mar 30 2015
next sibling parent reply "Columbus" <notworking notworking.com> writes:
On Monday, 30 March 2015 at 15:39:07 UTC, Adam D. Ruppe wrote:
 Basically you can start with an empty runtime and then add back 
 missing functions as needed to get it to compile.
What do you mean by "an empty runtime"? What does a runtime need? On Monday, 30 March 2015 at 15:42:46 UTC, weaselcat wrote:
 https://github.com/xomboverlord/xomb
Yes I know, but it is D1 and not D2. I do not exactly understand the differences, but I want to use D2 because I don't know what would be better when I'd use D1.
Mar 30 2015
parent reply Mathias Lang via Digitalmars-d <digitalmars-d puremagic.com> writes:
2015-03-30 18:01 GMT+02:00 Columbus via Digitalmars-d <
digitalmars-d puremagic.com>:

 On Monday, 30 March 2015 at 15:39:07 UTC, Adam D. Ruppe wrote:

 Basically you can start with an empty runtime and then add back missing
 functions as needed to get it to compile.
What do you mean by "an empty runtime"? What does a runtime need? On Monday, 30 March 2015 at 15:42:46 UTC, weaselcat wrote:
 https://github.com/xomboverlord/xomb
Yes I know, but it is D1 and not D2. I do not exactly understand the differences, but I want to use D2 because I don't know what would be better when I'd use D1.
I would discourage learning a language by writting a kernel (unless you previously wrote a decent one). You'll run into issues that you won't be able to easily debug, and very few people will be able to help you. You might get away by doing that with much lower level language (C, ASM), but that's pretty much it. Even C++ has some hard to debug corner case when you go freestanding. Note: It doesn't mean D is not suitable for such a task. But I tried it myself and run into more problems than I can remember. Some people came with interesting solutions: I found https://www.youtube.com/watch?v=o5m0m_ZG9e8 very interesting (and I think it blew everyone's mind at that time ;) ). Adam also had a talk at last year's DConf, and an ebook you can easily find. Note that *the* place to go for OSDev is osdev.org which has some (sometimes outdated) D-related topics (and will give you exactly the same advice as me).
Mar 30 2015
parent reply "Columbus" <notworking notworking.com> writes:
On Monday, 30 March 2015 at 16:17:33 UTC, Mathias Lang wrote:
 Note that *the* place to go
 for OSDev is osdev.org which has some (sometimes outdated) 
 D-related topics
 (and will give you exactly the same advice as me).
Acutally I'm on osdev.org , I just wanted to hear something from D people and not only from osdev people. It's always good to hear different opinions. Also I thought I would find some documentation about creating a custom runtime and so on. Which is information I didn't get from osdev.org
Mar 30 2015
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Monday, 30 March 2015 at 17:19:38 UTC, Columbus wrote:
 Also I thought I would find some documentation about creating a
 custom runtime and so on. Which is information I didn't get from
 osdev.org
I think there is a page on the osdev wiki somewhere, but odds are the chapter in my book is the best we have (and even there, I didn't go too deep into it, I just got interrupts working on x86) I can also offer my minimal.zip which does exceptions and other more advanced features on bare metal and could serve as a guide/starting point. http://arsdnet.net/dcode/minimal.zip
Mar 30 2015
parent reply "Columbus" <notworking notworking.com> writes:
On Monday, 30 March 2015 at 17:22:47 UTC, Adam D. Ruppe wrote:
 I think there is a page on the osdev wiki somewhere, but odds 
 are the chapter in my book is the best we have (and even there, 
 I didn't go too deep into it, I just got interrupts working on 
 x86)

 I can also offer my minimal.zip which does exceptions and other 
 more advanced features on bare metal and could serve as a 
 guide/starting point.
 http://arsdnet.net/dcode/minimal.zip
I'm now reading the specific chapter in your book. Maybe I'll work it out.
Mar 30 2015
parent "Columbus" <notworking notworking.com> writes:
Many thanks for your work!!!

This is the thing I searched so long.
Now only the people from risc-v need to publish the privileged
ISA documentation, and I can work on my weird plan.
I don't know in what kind of problems I'm running into, but it is
one of the only exciting things I'm interested in.

I want to create an OS written in D for the RISC-V platform.
Maybe some UNIX clone, or an exokernel. I don't know. Probably
some combination (I mean they don't exclude eachother).

But don't expect anything from me, maybe you will hear from me
again in some time, maybe not. This is the current plan I'm
working on, but it may change.

thanks again for your help

Columbus out
Mar 30 2015
prev sibling parent "lobo" <swamplobo gmail.com> writes:
On Monday, 30 March 2015 at 15:39:07 UTC, Adam D. Ruppe wrote:
 On Monday, 30 March 2015 at 15:32:25 UTC, Columbus wrote:
 "Is there usefull documentation about using D as OS language?"
I wrote briefly in my book some stuff that might help get you started https://www.packtpub.com/application-development/d-cookbook Basically you can start with an empty runtime and then add back missing functions as needed to get it to compile.
 For your interest: At first, the OS should run on x86_64.
Though I did 32 bit, I haven't worked with 64 bit. Probably not that much different though.
I wrote a small 64-bit OS kernel that basically echos keystrokes back at you. I got bored with mine. I'd done what I was interested in, which was a x86_64 bootloader in ASM + D using grub2. The osedv.org site was useful but a lot of the information is incorrect or outdated, especially the 64-bit bootloader and grub2 stuff. The D Cookbook is a great read by the way, nice work ! bye, lobo
Mar 30 2015
prev sibling next sibling parent "cym13" <cpicard openmailbox.org> writes:
On Monday, 30 March 2015 at 15:32:25 UTC, Columbus wrote:
 Don't expect any repositories hosted by me about an OS in D, 
 it's just a hobbyistic interest of me.
I find it a bit sad... I mean, today not much documentation exists, such a project could be a great example. If everybody locks down its projects then of course nobody will find about it. Maybe the answer to your first question was that other did but decided not to share it. Well, that said, it is your choice to open it or not, and I have no right to criticize this any further.
Mar 30 2015
prev sibling next sibling parent reply "weaselcat" <weaselcat gmail.com> writes:
On Monday, 30 March 2015 at 15:32:25 UTC, Columbus wrote:
 I'm not so much into the D Projects, but am familiar with the
 concepts of the language.
 I want to use D as the language of a hobby operating system.
 There isn't much documentation about doing so, and the question
 already got asked: "When D is a system language, why hasn't
 anyone made an OS in it yet?".
 So I ask it again, maybe a bit differently:

 "Is there usefull documentation about using D as OS language?"

 I know there's https://github.com/xomboverlord , but this is for
 D1, and didn't get updated to D2.
 It won't get updated by me (in the near future), because I don't
 know enough of D and the inner workings of it, to do such a 
 thing.
 For your interest: At first, the OS should run on x86_64.
 Don't expect any repositories hosted by me about an OS in D, 
 it's
 just a hobbyistic interest of me.
https://github.com/xomboverlord/xomb
Mar 30 2015
parent "Paulo Pinto" <pjmlp progtools.org> writes:
On Monday, 30 March 2015 at 15:42:46 UTC, weaselcat wrote:
 On Monday, 30 March 2015 at 15:32:25 UTC, Columbus wrote:
 I'm not so much into the D Projects, but am familiar with the
 concepts of the language.
 I want to use D as the language of a hobby operating system.
 There isn't much documentation about doing so, and the question
 already got asked: "When D is a system language, why hasn't
 anyone made an OS in it yet?".
 So I ask it again, maybe a bit differently:

 "Is there usefull documentation about using D as OS language?"

 I know there's https://github.com/xomboverlord , but this is 
 for
 D1, and didn't get updated to D2.
 It won't get updated by me (in the near future), because I 
 don't
 know enough of D and the inner workings of it, to do such a 
 thing.
 For your interest: At first, the OS should run on x86_64.
 Don't expect any repositories hosted by me about an OS in D, 
 it's
 just a hobbyistic interest of me.
https://github.com/xomboverlord/xomb
xomboverlord happens to be Steve Klabnik, now on the Rust team.
Mar 30 2015
prev sibling next sibling parent reply "Mike" <none none.com> writes:
On Monday, 30 March 2015 at 15:32:25 UTC, Columbus wrote:

 I want to use D as the language of a hobby operating system.
 There isn't much documentation about doing so, and the question
 already got asked: "When D is a system language, why hasn't
 anyone made an OS in it yet?".
 So I ask it again, maybe a bit differently:

 "Is there usefull documentation about using D as OS language?"
There was an attempt to create an operating system in D, but it didn't end well. Repository: https://github.com/klamonte/cycle Critique of D: https://github.com/klamonte/cycle/blob/master/docs/no_more_d.md That critique and my own frustrations trying to us D for bare-metal programming led to this thread: http://forum.dlang.org/post/khyopozjdkximzmczayz forum.dlang.org IMO, D is an efficient applications programming language with great potential for systems programming, but to reach that potential, a few changes need to be made to the compiler and the runtime. However, the community's aversion to change, and bias towards other programming domains has made that highly unlikely and low priority. I tried to move it forward, but found myself fighting the current. I don't care for some of Rust's ML influence, but with their minimal runtime philosophy, libcore, and modular language features, they seemed to have put more thought into bare-metal and systems programming programming. My heart is still with D, though. Mike
Mar 30 2015
next sibling parent reply "Daniel Murphy" <yebbliesnospam gmail.com> writes:
"Mike"  wrote in message news:agjtqstkqvcnzitklnhz forum.dlang.org...

 IMO, D is an efficient applications programming language with great 
 potential for systems programming, but to reach that potential, a few 
 changes need to be made to the compiler and the runtime.  However, the 
 community's aversion to change, and bias towards other programming domains 
 has made that highly unlikely and low priority.  I tried to move it 
 forward, but found myself fighting the current.
Will you be attending dconf this year? I'd be interested to have a chat with you about this.
Mar 30 2015
parent "Mike" <none none.com> writes:
On Tuesday, 31 March 2015 at 04:33:54 UTC, Daniel Murphy wrote:
 "Mike"  wrote in message 
 news:agjtqstkqvcnzitklnhz forum.dlang.org...

 IMO, D is an efficient applications programming language with 
 great potential for systems programming, but to reach that 
 potential, a few changes need to be made to the compiler and 
 the runtime.  However, the community's aversion to change, and 
 bias towards other programming domains has made that highly 
 unlikely and low priority.  I tried to move it forward, but 
 found myself fighting the current.
Will you be attending dconf this year? I'd be interested to have a chat with you about this.
To my great disappointment, I will not be able to attend DConf this year. But I do welcome constructive discussion on this topic.
Mar 30 2015
prev sibling parent reply "Kagamin" <spam here.lot> writes:
On Tuesday, 31 March 2015 at 00:27:49 UTC, Mike wrote:
 There was an attempt to create an operating system in D, but it 
 didn't end well.
 Repository:  https://github.com/klamonte/cycle
 Critique of D:  
 https://github.com/klamonte/cycle/blob/master/docs/no_more_d.md
Hmm... dunno, I use D for bare metal programming in a sense that I control all its behavior and dependencies. Probably the only valid point there is about SDC, as it's indeed in very early stage of development.
Mar 31 2015
parent "w0rp" <devw0rp gmail.com> writes:
On Tuesday, 31 March 2015 at 12:45:03 UTC, Kagamin wrote:
 On Tuesday, 31 March 2015 at 00:27:49 UTC, Mike wrote:
 There was an attempt to create an operating system in D, but 
 it didn't end well.
 Repository:  https://github.com/klamonte/cycle
 Critique of D:  
 https://github.com/klamonte/cycle/blob/master/docs/no_more_d.md
Hmm... dunno, I use D for bare metal programming in a sense that I control all its behavior and dependencies. Probably the only valid point there is about SDC, as it's indeed in very early stage of development.
I see this document as positive, and something we should look at. Whenever someone says, "This software isn't complete because it doesn't do X properly," you can make the software do X properly. It would be nice if we could address the valid concerns and get something for a good common bare metal D runtime or something.
Mar 31 2015
prev sibling next sibling parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Monday, 30 March 2015 at 15:32:25 UTC, Columbus wrote:
 I'm not so much into the D Projects, but am familiar with the
 concepts of the language.
 I want to use D as the language of a hobby operating system.
 There isn't much documentation about doing so, and the question
 already got asked: "When D is a system language, why hasn't
 anyone made an OS in it yet?".
 So I ask it again, maybe a bit differently:

 "Is there usefull documentation about using D as OS language?"

 I know there's https://github.com/xomboverlord , but this is for
 D1, and didn't get updated to D2.
 It won't get updated by me (in the near future), because I don't
 know enough of D and the inner workings of it, to do such a 
 thing.
 For your interest: At first, the OS should run on x86_64.
 Don't expect any repositories hosted by me about an OS in D, 
 it's
 just a hobbyistic interest of me.
Entirely by accident I ran into this project today: https://github.com/Bloodmanovski/Trinix
Mar 30 2015
prev sibling parent "w0rp" <devw0rp gmail.com> writes:
A guy, Michael V. Franklin, discussed this kind of D programming 
a bit at DConf 2014.

https://www.youtube.com/watch?v=o5m0m_ZG9e8

If you're getting into this kind of thing, it's a must see. With 
some Googling, I found his minimal D runtime, too.

https://github.com/JinShil/druntime_level_0

I might take his work and Adam's work and make something myself. 
I'm currently in the middle of trying to get a D program to run 
on a Pebble watch, and I know this kind of runtime replacement 
stuff is coming.

One thing I would like to see is a minimal runtime with version 
blocks. So you can introduce only parts of the runtime that you 
want, make parts of the runtime do different things, or turn 
parts of the runtime off so you can provide your own 
implementation specific to the machine you're working with.
Mar 31 2015