OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 8:06 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 77 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: OS in D language
PostPosted: Mon Feb 02, 2009 6:03 am 
Offline
Member
Member
User avatar

Joined: Fri May 16, 2008 7:13 pm
Posts: 301
Location: Hanoi, Vietnam
Finally got it to work. Writing some wiki now ( as I promised :| )

_________________
"Programmers are tools for converting caffeine into code."


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Mon Feb 02, 2009 9:35 pm 
Offline
Member
Member
User avatar

Joined: Fri May 16, 2008 7:13 pm
Posts: 301
Location: Hanoi, Vietnam
Here you go:
http://wiki.osdev.org/GDC_Cross-Compiler
(Not completed)

_________________
"Programmers are tools for converting caffeine into code."


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Mon Feb 02, 2009 10:39 pm 
Offline
Member
Member
User avatar

Joined: Tue Aug 26, 2008 10:02 pm
Posts: 44
Location: Land of the Dead
Quote:
Change D_OS_VERSYM to whatever you want, since it is a string, like "MyOS" or NULL.


Wrong. If you set it to NULL, you will cause the compiler to segfault.

I noticed you copied and pasted much of the GCC Cross Compiler guide. Are you sure that is necessary? It really comes down to configuring GDC, changing D_OS_VERSYM, and then doing exactly what is in the GCC Cross Compiler guide. Fairly simple.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Tue Feb 03, 2009 4:56 am 
Offline
Member
Member
User avatar

Joined: Fri May 16, 2008 7:13 pm
Posts: 301
Location: Hanoi, Vietnam
Wilkie wrote:
Wrong. If you set it to NULL, you will cause the compiler to segfault.


Oops, I didn't know that :oops:

OK, check the page again. Complains are wellcome.

_________________
"Programmers are tools for converting caffeine into code."


Last edited by quanganht on Tue Feb 03, 2009 5:10 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Tue Feb 03, 2009 5:00 am 
Offline
Member
Member

Joined: Fri Aug 01, 2008 7:52 am
Posts: 248
quanganht wrote:
Wrong. If you set it to NULL, you will cause the compiler to segfault.

fixed ;) .


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Wed Feb 04, 2009 12:07 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 26, 2008 10:02 pm
Posts: 44
Location: Land of the Dead
shiner wrote:
fixed ;) .

Thanks! If I weren't lazy \ busy, I would have done that myself. Verification of that issue is here: PittGeeks.org. This was already referred in the topic, and this was our group, so I can personally confirm.

On a new note, the XOmB crew are working alongside the LDC crew. We have been their advisers on what is necessary for kernel work in D, within the D language spec. They have heeded us! They were missing the 'naked' attribute for inline assembly (which is QUITE necessary for kernel dev! especially when you want to define mixins for assembly routines for efficiency of computer time and coding time!)

Long story short, they are already working on implementing 'naked' for us and say it is in the testing stage. Soon, we can dump gdc for ldc. <strong opinion>YAY</strong opinion> Since we are working alongside them, they have been providing the builds, but I will take up the task of learning the process to build an LDC cross-compiler, and will personally write the wiki article.

For anyone interested, the differences between GDC and LDC are simply put: LDC is closer to the true D spec. Where it deviates is typically on the case of a compiler bug and inline assembly. Instead of the GAS syntax used in gcc, ldc uses the Intel syntax. It is also maintained...by several people! It is also BSD licensed, if that is a concern.

I think you might be able to use the "-masm=intel" flag to at least keep some portability in gdc, but it will still be a little different (mixins could allow some transparency). Don't quote me on it, though. But, hey, if it is possible and you don't want to have to spend a weekend switching operands (like ME), it might be better to just use the Intel syntax to begin with. I was going to do it last weekend, but I live in Pittsburgh :)


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Thu Feb 05, 2009 12:44 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
Wilkie wrote:
Soon, we can dump gdc for ldc. <strong opinion>YAY</strong opinion> Since we are working alongside them, they have been providing the builds, but I will take up the task of learning the process to build an LDC cross-compiler, and will personally write the wiki article.


That would be great! Can LDC object files be linked with LCC object files? Because while I'm hoping for my kernel to be pure D in the near future, I'm still linking with some of my old C++ code (a lot of the core kernel code is inter-dependent).

Other than that, and besides LDC being Linux only (it surely wouldn't be too hard to compile on (not target) Windows), there is nothing holding me to GCC.

_________________
My OS is Perception.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Thu Feb 05, 2009 5:45 pm 
Offline
Member
Member
User avatar

Joined: Tue Aug 26, 2008 10:02 pm
Posts: 44
Location: Land of the Dead
Yes, you should be able to link anything together in the same fashion as gcc and gdc.

Also, it would be possible to get it to work in Windows with much effort, but don't :P .

I am still waiting on getting the instructions for the cross compiler. I'm not sure if they understand that we need a naked compiler yet. That is, I haven't gotten to the linking stage yet, still switching operands.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Sat Feb 07, 2009 6:21 am 
Offline
Member
Member
User avatar

Joined: Fri May 16, 2008 7:13 pm
Posts: 301
Location: Hanoi, Vietnam
Eh? how to fix "code model 'kernel' not supported in 32 bit mode" ??? :?

EDIT: I got it. Rebuild GCC/GDC with target as x86_64-pc-elf

_________________
"Programmers are tools for converting caffeine into code."


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Sun Feb 08, 2009 1:31 am 
Offline
Member
Member

Joined: Wed Mar 07, 2007 10:09 am
Posts: 43
Location: Minneapolis, Minnesota
I've been working on an OS in the D programming language for quite some time now. I'm currently in the process of migrating servers, but the SVN repository is accessible here: http://svn.devlime.com/neptune

I have some detailed instructions for building a full set of cross compilers for GDC (targeting i586-pc-elf and x86_64-pc-elf) which have worked on amd64 ubuntu and cygwin in the past.

It looks like most of you have had issues with the missing object.d file, as well as various missing runtime functions. I ended up porting and rewriting a large portion of the D runtime (no garbage collection though). For this, I relied very heavily on the documentation and advice of Kris and Sean over at the Tango project (http://www.dsource.org/projects/tango).

If anyone has any questions I'd be happy to answer them - I haven't made my way through this whole thread yet.

_________________
Neptune - 64 bit microkernel OS in D - www.devlime.com


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Sun Feb 08, 2009 3:10 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
Wilkie wrote:
For userland, you will have to port a C runtime (newlib) and\or a D runtime (phobos, tango). Look at reference implementations, much of which you can copy verbatim. They make calls to a malloc and are easily understood. From there, you can interface with your page allocator.


I'm not actually that interested in porting a complete standard library like Phobos or Tango. I just want to implement enough of the runtime so every feature of the language (exceptions, RTTI, new/delete, concatenating strings, dynamic arrays, etc) will work.

As far as the the C Standard Library, is it required just for the runtime features of the language (not the standard libraries - Phobos/Tango)? (I'd much rather use my own functions for reading, writing, printing, etc until my OS is more mature).

_________________
My OS is Perception.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Sun Feb 08, 2009 8:43 pm 
Offline
Member
Member
User avatar

Joined: Tue Aug 26, 2008 10:02 pm
Posts: 44
Location: Land of the Dead
MessiahAndrw wrote:
I'm not actually that interested in porting a complete standard library like Phobos or Tango. I just want to implement enough of the runtime so every feature of the language (exceptions, RTTI, new/delete, concatenating strings, dynamic arrays, etc) will work.

For the language runtime, just implement all of the stubs. I really meant for you to refer to phobos and tango as to what each stub does rewriting the parts to refer to your kernel. But that is all you need to do.

MessiahAndrw wrote:
As far as the the C Standard Library, is it required just for the runtime features of the language (not the standard libraries - Phobos/Tango)? (I'd much rather use my own functions for reading, writing, printing, etc until my OS is more mature).

Nope. That would require porting the C standard library, and thus the C runtime to use your kernel, just to write the D runtime. Don't do that. :) What I was referring to was that to implement malloc in userland you would port either a C runtime or D runtime implementation.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Wed Mar 04, 2009 5:58 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
How is LDC coming along?

I'm keen on hearing about it. According to their website they're really close to getting something stable (unless they're just over-optimists and talk that way in general).

_________________
My OS is Perception.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Wed Mar 04, 2009 3:45 pm 
Offline
Member
Member
User avatar

Joined: Wed Jan 28, 2009 4:30 pm
Posts: 72
LDC is coming well. The bare bones compiles with it, and the OS is very close, too.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Tue Apr 07, 2009 2:01 am 
Offline
Member
Member

Joined: Fri Aug 22, 2008 12:01 pm
Posts: 50
Location: Germany - Aachen
I'm currently using the GDC with the barebone.
It compiles fine and I'm just trying to get it up in the higher half. I already loaded the trick GDT after coming from grub und jumped to the main method where I can print some text.

The big problem I have is as soon as I call a function in another module that is compiled seperately and should be linked afterwards, I'm getting a "Bus error" from LD. :?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 77 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group