-
Notifications
You must be signed in to change notification settings - Fork 555
Rings
The next generation of the Cosmos compiler and architecture will be using a new ring structure, and to facilitate the move, the rings have been disabled. If using the devkit or the userkit it is required for you to remove any Ring references in AssemblyInfo.cs (if your project uses it.)
This will make it easier for your projects to work with Gen3 for when it is released.
Rings are Cosmos's basic "security" feature. They restrict the actions of code so that less can go wrong. A code in a specific ring can only reference and thus use code in the adjacent rings. For example, the Kernel of your operating system (in ring 3) can only talk to the system ring. In cosmos there are 4 rings:
-
Core
-
Hardware
-
System
-
User
User <-> System <-> Hardware <-> Core
It is not possible to run Hardware code in the kernel because it is in ring USER. This means that you can't access the display code in your kernel. To get around this one must create some code in ring 2 (SYSTEM) which allows you to interface between the two. To do this follow this guide:
To do this right click on your solution on the right hand side and click Add->New Project. Then add a new COSMOS C# OS, call it Hardware. Now you need to both delete the NEW Cosmos boot project (called HardwareBoot) and the Kernel.cs file found within the main Hardware project.
The next job is to allow this project to talk to the screen. To do this right click on the references section of the Hardware project->add references. Now search for cosmos and add all the references (by selecting them with shift-click then pressing ENTER)
Now go into the AssemblyInfo.cs of the Hardware project file and add the lines bellow:
using Cosmos.Common;
[assembly: Ring(Ring.HAL)]
Well done, you now have a project running in Ring 2.