Changeset 57c2a87 in mainline for kernel/arch/ia32/include


Ignore:
Timestamp:
2016-05-05T13:02:20Z (10 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a0d9abcd
Parents:
811770c
Message:

Avoid even more magic numbers

Location:
kernel/arch/ia32/include/arch
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/include/arch/cpu.h

    r811770c r57c2a87  
    4141#define EFLAGS_NT       (1 << 14)
    4242#define EFLAGS_RF       (1 << 16)
     43#define EFLAGS_ID       (1 << 21)
    4344
     45#define CR0_PE          (1 << 0)
     46#define CR0_TS          (1 << 3)
    4447#define CR0_AM          (1 << 18)
    4548#define CR0_NW          (1 << 29)
     
    4750#define CR0_PG          (1 << 31)
    4851
    49 #define CR4_OSFXSR_MASK         (1 << 9)
    50 #define CR4_OSXMMEXCPT_MASK     (1 << 10)
     52#define CR4_PSE         (1 << 4)
     53#define CR4_PAE         (1 << 5)
     54#define CR4_OSFXSR      (1 << 9)
     55#define CR4_OSXMMEXCPT  (1 << 10)
    5156
    5257#define IA32_APIC_BASE_GE       (1 << 11)
  • kernel/arch/ia32/include/arch/cpuid.h

    r811770c r57c2a87  
    4444
    4545#include <typedefs.h>
     46#include <arch/cpu.h>
    4647
    4748typedef struct {
     
    8485       
    8586        asm volatile (
    86                 "pushf\n"                    /* read flags */
     87                "pushf\n"                       /* read flags */
    8788                "popl %[ret]\n"
    8889                "movl %[ret], %[val]\n"
    8990               
    90                 "btcl $21, %[val]\n"         /* swap the ID bit */
     91                "xorl %[eflags_id], %[val]\n"   /* swap the ID bit */
    9192               
    92                 "pushl %[val]\n"             /* propagate the change into flags */
     93                "pushl %[val]\n"                /* propagate the change into flags */
    9394                "popf\n"
    9495                "pushf\n"
    9596                "popl %[val]\n"
    9697               
    97                 "andl $(1 << 21), %[ret]\n"  /* interrested only in ID bit */
    98                 "andl $(1 << 21), %[val]\n"
     98                "andl %[eflags_id], %[ret]\n"   /* interrested only in ID bit */
     99                "andl %[eflags_id], %[val]\n"
    99100                "xorl %[val], %[ret]\n"
    100101                : [ret] "=r" (ret), [val] "=r" (val)
     102                : [eflags_id] "i" (EFLAGS_ID)
    101103        );
    102104       
Note: See TracChangeset for help on using the changeset viewer.