Can dmd compile with my own runtime library?
Huang F Guan
gdxxhg at gmail.com
Thu Aug 23 09:29:54 PDT 2007
Frits van Bommel Wrote:
>
> Like I said, I switched to just using Tango. It's quite easy to port. In
> fact, looking at my diff viewer, I mostly just copied the posix.mak
> files to MyOS.mak and added -D__MyOS__ to CFLAGS and -version=MyOS to
> the other *FLAGS and then commented and versioned out some code that
> needed stuff I didn't support yet (locking) and/or didn't need anyway
> (floating point support).
> In my kernel sources I added an empty "extern(C) void thread_init()"
> (with TODO comment), implemented malloc, calloc and free using my kernel
> allocation functions, and added this into a file called init.d:
> ---
> import multiboot;
> import console;
> import mem.init;
>
> extern (C) bool rt_init( void delegate( Exception ) dg = null );
> extern (C) bool rt_term( void delegate( Exception ) dg = null );
>
> int main(char[][] args);
>
> extern(C) void init() {
>
> extern(C) void rtinitExceptionHandler(Exception e) {
> writefln("Uncaught exception in runtime: {}", e);
> throw new Exception("Exception during runtime initialization", e);
> }
>
> try {
> mem_init();
>
> rt_init(&rtinitExceptionHandler);
>
> /// Shouldn't return...
> main(multiboot.commandLine());
>
> } catch (Exception e) {
> writefln("Uncaught exception: {}", e);
> } catch (Object o) {
> writefln("Uncaught non-Exception exception: {}", o);
> }
> writeln("main() returned, halting processor.");
> for(;;) asm { cli; hlt; }
> }
> ---
Wow! That's interesting!
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.
Have you done the memory management and the thread management in your present kernel?
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 ).
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!!
More information about the Digitalmars-d
mailing list