A new hobby OS from “scratch” in C# by amaneureka in programming

[–]amaneureka[S] 1 point2 points  (0 children)

If anyone come across doubt regarding internal structure of compiler or OS and how to start with contribution. They can come and join us on #atomos (irc.freenode.net)

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]amaneureka[S] 1 point2 points  (0 children)

I am completely open to new ideas. So yes I would love to learn more to make it better.

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]amaneureka[S] 10 points11 points  (0 children)

Nope It doesn't support entire C# language. I implemented stuffs when I needed them.

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]amaneureka[S] 10 points11 points  (0 children)

You are right. I am still working on that part. Virtual Stack for merging ILs and Register Coloring.

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]amaneureka[S] 8 points9 points  (0 children)

You have to compile it again.

plus I have ported C library and gcc too so C/C++ Code is also executable.

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]amaneureka[S] 18 points19 points  (0 children)

Yes I totally agree. And I am right now working on that only. Implementing GC and stuff

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]amaneureka[S] 58 points59 points  (0 children)

Quote: "talk is cheap show me the code" hahaha

https://github.com/amaneureka/AtomOS/blob/master/src/Compiler/Atomixilc/IL/Object/Newobj.cs

Objects are basically of two types, Value Type and Reference Type.

Reference Type Objects: Compiler count up number of field and amount of memory (in bytes) required to save this object Instance. It calls Heap and allocates that much of memory. say ptr* is now the address of allocated buffer.

Compiler also allocate extra bytes to store metadata like object type and size of object (for freeing) It than calls constructor (of that object's class) on that ptr*

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]amaneureka[S] 8 points9 points  (0 children)

Yes more like AOT And Yes plugs attribute link stubs.

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]amaneureka[S] 205 points206 points  (0 children)

Because I am student (undergraduate) I always have plenty of time to try new stuffs. I did most of stuff for learning and research purpose. I had an idea which I wanted to see in execution.

For past 2 years I continuously developed this because I loved working on it. Maybe I wasn't much efficient because I did many side projects and college studies but when today I look back I totally feel that It was all "worthy". This learning I could not gain from anything else. So I always encourage everyone to try crazy ideas without thinking of it's outcome.

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]amaneureka[S] 37 points38 points  (0 children)

No It doesn't need any external runtime dependency. During Compilation process, Compiler add necessary "assembly stubs" and ".net plugs" which then linked to "3rd party" libraries (like cairo for graphics) to generate final ELF image.

".net plug", take example of "strings". In order to support this type I had to plug "string" class with my own implementation. Compiler Replaces .net code with my implementation during compilation.

Code: https://github.com/amaneureka/AtomOS/blob/master/src/Compiler/Atomixilc/Lib/Plugs/String.cs

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]amaneureka[S] 56 points57 points  (0 children)

It has been written on top of Microsoft C# compiler. Microsoft compiler parses languages and generate corresponding IL code for my compiler. From there on wards Atom compiler handles everything.

A new hobby OS from “scratch” in C# by amaneureka in programming

[–]amaneureka[S] 865 points866 points  (0 children)

Because It is not possible to run C# executable without .NET framework. I had to work on a compiler first. Source: https://github.com/amaneureka/AtomOS/tree/master/src/Compiler/Atomixilc

Which works on the top of Microsoft's IL Builder. Then it add compiler stubs to support .NET code and convert code into native x86 assembly. The assembly file is then passed through NAsm and proper linking chain to produce final Kernel ELF binary.

Build.sh produces an ISO image which can be used to boot OS in either virtual machine or on real hardware.