VirtualBox

Changeset 72499 in vbox for trunk/src/VBox/Devices/PC/BIOS


Ignore:
Timestamp:
Jun 11, 2018 10:24:01 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
122984
Message:

BIOS: Fixed APIC disable logic, it was backwards before. No one probably noticed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/post.c

    r72416 r72499  
    125125#define APIC_BASE_MSR       0x1B
    126126#define APICBASE_X2APIC     0x400   /* bit 10 */
    127 #define APICBASE_DISABLE    0x800   /* bit 11 */
     127#define APICBASE_ENABLE     0x800   /* bit 11 */
    128128
    129129/*
     
    145145{
    146146    uint64_t    base_msr;
    147     uint16_t    mask;
     147    uint16_t    mask_set;
     148    uint16_t    mask_clr;
    148149    uint8_t     apic_mode;
    149150    uint32_t    cpu_id[4];
     
    164165    apic_mode = inb_cmos(0x78);
    165166
     167    mask_set = mask_clr = 0;
    166168    if (apic_mode == APICMODE_X2APIC)
    167         mask = APICBASE_X2APIC;
     169        mask_set = APICBASE_X2APIC;
    168170    else if (apic_mode == APICMODE_DISABLED)
    169         mask = APICBASE_DISABLE; /** @todo r=bird: Shouldn't we clear bit 11 when disabling the APIC? */
     171        mask_clr = APICBASE_ENABLE;
    170172    else
    171         mask = 0;   /* Any other setting leaves things alone. */
     173        ;   /* Any other setting leaves things alone. */
    172174
    173     if (mask) {
     175    if (mask_set || mask_clr) {
    174176        base_msr = msr_read(APIC_BASE_MSR);
    175         base_msr |= mask;
     177        base_msr &= ~(uint64_t)mask_clr;
     178        base_msr |= mask_set;
    176179        msr_write(base_msr, APIC_BASE_MSR);
    177180    }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette