Ignore:
Timestamp:
2016-05-05T13:02:20Z (8 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.