Skip to content
Snippets Groups Projects
Commit 2978e6b7 authored by iliya.saroukha's avatar iliya.saroukha :first_quarter_moon:
Browse files

debug: trying to print out the CPL value, probably doesn't work though

parent 58e0e324
Branches
No related tags found
No related merge requests found
......@@ -79,6 +79,20 @@ static unsigned char vmxon(unsigned long long pa) {
}
static int my_init(void) {
/*
* https://www.sciencedirect.com/topics/computer-science/current-privilege-level
*/
DEBUG_FMT("Querying CS (lowest 2 bits) for CPL\n");
unsigned long cs, cpl;
__asm__ volatile("mov %%cs, %0" : "=r"(cs));
cpl = cs & 0x3;
DEBUG_FMT("CPL level = %lu\n", cpl);
if (cpl > 0) {
return -1;
}
pr_info("Checking VMX support using CPUID\n");
if (!vmx_support_cpuid()) {
pr_err("VMX isn't supported\n");
......@@ -119,6 +133,9 @@ static int my_init(void) {
unsigned char vmxon_ret = 0;
if ((vmxon_ret = vmxon(vmxon_region.pa) != 0)) {
/*unsigned long vm_err = __rdmsr(0x4400);*/
/*pr_err("VM_ERR val = 0x%lx\n", vm_err);*/
kfree(vmxon_region.va);
__asm__ volatile("vmxoff");
pr_err("`vmxon` failed with return code %d\n", vmxon_ret);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment