Changeset add04f7 in mainline for kernel/arch/ia32/src/cpu/cpu.c


Ignore:
Timestamp:
2009-03-03T15:20:49Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f24d300
Parents:
deca67b
Message:

better inline assembler readability using the new symbolic syntax

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/cpu/cpu.c

    rdeca67b radd04f7  
    4949 * Contains only non-MP-Specification specific SMP code.
    5050 */
    51 #define AMD_CPUID_EBX   0x68747541
    52 #define AMD_CPUID_ECX   0x444d4163
    53 #define AMD_CPUID_EDX   0x69746e65
     51#define AMD_CPUID_EBX  0x68747541
     52#define AMD_CPUID_ECX  0x444d4163
     53#define AMD_CPUID_EDX  0x69746e65
    5454
    55 #define INTEL_CPUID_EBX 0x756e6547
    56 #define INTEL_CPUID_ECX 0x6c65746e
    57 #define INTEL_CPUID_EDX 0x49656e69
     55#define INTEL_CPUID_EBX  0x756e6547
     56#define INTEL_CPUID_ECX  0x6c65746e
     57#define INTEL_CPUID_EDX  0x49656e69
    5858
    5959
    6060enum vendor {
    61         VendorUnknown=0,
     61        VendorUnknown = 0,
    6262        VendorAMD,
    6363        VendorIntel
     
    7373{
    7474        asm volatile (
    75                 "mov %%cr0,%%eax;"
    76                 "or $8,%%eax;"
    77                 "mov %%eax,%%cr0;"
    78                 :
    79                 :
    80                 : "%eax"
     75                "mov %%cr0, %%eax\n"
     76                "or $8, %%eax\n"
     77                "mov %%eax, %%cr0\n"
     78                ::: "%eax"
    8179        );
    8280}
     
    8583{
    8684        asm volatile (
    87                 "mov %%cr0,%%eax;"
    88                 "and $0xffFFffF7,%%eax;"
    89                 "mov %%eax,%%cr0;"
    90                 :
    91                 :
    92                 : "%eax"
    93         );     
     85                "mov %%cr0, %%eax\n"
     86                "and $0xffFFffF7, %%eax\n"
     87                "mov %%eax,%%cr0\n"
     88                ::: "%eax"
     89        );
    9490}
    9591
     
    10399        CPU->arch.tss = tss_p;
    104100        CPU->arch.tss->iomap_base = &CPU->arch.tss->iomap[0] - ((uint8_t *) CPU->arch.tss);
    105 
     101       
    106102        CPU->fpu_owner = NULL;
    107 
     103       
    108104        cpuid(1, &info);
    109 
     105       
    110106        fi.word = info.cpuid_edx;
    111107        efi.word = info.cpuid_ecx;
     
    114110                fpu_fxsr();
    115111        else
    116                 fpu_fsr();     
     112                fpu_fsr();
    117113       
    118114        if (fi.bits.sse) {
    119115                asm volatile (
    120                         "mov %%cr4,%0\n"
    121                         "or %1,%0\n"
    122                         "mov %0,%%cr4\n"
    123                         : "+r" (help)
    124                         : "i" (CR4_OSFXSR_MASK|(1<<10))
     116                        "mov %%cr4, %[help]\n"
     117                        "or %[mask], %[help]\n"
     118                        "mov %[help], %%cr4\n"
     119                        : [help] "+r" (help)
     120                        : [mask] "i" (CR4_OSFXSR_MASK | (1 << 10))
    125121                );
    126122        }
Note: See TracChangeset for help on using the changeset viewer.