#include <stdint.h>
#include <stdio.h>
using namespace std;
int main ()
{
uint64_t rcs_registry = 0;
int current_ring;
// Get the current value of cs registry
asm ("mov %%cs, %0":"=r" (rcs_registry));
// Get the last 2 bits of it, that represent the ring
current_ring = (int) (rcs_registry & 3);
printf ("Hello, world. This program is running on ring %d!\n", current_ring);
return 0;
}