128,7 → 128,7 |
} |
|
|
|
// Clean IOPL(12,13) and NT(14) flags in EFLAGS register |
static void clean_IOPL_NT_flags(void) |
{ |
asm |
144,9 → 144,24 |
); |
} |
|
// Clean AM(18) flag in CR0 register |
static void clean_AM_flag(void) |
{ |
asm |
( |
"mov %%cr0,%%eax;" |
"and $0xFFFBFFFF,%%eax;" |
"mov %%eax,%%cr0;" |
: |
: |
:"%eax" |
); |
} |
|
|
|
|
|
void pm_init(void) |
{ |
struct descriptor *gdt_p = (struct descriptor *) PA2KA(gdtr.base); |
185,5 → 200,6 |
*/ |
__asm__("ltr %0" : : "r" ((__u16) selector(TSS_DES))); |
|
clean_IOPL_NT_flags(); |
clean_IOPL_NT_flags(); //Disable I/O on nonprivileged levels |
clean_AM_flag(); //Disable alignment check |
} |