Page 1 of 2

Singularity source code available for download

Posted: Wed Mar 05, 2008 1:20 am
by Colonel Kernel
http://www.codeplex.com/singularity

Now we can see how it actually works...

Posted: Wed Mar 05, 2008 1:28 am
by xyzzy
Hmm... I was wondering if they would ever open source it yesterday. Maybe MS have been reading my thoughts ;)

Anyway, I'll be taking a look over it later today

Posted: Wed Mar 05, 2008 2:21 am
by jzgriffin
Singularity seems to be an interesting project. I've been following their progress for several months now. This was mentioned earlier on IRC, but I haven't had time to look at the code yet. Thanks for posting a link, I'd forgotten to bookmark it.

Posted: Wed Mar 05, 2008 7:45 am
by senaus
Oooh, I've been waiting for this :D

Now I've got decent bedtime reading material :)

Posted: Wed Mar 05, 2008 11:56 am
by astrocrep
Anyone tried to get it up and running?

Or better yet... build it?

I am very excited to dive into the code and take a look around!

-Rich

Posted: Wed Mar 05, 2008 3:55 pm
by lollynoob
Looking at the bootloader right now, and so far (from the bootsectors and singldr) it looks pretty awful.

Code: Select all

shl     eax, 5                  ; (assume no overflow)
Sounds safe.

Code: Select all

else if (startKB + sizeKB >= Struct_Microsoft_Singularity_BootInfo_MAX_VIRTUAL_ADDR / 1024ul) {
      sm[i].size.hi = 0;
      sm[i].size.lo = Struct_Microsoft_Singularity_BootInfo_MAX_VIRTUAL_ADDR - startKB * 1024;
Loving the concise constant names.

Code: Select all

BdPrintString("-------------------------------------------------------------------------------\n", 80);
Nice horizontal rule!

I'm not sure if this is some sort of weird publicity stunt or what, but a lot of it looks really hackish and generally bad.

Edit: I guess they learned C and ASM on the fly or something; the C# parts (the kernel and whatnot) actually look pretty nice. As nice as object-oriented code can look, anyways.

Posted: Wed Mar 05, 2008 4:08 pm
by Alboin
lollynoob wrote:

Code: Select all

else if (startKB + sizeKB >= Struct_Microsoft_Singularity_BootInfo_MAX_VIRTUAL_ADDR / 1024ul) {
      sm[i].size.hi = 0;
      sm[i].size.lo = Struct_Microsoft_Singularity_BootInfo_MAX_VIRTUAL_ADDR - startKB * 1024;
Loving the concise constant names.
My God. 'Struct_Microsoft_Singularity_BootInfo_MAX_VIRTUAL_ADDR'? They're ... kidding .. aren't they?

Posted: Wed Mar 05, 2008 4:18 pm
by os.hacker64
:shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock:

Posted: Wed Mar 05, 2008 4:54 pm
by jzgriffin
You never read the leaked source code for Win2k or WinNT, or even any Microsoft code examples? They love ridiculously long and obvious names. Either my ability to tell jokes from seriousness sucks, or they actually considered naming IE8 "IE Desktop Online Web Browser Live Professional Ultimate Edition for the Internet" (source). It certainly sounds Microsoft-ish.

Anyways, I'm back in Windows for the first time since Feb. 24th, so I'll see if I can compile it while I'm here.

Posted: Wed Mar 05, 2008 6:24 pm
by Colonel Kernel
I'm betting those long names are required for using C# constructs from C++ or asm. Most likely the C# namespaces get munged into long_names_with_underscores in the symbol table.

@lollynoob: You realize this is a research OS and not a commercial product, right?

Posted: Thu Mar 06, 2008 12:19 am
by jzgriffin
I just looked at a hex dump of a C# executable produced by gmcs. There were no long underscored names like that. It's a Microsoft thing.

Anyways, I lost interest in the code. It's not as fancy and clean looking as I imagined, sadly.

Posted: Thu Mar 06, 2008 12:52 am
by Colonel Kernel
Jeremiah Griffin wrote:I just looked at a hex dump of a C# executable produced by gmcs. There were no long underscored names like that. It's a Microsoft thing.
Yes, exactly. Singularity's dialect of C# is compiled with Bartok, which emits native code, not assemblies containing IL as gmcs and friends do.
Anyways, I lost interest in the code. It's not as fancy and clean looking as I imagined, sadly.
In my experience, no kernel code is. It's just a grotty, detail-infested kind of domain to work in. :P If you want elegance, look at compilers for higher-level languages (written in those same languages) instead. ;)

Posted: Thu Mar 06, 2008 1:12 am
by xyzzy
I haven't dived into the code yet, but I've got it up and running with Virtual PC. The PDF in the source .zip details everything you need to do pretty well, except netbooting with VPC: You need to do

Code: Select all

boottest.cmd /net singularity.vmc
That starts up the netboot server program automatically (you need to have done the loopback setup stuff).

If you build everything (the World target), however, it takes eons to start from the netboot server.

Oh and one more thing, WinDbg is evil to work with ;)

Posted: Thu Mar 06, 2008 2:07 am
by xyzzy
Just uploaded some screenshots of it here

Managed to get the webserver "working", it's a bit rusty but it seems to work, you can see it in sing5.jpg. Sorry about the bad quality of the JPGs, all I had was Paint and it likes to save JPGs in crap quality.

Posted: Thu Mar 06, 2008 9:51 am
by binutils
Jeremiah Griffin wrote: Anyways, I lost interest in the code. It's not as fancy and clean looking as I imagined, sadly.
FYI, another c# os http://gocosmos.org/

--
PS: i haven't looked at both os c# code.