aboutsummaryrefslogtreecommitdiff
path: root/src/kern/priv.c
blob: 9d64005e2c5e8f18feed2ee1fc2b1c56b9cc624b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "kern/priv.h"

void set_control_register(uint32_t reg)
{
  asm volatile("msr control, %0" : "=r"(reg) :);
}

uint32_t get_control_register()
{
  uint32_t control;
  asm volatile("mrs %0, control" : "=r"(control) :);
  return control;
}

void enter_user_mode()
{
  asm volatile (
      "mov r0, #1\n\t"
      "msr control, r0\n\t"
    );

  // uint32_t creg = get_control_register();
  // set_control_register(creg | 1);
}