Reputation: 667
I just started developing an operating system using cosmos for visual studio (in c#)
A lot of people said how to shut it down, and I tried every method but this one gives some weird error I simply cannot understand!
this is the code I am using to shutdown the os:
this.stop()
Cosmos.Core.Bootstrap.CPU.halt();
but this is the error I receive when building:
Error occurred while invoking IL2CPU
Exception: System.Exception: Assembly 'CosmosKernel7' is in ring User(3). It references assembly 'Cosmos.Core' which is in ring Core(0), but this is not allowed!
I have no idea what that means....
Can someone help me fix this?
thank you!
Upvotes: 2
Views: 1868
Reputation: 39
I think you should replace all the like this
Cosmos.System.power.shutdown(); //for shutdown
Cosmos.System.Power.Reboot(); //For restart or reboot
Upvotes: 0
Reputation:
The Code for Shutdown in Cosmos's Latest User Kit is - Cosmos.System.Power.ShutDown(); And for Reboot is - Cosmos.System.Power.Reboot();
I found this code when Browsing for Time and Date Function.
Upvotes: 0
Reputation: 125
I think that error is already fixed. Try downloading the latest version of Cosmos from GitHub.
Upvotes: 0
Reputation: 1082
https://github.com/CosmosOS/Cosmos/wiki/Rings:
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 (ring 2). In Cosmos there are 4 rings:
- Core (0)
- Hardware (1)
- System (2)
- User (3)
So you will need, for your OS MyAwesomeOS (which contains the kernel, therefore in ring 3 (User)), to create a class library called for example MyAwesomeOS.System which will be in ring 2 (System) and MyAwesomeOS.Hardware which will be in ring 1 (Hardware), then you'll reference these class libraries from the main project.
Upvotes: 0
Reputation: 59
I am going to leave this here for the sake of future-comers. Cosmos uses the rings system. There's four. You cannot access any ring except the one next to you. Your kernel is in ring 3, the highest one. So, make several class libraries, reference the cosmos stuff including cosmos.common
, and go into AssemblyInfo.cs
and add [assembly: Ring(Ring.WHATEVER)]
.
Upvotes: 1