Can dmd compile with my own runtime library?

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Thu Aug 23 10:05:58 PDT 2007


Huang F Guan wrote:
> Frits van Bommel Wrote:
[snip]
> 
> Wow! That's interesting! 

Thanks.

> You have implemented the exception handling. Haha, I've written the _try and _catch which used in my old C kernel because there is no any keyword about exceptions in pure C.

As I tried to say (though perhaps not clearly enough) I didn't actually 
implement most of it, I just used Tango which includes the relevant 
runtime routines that are used (likely taken from Phobos). The only 
thing I had to do was make sure my executable included the _deh* symbols 
(IIRC they are emitted when the D main function is compiled, but I had 
to update my linker script to keep them since I use the --gc-sections ld 
switch that would otherwise have thrown them out).
The part about the _deh* symbols is probably DMD-only though, GDC uses 
the default GCC exception handling IIRC.

> Have you done the memory management and the thread management in your present kernel?

My memory management currently is able to allocate and deallocate pages, 
but my malloc/new just bumps a pointer, free/delete is a no-op and I 
like I said I don't have a GC yet, so it's mostly allocate-only. Since 
it's not really what you could seriously call a kernel[1] it's not 
really a problem yet since I don't allocate nearly enough to fill the 
memory.
Regarding threading, I have a way to start threads, but I currently have 
no way to *end* threads (just a way mark them 'blocked' and switch to 
another one :) ). And my scheduler is a simple round-robin skipping 
blocked threads, defaulting to an idle thread if no unblocked threads 
are found.


[1]: For instance: user-level code is mostly unimplemented currently, 
though I've done some experiments with it a while back. Mostly because I 
can't load programs from disk yet.

> http://0ginr.com/xiaoxia/
> This is web of my old os written in C&C++. There are screenshots on it. Also it has a GUI and it can execute pe files, and a little win32 compatible( can run the VC hello world ).

You're *that* guy? I really liked those screenshots when I first saw 
them posted on osdev.org. (The rest of the site is pretty much 
incomprehensible though :P)

My OS is currently text-only, though I have been looking into the VBE 3 
protected-mode interface. Unfortunately the only way I can test code to 
use it is to reboot my main computer so currently my OS just writes to 
screen whether or not it's available in the BIOS. (It doesn't seem to be 
supported by any emulator I could find)

> I like talking about the operating system teckniques with people who interests in os developing too. My projects are all open source, because I like free softwares. 
> 
> This is my email: gdxxhg at gmail.com 
> Mail me if we can develop os together!!

For me it's mostly hobby so I'd kind of like to figure stuff out myself. 
(also, you seem to be using Windows (judging by the prompt with your GDC 
error message and the fact the error message indicates GDC/Mingw) but my 
OS currently requires DMD/Linux to work, and I rather like ELF)

However if you post on the osdev.org forums I might be one of those who 
answer.



More information about the Digitalmars-d mailing list