Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/amd64.c

    raf9dd1e r811770c  
    6464#endif
    6565
    66 /** Disable I/O on non-privileged levels
    67  *
    68  * Clean IOPL(12,13) and NT(14) flags in EFLAGS register
    69  */
    70 static void clean_IOPL_NT_flags(void)
    71 {
    72         asm volatile (
    73                 "pushfq\n"
    74                 "pop %%rax\n"
    75                 "and $~(0x7000), %%rax\n"
    76                 "pushq %%rax\n"
    77                 "popfq\n"
    78                 ::: "%rax"
    79         );
    80 }
    81 
    82 /** Disable alignment check
    83  *
    84  * Clean AM(18) flag in CR0 register
    85  */
    86 static void clean_AM_flag(void)
    87 {
    88         asm volatile (
    89                 "mov %%cr0, %%rax\n"
    90                 "and $~(0x40000), %%rax\n"
    91                 "mov %%rax, %%cr0\n"
    92                 ::: "%rax"
    93         );
    94 }
    95 
    9666/** Perform amd64-specific initialization before main_bsp() is called.
    9767 *
     
    11686{
    11787        /* Enable no-execute pages */
    118         set_efer_flag(AMD_NXE_FLAG);
     88        write_msr(AMD_MSR_EFER, read_msr(AMD_MSR_EFER) | AMD_NXE);
    11989        /* Enable FPU */
    12090        cpu_setup_fpu();
     
    12393        pm_init();
    12494       
    125         /* Disable I/O on nonprivileged levels
    126          * clear the NT (nested-thread) flag
    127          */
    128         clean_IOPL_NT_flags();
     95        /* Disable I/O on nonprivileged levels, clear the nested-thread flag */
     96        write_rflags(read_rflags() & ~(RFLAGS_IOPL | RFLAGS_NT));
    12997        /* Disable alignment check */
    130         clean_AM_flag();
     98        write_cr0(read_cr0() & ~CR0_AM);
    13199       
    132100        if (config.cpu_active == 1) {
Note: See TracChangeset for help on using the changeset viewer.