digitalmars.D - Booting to D.
- John Carter (18/18) Nov 19 2013 So this post...
- Adam D. Ruppe (15/20) Nov 19 2013 Check this out:
- Adam D. Ruppe (4/5) Nov 19 2013 like i said, there i used grub, but the EFI thing looks like it
- growler (5/23) Nov 19 2013 http://wiki.osdev.org/D_Bare_Bones
- Jacob Carlborg (5/22) Nov 19 2013 You can have a look that this kernel written in D:
So this post... http://blog.theincredibleholk.org/blog/2013/11/18/booting-to-rust/ ..is interesting. Why? Because it tackles one of the core reasons why C is hard to dislodge. Almost every CPU on the planet "Boots to C", perhaps with a very thin crust of assembler. To dislodge C in my domain (embedded systems), this would be a very interesting and effective challenge to take on. What would it take to "Boot to D"? Or put it another way... What base infrastructure does a D program rely on that the OS has already provided before we hit "main"? Typically things like stack setup, program load, register initialization, zero'ing .bss segments and copying .data segments into ram etc. etc. Sometime mmap or sbrk for heap management. What else, and where to look?
Nov 19 2013
On Tuesday, 19 November 2013 at 22:49:07 UTC, John Carter wrote:What would it take to "Boot to D"?Check this out: http://arsdnet.net/dcode/minimal.zip I stripped out druntime, then put back only enough to get many of the language features working, but all standing alone. The makefile.bare (or whatever i called it) can make an elf image that can be loaded by GRUB onto bare x86 metal and run the little D program. Though...Typically things like stack setup, program load, register initialization, zero'ing .bss segments and copying .data segments into ram etc. etc.this stuff is all done by GRUB, so I cheated a little. It shouldn't be too hard to do in D though, if nothing else, a naked inline asm function at the start location.Sometime mmap or sbrk for heap management.and I didn't do much heap at all, I just dropped stuff in somewhere. But that's because I'm lazy more than because it is hard.
Nov 19 2013
On Tuesday, 19 November 2013 at 22:55:30 UTC, Adam D. Ruppe wrote:Check this out:like i said, there i used grub, but the EFI thing looks like it works more or less the same way - doing it with D should be fairly simple, especially with the stripped druntime.
Nov 19 2013
On Tuesday, 19 November 2013 at 22:49:07 UTC, John Carter wrote:So this post... http://blog.theincredibleholk.org/blog/2013/11/18/booting-to-rust/ ..is interesting. Why? Because it tackles one of the core reasons why C is hard to dislodge. Almost every CPU on the planet "Boots to C", perhaps with a very thin crust of assembler. To dislodge C in my domain (embedded systems), this would be a very interesting and effective challenge to take on. What would it take to "Boot to D"? Or put it another way... What base infrastructure does a D program rely on that the OS has already provided before we hit "main"? Typically things like stack setup, program load, register initialization, zero'ing .bss segments and copying .data segments into ram etc. etc. Sometime mmap or sbrk for heap management. What else, and where to look?http://wiki.osdev.org/D_Bare_Bones I suppose one could argue that technically it's booting into C as it still needs C linkage. But the kernel is D and it's compiled with a D compiler, so I'd consider it a D kernel.
Nov 19 2013
On 2013-11-19 23:49, John Carter wrote:So this post... http://blog.theincredibleholk.org/blog/2013/11/18/booting-to-rust/ ..is interesting. Why? Because it tackles one of the core reasons why C is hard to dislodge. Almost every CPU on the planet "Boots to C", perhaps with a very thin crust of assembler. To dislodge C in my domain (embedded systems), this would be a very interesting and effective challenge to take on. What would it take to "Boot to D"? Or put it another way... What base infrastructure does a D program rely on that the OS has already provided before we hit "main"? Typically things like stack setup, program load, register initialization, zero'ing .bss segments and copying .data segments into ram etc. etc. Sometime mmap or sbrk for heap management. What else, and where to look?You can have a look that this kernel written in D: https://github.com/xomboverlord/xomb -- /Jacob Carlborg
Nov 19 2013