<s>
C#	B-Application
Open	B-Application
Source	I-Application
Managed	O
Operating	B-General_Concept
System	I-General_Concept
(	O
Cosmos	B-Operating_System
)	O
is	O
a	O
toolkit	B-Library
for	O
building	O
GUI	O
and	O
command-line	B-Application
based	O
operating	B-General_Concept
systems	I-General_Concept
,	O
written	O
mostly	O
in	O
the	O
programming	O
language	O
C#	B-Application
and	O
small	O
amounts	O
of	O
a	O
high	O
level	O
assembly	B-Language
language	I-Language
named	O
X#	O
.	O
</s>
<s>
Cosmos	B-Operating_System
is	O
a	O
backronym	O
,	O
in	O
that	O
the	O
acronym	O
was	O
chosen	O
before	O
the	O
meaning	O
.	O
</s>
<s>
It	O
is	O
open-source	B-Application
software	I-Application
released	O
under	O
a	O
BSD	B-Operating_System
license	I-Operating_System
.	O
</s>
<s>
,	O
Cosmos	B-Operating_System
encompasses	O
an	O
ahead-of-time	B-Application
(	O
AOT	B-Application
)	O
compiler	B-Language
named	O
IL2CPU	B-Language
to	O
translate	O
Common	O
Intermediate	O
Language	O
(	O
CIL	O
)	O
into	O
native	O
instructions	O
.	O
</s>
<s>
Cosmos	B-Operating_System
compiles	B-Language
user-made	O
programs	O
and	O
associated	O
libraries	B-Library
using	O
IL2CPU	B-Language
to	O
create	O
a	O
bootable	B-Operating_System
native	O
executable	O
that	O
can	O
be	O
run	O
with	O
no	O
support	O
.	O
</s>
<s>
The	O
resulting	O
output	O
can	O
be	O
booted	O
from	O
a	O
USB	B-Protocol
flash	O
drive	O
,	O
CD-ROM	B-Device
,	O
over	O
a	O
network	O
via	O
Preboot	B-Device
Execution	I-Device
Environment	I-Device
(	O
PXE	O
)	O
,	O
or	O
inside	O
a	O
virtual	B-Architecture
machine	I-Architecture
.	O
</s>
<s>
Recent	O
releases	O
also	O
allow	O
deploying	O
to	O
certain	O
x86	B-Operating_System
embedded	O
devices	O
over	O
Universal	O
Serial	O
Bus	O
(	O
USB	B-Protocol
)	O
.	O
</s>
<s>
While	O
C#	B-Application
is	O
the	O
primary	O
language	O
used	O
by	O
developers	O
(	O
both	O
on	O
the	O
backend	O
and	O
by	O
end	O
users	O
of	O
Cosmos	B-Operating_System
)	O
,	O
many	O
CLI	B-Language
languages	I-Language
can	O
be	O
used	O
,	O
provided	O
they	O
compile	B-Language
to	O
pure	O
CIL	O
without	O
the	O
use	O
of	O
Platform	O
Invocation	O
Services	O
(	O
P/Invokes	O
)	O
.	O
</s>
<s>
Cosmos	B-Operating_System
is	O
mainly	O
intended	O
for	O
use	O
with	O
.NET	B-Application
.	O
</s>
<s>
Cosmos	B-Operating_System
does	O
not	O
aim	O
to	O
become	O
a	O
full	O
operating	B-General_Concept
system	I-General_Concept
,	O
but	O
rather	O
a	O
toolkit	B-Library
to	O
allow	O
other	O
developers	O
to	O
simply	O
and	O
easily	O
build	O
their	O
own	O
operating	B-General_Concept
systems	I-General_Concept
using	O
.NET	B-Application
.	O
</s>
<s>
It	O
also	O
functions	O
as	O
an	O
abstraction	B-Architecture
layer	I-Architecture
,	O
hiding	O
much	O
of	O
the	O
inner	O
workings	O
of	O
the	O
hardware	O
from	O
the	O
eventual	O
developer	O
.	O
</s>
<s>
Older	O
versions	O
of	O
Cosmos	B-Operating_System
were	O
released	O
in	O
Milestones	O
,	O
with	O
the	O
last	O
being	O
Milestone	O
5	O
(	O
released	O
August	O
2010	O
)	O
.	O
</s>
<s>
Releases	O
of	O
Cosmos	B-Operating_System
are	O
divided	O
into	O
two	O
types	O
:	O
the	O
Userkit	O
,	O
and	O
the	O
Devkit	O
.	O
</s>
<s>
The	O
Devkit	O
refers	O
to	O
the	O
source	O
code	O
of	O
Cosmos	B-Operating_System
and	O
must	O
be	O
built	O
manually	O
.	O
</s>
<s>
Most	O
work	O
on	O
Cosmos	B-Operating_System
is	O
currently	O
aimed	O
at	O
improving	O
debugger	B-Application
functionality	O
and	O
Microsoft	B-Application
Visual	I-Application
Studio	I-Application
integration	O
.	O
</s>
<s>
Kernel	B-Operating_System
work	O
is	O
focused	O
on	O
implementing	O
file	B-Application
systems	I-Application
,	O
memory	B-General_Concept
management	I-General_Concept
,	O
and	O
developing	O
a	O
reliable	O
network	O
interface	O
.	O
</s>
<s>
Limine	O
serves	O
as	O
the	O
project	O
's	O
bootloader	B-Application
-	O
in	O
older	O
versions	O
of	O
the	O
toolkit	B-Library
,	O
GRUB	B-Application
was	O
used	O
instead	O
.	O
</s>
<s>
The	O
idea	O
for	O
Cosmos	B-Operating_System
was	O
created	O
by	O
Chad	O
Hower	O
and	O
was	O
initially	O
co-developed	O
by	O
Hower	O
and	O
Matthijs	O
ter	O
Woord	O
.	O
</s>
<s>
Over	O
time	O
,	O
Cosmos	B-Operating_System
has	O
been	O
maintained	O
and	O
improved	O
by	O
many	O
other	O
individuals	O
.	O
</s>
<s>
Cosmos	B-Operating_System
has	O
many	O
facilities	O
to	O
improve	O
the	O
experience	O
of	O
developing	O
operating	B-General_Concept
systems	I-General_Concept
with	O
it	O
,	O
designed	O
to	O
make	O
the	O
process	O
as	O
fast	O
and	O
painless	O
as	O
possible	O
,	O
knowledge	O
of	O
the	O
assembly	B-Language
language	I-Language
is	O
not	O
required	O
to	O
use	O
Cosmos	B-Operating_System
.	O
</s>
<s>
A	O
key	O
feature	O
of	O
Cosmos	B-Operating_System
,	O
which	O
separates	O
it	O
from	O
other	O
operating	B-General_Concept
systems	I-General_Concept
of	O
its	O
type	O
,	O
is	O
its	O
tight	O
integration	O
with	O
Microsoft	B-Application
Visual	I-Application
Studio	I-Application
.	O
</s>
<s>
Code	O
can	O
be	O
written	O
,	O
compiled	B-Language
,	O
debugged	O
,	O
and	O
run	O
entirely	O
through	O
Visual	B-Application
Studio	I-Application
,	O
with	O
only	O
a	O
few	O
key	O
presses	O
.	O
</s>
<s>
Cosmos	B-Operating_System
no	O
longer	O
supports	O
Visual	B-Application
Studio	I-Application
2015	O
,	O
Visual	B-Application
Studio	I-Application
2017	O
,	O
or	O
Visual	B-Application
Studio	I-Application
2019	O
.	O
</s>
<s>
Now	O
it	O
only	O
supports	O
Visual	B-Application
Studio	I-Application
2022	O
.	O
</s>
<s>
Cosmos	B-Operating_System
can	O
be	O
seamlessly	O
debugged	O
through	O
Visual	B-Application
Studio	I-Application
when	O
running	O
over	O
PXE	O
or	O
in	O
a	O
virtual	B-Architecture
machine	I-Architecture
.	O
</s>
<s>
When	O
running	O
in	O
VMWare	B-Operating_System
,	O
Cosmos	B-Operating_System
supports	O
stepping	O
and	O
breakpoints	O
,	O
even	O
while	O
an	O
operating	B-General_Concept
system	I-General_Concept
is	O
running	O
.	O
</s>
<s>
Cosmos	B-Operating_System
uses	O
virtualisation	O
to	O
help	O
speed	O
development	O
by	O
allowing	O
developers	O
to	O
test	O
their	O
operating	B-General_Concept
systems	I-General_Concept
without	O
having	O
to	O
restart	O
their	O
computers	O
as	O
often	O
.	O
</s>
<s>
By	O
default	O
,	O
VMware	B-Operating_System
Player	I-Operating_System
is	O
used	O
,	O
due	O
to	O
its	O
ease	O
of	O
use	O
in	O
terms	O
of	O
integration	O
with	O
the	O
project	O
.	O
</s>
<s>
Other	O
virtualisation	O
environments	O
are	O
supported	O
as	O
well	O
,	O
such	O
as	O
Bochs	B-Language
and	O
Hyper-V	O
.	O
An	O
ISO	B-General_Concept
disk	I-General_Concept
image	I-General_Concept
may	O
also	O
be	O
generated	O
that	O
can	O
be	O
burned	O
to	O
a	O
USB	B-Protocol
flash	O
drive	O
,	O
CD-ROM	B-Device
,	O
or	O
similar	O
media	O
.	O
</s>
<s>
PXE	O
booting	B-Operating_System
is	O
also	O
supported	O
,	O
allowing	O
for	O
remote	O
machines	O
to	O
run	O
Cosmos	B-Operating_System
over	O
a	O
network	O
connection	O
.	O
</s>
<s>
To	O
compile	B-Language
.NET	B-Application
CIL	O
into	O
assembly	B-Language
language	I-Language
,	O
Cosmos	B-Operating_System
developers	O
created	O
an	O
ahead-of-time	B-Application
compiler	I-Application
named	O
IL2CPU	B-Language
,	O
designed	O
to	O
parse	O
CIL	O
and	O
output	O
x86	B-Operating_System
opcodes	B-Language
.	O
</s>
<s>
(	O
IL	O
To	O
CPU	O
)	O
is	O
an	O
AOT	B-Application
compiler	I-Application
that	O
is	O
written	O
using	O
a	O
Common	O
Intermediate	O
Language	O
compliant	O
language	O
(	O
C#	B-Application
)	O
.	O
</s>
<s>
It	O
translates	O
Common	O
Intermediate	O
Language	O
to	O
machine	B-Language
code	I-Language
.	O
</s>
<s>
X#	O
is	O
a	O
low-level	O
programming	O
language	O
developed	O
for	O
the	O
x86	B-Operating_System
processor	O
architecture	O
as	O
a	O
part	O
of	O
Cosmos	B-Operating_System
operating	B-General_Concept
system	I-General_Concept
to	O
make	O
operating	B-General_Concept
system	I-General_Concept
development	O
easier	O
.	O
</s>
<s>
X#	O
is	O
designed	O
to	O
bring	O
some	O
of	O
C-like	B-Language
language	I-Language
syntax	O
to	O
assembly	B-Language
language	I-Language
.	O
</s>
<s>
In	O
the	O
beginning	O
,	O
X#	O
was	O
an	O
aid	O
for	O
debugging	O
services	O
of	O
Cosmos	B-Operating_System
.	O
</s>
<s>
The	O
X#	O
compiler	B-Language
is	O
an	O
open	B-Application
source	I-Application
command-line	B-Application
interface	I-Application
(	O
console	O
)	O
program	O
with	O
an	O
atypical	O
architecture	O
.	O
</s>
<s>
Finally	O
,	O
matched	O
X#	O
code	O
patterns	O
are	O
translated	O
to	O
intel	O
syntax	O
x86	B-Operating_System
assembly	O
,	O
usually	O
for	O
the	O
YASM	O
assembler	B-Language
.	O
</s>
<s>
In	O
first	O
versions	O
,	O
X#	O
operation	O
was	O
mostly	O
1:1	O
with	O
assembly	B-Language
code	I-Language
,	O
but	O
has	O
n't	O
been	O
,	O
which	O
is	O
the	O
reason	O
why	O
the	O
X#	O
compiler	B-Language
was	O
written	O
.	O
</s>
<s>
Despite	O
being	O
similar	O
to	O
C	B-Language
,	O
X#	O
syntax	O
differs	O
and	O
is	O
stricter	O
.	O
</s>
<s>
X#	O
supports	O
only	O
one	O
kind	O
of	O
comment	O
,	O
the	O
C++	B-Language
-style	O
single	O
line	O
comment	O
,	O
started	O
with	O
a	O
double	O
forward	O
slash	O
-	O
//	O
.	O
</s>
<s>
Defining	O
a	O
numeric	O
constant	O
is	O
similar	O
to	O
C++	B-Language
;	O
for	O
example	O
:	O
.	O
</s>
<s>
X#	O
strings	O
are	O
null	B-Data_Structure
terminated	I-Data_Structure
.	O
</s>
<s>
Labels	O
in	O
X#	O
are	O
mostly	O
equivalent	O
to	O
labels	O
in	O
other	O
assembly	B-Language
languages	I-Language
.	O
</s>
<s>
Unlike	O
C	B-Language
,	O
X#	O
does	O
not	O
support	O
any	O
formal	O
parameter	O
declaration	O
in	O
the	O
header	O
of	O
the	O
functions	O
,	O
so	O
the	O
conventional	O
parentheses	O
after	O
the	O
function	O
name	O
are	O
omitted	O
.	O
</s>
<s>
Because	O
line-fixed	O
patterns	O
are	O
specified	O
in	O
syntax	O
implemented	O
in	O
code	O
parser	O
,	O
the	O
opening	O
curly	O
bracket	O
ca	O
n't	O
be	O
placed	O
on	O
the	O
next	O
line	O
,	O
unlike	O
in	O
many	O
other	O
C-style	O
languages	O
.	O
</s>
<s>
Because	O
X#	O
is	O
a	O
low-level	O
language	O
,	O
there	O
are	O
no	O
stack	B-Application
frames	O
inserted	O
,	O
so	O
by	O
default	O
,	O
there	O
should	O
be	O
the	O
return	O
EIP	O
address	O
on	O
the	O
top	O
of	O
the	O
stack	B-Application
.	O
</s>
<s>
These	O
arguments	O
are	O
pushed	O
onto	O
the	O
stack	B-Application
in	O
reverse	O
order	O
.	O
</s>
<s>
Note	O
that	O
the	O
stack	B-Application
on	O
x86	B-Operating_System
platforms	O
cannot	O
push	O
or	O
pop	O
one-byte	O
registers	O
.	O
</s>
<s>
The	O
return	O
keyword	O
returns	O
execution	O
to	O
the	O
return	O
EIP	O
address	O
saved	O
in	O
the	O
stack	B-Application
.	O
</s>
<s>
X#	O
can	O
work	O
with	O
three	O
low-level	O
data	O
structures	O
:	O
the	O
registers	O
,	O
the	O
stack	B-Application
and	O
the	O
memory	B-General_Concept
,	O
on	O
different	O
ports	O
.	O
</s>
<s>
Register	O
shifting	O
and	O
rolling	O
is	O
similar	O
to	O
C	B-Language
.	O
</s>
<s>
Stack	B-Application
manipulation	O
in	O
X#	O
is	O
performed	O
using	O
+	O
and	O
-	O
prefixes	O
,	O
where	O
+	O
pushes	O
a	O
register	O
,	O
value	O
,	O
constant	O
or	O
all	O
registers	O
onto	O
the	O
stack	B-Application
and	O
-	O
pops	O
a	O
value	O
to	O
some	O
register	O
.	O
</s>
<s>
All	O
constants	O
are	O
pushed	O
on	O
stack	B-Application
as	O
double	O
words	O
,	O
unless	O
stated	O
otherwise	O
(	O
pushing	O
single	O
bytes	O
is	O
not	O
supported	O
)	O
.	O
</s>
<s>
Variables	O
are	O
defined	O
within	O
namespaces	O
(	O
as	O
there	O
are	O
no	O
stack	B-Application
frames	O
,	O
local	O
variables	O
are	O
n't	O
supported	O
)	O
using	O
the	O
var	O
keyword	O
.	O
</s>
<s>
An	O
operating	B-General_Concept
system	I-General_Concept
built	O
with	O
Cosmos	B-Operating_System
is	O
developed	O
in	O
a	O
similar	O
fashion	O
to	O
any	O
.NET	B-Application
C#	B-Application
console	O
program	O
.	O
</s>
<s>
Additional	O
references	O
are	O
made	O
in	O
the	O
start	O
of	O
the	O
program	O
which	O
give	O
access	O
to	O
the	O
Cosmos	B-Operating_System
libraries	B-Library
.	O
</s>
<s>
The	O
Cosmos	B-Operating_System
User	O
Kit	O
is	O
a	O
part	O
of	O
Cosmos	B-Operating_System
designed	O
to	O
make	O
Cosmos	B-Operating_System
easier	O
to	O
use	O
for	O
developers	O
using	O
Microsoft	B-Application
Visual	I-Application
Studio	I-Application
.	O
</s>
<s>
When	O
installed	O
,	O
the	O
user	O
kit	O
adds	O
a	O
new	O
project	O
type	O
to	O
Visual	B-Application
Studio	I-Application
,	O
called	O
a	O
Cosmos	B-Operating_System
Project	O
.	O
</s>
<s>
This	O
is	O
a	O
modified	O
version	O
of	O
a	O
console	O
application	O
,	O
with	O
the	O
Cosmos	B-Operating_System
compiler	B-Language
and	O
bootup	B-Operating_System
stub	O
code	O
already	O
added	O
.	O
</s>
<s>
Once	O
the	O
code	O
is	O
complete	O
,	O
it	O
may	O
be	O
compiled	B-Language
using	O
Roslyn	O
,	O
the	O
.NET	B-Application
compiler	B-Language
,	O
either	O
via	O
Microsoft	B-Application
Visual	I-Application
Studio	I-Application
or	O
the	O
.NET	B-Application
command-line	B-Application
tools	I-Application
(	O
dotnet	B-Application
)	O
.	O
</s>
<s>
This	O
converts	O
the	O
application	O
from	O
the	O
original	O
source	O
code	O
(	O
C#	B-Application
or	O
otherwise	O
)	O
into	O
Common	O
Intermediate	O
Language	O
(	O
CIL	O
)	O
,	O
the	O
native	O
intermediate	O
language	O
of	O
.NET	B-Application
.	O
</s>
<s>
The	O
build	O
process	O
then	O
invokes	O
the	O
IL2CPU	B-Language
compiler	B-Language
which	O
systematically	O
scans	O
through	O
all	O
of	O
the	O
applications	O
CIL	O
code	O
(	O
excluding	O
the	O
Cosmos	B-Operating_System
compiler	B-Language
code	O
)	O
,	O
converting	O
it	O
into	O
assembly	B-Language
language	I-Language
for	O
the	O
selected	O
processor	O
architecture	O
.	O
</s>
<s>
,	O
only	O
the	O
x86	B-Operating_System
architecture	I-Operating_System
is	O
supported	O
.	O
</s>
<s>
Next	O
,	O
Cosmos	B-Operating_System
invokes	O
the	O
selected	O
assembler	B-Language
to	O
convert	O
this	O
assembly	B-Language
language	I-Language
code	O
into	O
native	O
central	B-General_Concept
processing	I-General_Concept
unit	I-General_Concept
(	O
CPU	O
)	O
opcode	B-Language
.	O
</s>
<s>
Finally	O
,	O
the	O
desired	O
output	O
option	O
is	O
activated	O
,	O
be	O
this	O
starting	O
a	O
virtual	B-Architecture
machine	I-Architecture
,	O
starting	O
a	O
PXE	O
engine	O
,	O
or	O
producing	O
an	O
ISO	B-General_Concept
disk	I-General_Concept
image	I-General_Concept
file	O
.	O
</s>
<s>
Cosmos	B-Operating_System
offers	O
several	O
options	O
as	O
to	O
how	O
to	O
deploy	O
the	O
resulting	O
OS	O
and	O
how	O
to	O
debug	B-Device
the	O
output	O
.	O
</s>
<s>
Cosmos	B-Operating_System
allows	O
users	O
to	O
boot	B-Operating_System
the	O
operating	B-General_Concept
system	I-General_Concept
in	O
an	O
emulated	O
environment	O
using	O
a	O
virtual	B-Architecture
machine	I-Architecture
.	O
</s>
<s>
This	O
lets	O
developers	O
test	O
the	O
system	O
on	O
their	O
own	O
computer	O
without	O
having	O
to	O
reboot	O
,	O
giving	O
the	O
advantages	O
of	O
not	O
requiring	O
extra	O
hardware	O
or	O
that	O
developers	O
exit	O
their	O
integrated	B-Application
development	I-Application
environment	I-Application
(	O
IDE	O
)	O
.	O
</s>
<s>
VMware	B-Operating_System
is	O
the	O
primary	O
virtualisation	O
method	O
,	O
however	O
others	O
are	O
supported	O
such	O
as	O
QEMU	B-Application
and	O
Hyper-V	O
.	O
</s>
<s>
This	O
option	O
writes	O
the	O
operating	B-General_Concept
system	I-General_Concept
to	O
a	O
disk	B-Application
image	I-Application
(	O
ISO	B-General_Concept
image	I-General_Concept
)	O
file	O
,	O
which	O
can	O
be	O
loaded	O
into	O
some	O
emulators	O
(	O
such	O
as	O
Bochs	B-Language
,	O
QEMU	B-Application
or	O
more	O
commonly	O
VMware	B-Operating_System
)	O
or	O
written	O
to	O
a	O
USB	B-Protocol
flash	O
drive	O
and	O
booted	O
on	O
physical	O
hardware	O
.	O
</s>
<s>
This	O
option	O
allows	O
the	O
operating	B-General_Concept
system	I-General_Concept
to	O
boot	B-Operating_System
on	O
physical	O
hardware	O
.	O
</s>
<s>
The	O
data	O
is	O
sent	O
via	O
a	O
local	B-General_Concept
area	I-General_Concept
network	I-General_Concept
(	O
LAN	B-General_Concept
)	O
to	O
the	O
client	B-Protocol
machine	I-Protocol
.	O
</s>
<s>
This	O
requires	O
two	O
computers	O
:	O
one	O
as	O
the	O
client	B-Protocol
machine	I-Protocol
(	O
on	O
which	O
the	O
OS	O
is	O
booted	O
)	O
and	O
one	O
as	O
the	O
server	O
(	O
usually	O
the	O
development	O
machine	O
)	O
.	O
</s>
<s>
It	O
also	O
requires	O
a	O
network	O
connecting	O
the	O
two	O
computers	O
,	O
a	O
client	B-Protocol
machine	I-Protocol
with	O
a	O
network	B-Protocol
card	I-Protocol
,	O
and	O
a	O
Basic	B-Operating_System
Input/Output	I-Operating_System
System	I-Operating_System
(	O
BIOS	B-Operating_System
)	O
that	O
can	O
PXE	O
boot	B-Operating_System
.	O
</s>
