Changeset 811770c in mainline for kernel/arch/amd64/src/asm.S


Ignore:
Timestamp:
2016-05-05T12:06:04Z (9 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
57c2a87
Parents:
0f17bff
Message:

Avoid magic numbers and specialized functions to set/get register bits

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/src/asm.S

    r0f17bff r811770c  
    3333#include <arch/kseg_struct.h>
    3434#include <arch/cpu.h>
     35#include <arch/smp/apic.h>
    3536
    3637.text
     
    9394       
    9495        /* Flip the ID bit */
    95         btcl $21, %edx
     96        xorl $RFLAGS_ID, %edx
    9697       
    9798        /* Store RFLAGS */
     
    102103        /* Get the ID bit again */
    103104        popq %rdx
    104         andl $(1 << 21), %eax
    105         andl $(1 << 21), %edx
     105        andl $RFLAGS_ID, %eax
     106        andl $RFLAGS_ID, %edx
    106107       
    107108        /* 0 if not supported, 1 if supported */
     
    127128FUNCTION_END(cpuid)
    128129
    129 FUNCTION_BEGIN(set_efer_flag)
    130         movl $0xc0000080, %ecx
     130/** Enable local APIC
     131 *
     132 * Enable local APIC in MSR.
     133 *
     134 */
     135FUNCTION_BEGIN(enable_l_apic_in_msr)
     136        movl $AMD_MSR_APIC_BASE, %ecx
    131137        rdmsr
    132         btsl %edi, %eax
     138        orl $(L_APIC_BASE | AMD_APIC_BASE_GE), %eax
    133139        wrmsr
    134140        ret
    135 FUNCTION_END(set_efer_flag)
    136 
    137 FUNCTION_BEGIN(read_efer_flag)
    138         movl $0xc0000080, %ecx
    139         rdmsr
    140         ret
    141 FUNCTION_END(read_efer_flag)
     141FUNCTION_END(enable_l_apic_in_msr)
    142142
    143143/*
     
    541541        ret
    542542FUNCTION_END(early_putchar)
    543 
Note: See TracChangeset for help on using the changeset viewer.