Changeset e7b7be3f in mainline for kernel/arch/ia32/include


Ignore:
Timestamp:
2007-01-22T13:10:08Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0f3fc9b
Parents:
62c63fc
Message:

asm volatile → asm volatile

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

Legend:

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

    r62c63fc re7b7be3f  
    5858 * Halt the current CPU until interrupt event.
    5959 */
    60 static inline void cpu_halt(void) { __asm__("hlt\n"); };
    61 static inline void cpu_sleep(void) { __asm__("hlt\n"); };
     60static inline void cpu_halt(void)
     61{
     62        asm("hlt\n");
     63};
     64
     65static inline void cpu_sleep(void)
     66{
     67        asm("hlt\n");
     68};
    6269
    6370#define GEN_READ_REG(reg) static inline unative_t read_ ##reg (void) \
    6471    { \
    6572        unative_t res; \
    66         __asm__ volatile ("movl %%" #reg ", %0" : "=r" (res) ); \
     73        asm volatile ("movl %%" #reg ", %0" : "=r" (res) ); \
    6774        return res; \
    6875    }
     
    7077#define GEN_WRITE_REG(reg) static inline void write_ ##reg (unative_t regn) \
    7178    { \
    72         __asm__ volatile ("movl %0, %%" #reg : : "r" (regn)); \
     79        asm volatile ("movl %0, %%" #reg : : "r" (regn)); \
    7380    }
    7481
     
    99106 * @param val Value to write
    100107 */
    101 static inline void outb(uint16_t port, uint8_t val) { __asm__ volatile ("outb %b0, %w1\n" : : "a" (val), "d" (port) ); }
     108static inline void outb(uint16_t port, uint8_t val)
     109{
     110        asm volatile ("outb %b0, %w1\n" : : "a" (val), "d" (port) );
     111}
    102112
    103113/** Word to port
     
    108118 * @param val Value to write
    109119 */
    110 static inline void outw(uint16_t port, uint16_t val) { __asm__ volatile ("outw %w0, %w1\n" : : "a" (val), "d" (port) ); }
     120static inline void outw(uint16_t port, uint16_t val)
     121{
     122        asm volatile ("outw %w0, %w1\n" : : "a" (val), "d" (port) );
     123}
    111124
    112125/** Double word to port
     
    117130 * @param val Value to write
    118131 */
    119 static inline void outl(uint16_t port, uint32_t val) { __asm__ volatile ("outl %l0, %w1\n" : : "a" (val), "d" (port) ); }
     132static inline void outl(uint16_t port, uint32_t val)
     133{
     134        asm volatile ("outl %l0, %w1\n" : : "a" (val), "d" (port) );
     135}
    120136
    121137/** Byte from port
     
    126142 * @return Value read
    127143 */
    128 static inline uint8_t inb(uint16_t port) { uint8_t val; __asm__ volatile ("inb %w1, %b0 \n" : "=a" (val) : "d" (port) ); return val; }
     144static inline uint8_t inb(uint16_t port)
     145{
     146        uint8_t val;
     147       
     148        asm volatile ("inb %w1, %b0 \n" : "=a" (val) : "d" (port) );
     149        return val;
     150}
    129151
    130152/** Word from port
     
    135157 * @return Value read
    136158 */
    137 static inline uint16_t inw(uint16_t port) { uint16_t val; __asm__ volatile ("inw %w1, %w0 \n" : "=a" (val) : "d" (port) ); return val; }
     159static inline uint16_t inw(uint16_t port)
     160{
     161        uint16_t val;
     162       
     163        asm volatile ("inw %w1, %w0 \n" : "=a" (val) : "d" (port) );
     164        return val;
     165}
    138166
    139167/** Double word from port
     
    144172 * @return Value read
    145173 */
    146 static inline uint32_t inl(uint16_t port) { uint32_t val; __asm__ volatile ("inl %w1, %l0 \n" : "=a" (val) : "d" (port) ); return val; }
     174static inline uint32_t inl(uint16_t port)
     175{
     176        uint32_t val;
     177       
     178        asm volatile ("inl %w1, %l0 \n" : "=a" (val) : "d" (port) );
     179        return val;
     180}
    147181
    148182/** Enable interrupts.
     
    156190{
    157191        ipl_t v;
    158         __asm__ volatile (
     192        asm volatile (
    159193                "pushf\n\t"
    160194                "popl %0\n\t"
     
    175209{
    176210        ipl_t v;
    177         __asm__ volatile (
     211        asm volatile (
    178212                "pushf\n\t"
    179213                "popl %0\n\t"
     
    192226static inline void interrupts_restore(ipl_t ipl)
    193227{
    194         __asm__ volatile (
     228        asm volatile (
    195229                "pushl %0\n\t"
    196230                "popf\n"
     
    206240{
    207241        ipl_t v;
    208         __asm__ volatile (
     242        asm volatile (
    209243                "pushf\n\t"
    210244                "popl %0\n"
     
    224258        uintptr_t v;
    225259       
    226         __asm__ volatile ("andl %%esp, %0\n" : "=r" (v) : "0" (~(STACK_SIZE-1)));
     260        asm volatile ("andl %%esp, %0\n" : "=r" (v) : "0" (~(STACK_SIZE-1)));
    227261       
    228262        return v;
     
    234268        uintptr_t *ip;
    235269
    236         __asm__ volatile (
     270        asm volatile (
    237271                "mov %%eip, %0"
    238272                : "=r" (ip)
     
    247281static inline void invlpg(uintptr_t addr)
    248282{
    249         __asm__ volatile ("invlpg %0\n" :: "m" (*(unative_t *)addr));
     283        asm volatile ("invlpg %0\n" :: "m" (*(unative_t *)addr));
    250284}
    251285
     
    256290static inline void gdtr_load(ptr_16_32_t *gdtr_reg)
    257291{
    258         __asm__ volatile ("lgdtl %0\n" : : "m" (*gdtr_reg));
     292        asm volatile ("lgdtl %0\n" : : "m" (*gdtr_reg));
    259293}
    260294
     
    265299static inline void gdtr_store(ptr_16_32_t *gdtr_reg)
    266300{
    267         __asm__ volatile ("sgdtl %0\n" : : "m" (*gdtr_reg));
     301        asm volatile ("sgdtl %0\n" : : "m" (*gdtr_reg));
    268302}
    269303
     
    274308static inline void idtr_load(ptr_16_32_t *idtr_reg)
    275309{
    276         __asm__ volatile ("lidtl %0\n" : : "m" (*idtr_reg));
     310        asm volatile ("lidtl %0\n" : : "m" (*idtr_reg));
    277311}
    278312
     
    283317static inline void tr_load(uint16_t sel)
    284318{
    285         __asm__ volatile ("ltr %0" : : "r" (sel));
     319        asm volatile ("ltr %0" : : "r" (sel));
    286320}
    287321
  • kernel/arch/ia32/include/atomic.h

    r62c63fc re7b7be3f  
    4343static inline void atomic_inc(atomic_t *val) {
    4444#ifdef CONFIG_SMP
    45         __asm__ volatile ("lock incl %0\n" : "=m" (val->count));
     45        asm volatile ("lock incl %0\n" : "=m" (val->count));
    4646#else
    47         __asm__ volatile ("incl %0\n" : "=m" (val->count));
     47        asm volatile ("incl %0\n" : "=m" (val->count));
    4848#endif /* CONFIG_SMP */
    4949}
     
    5151static inline void atomic_dec(atomic_t *val) {
    5252#ifdef CONFIG_SMP
    53         __asm__ volatile ("lock decl %0\n" : "=m" (val->count));
     53        asm volatile ("lock decl %0\n" : "=m" (val->count));
    5454#else
    55         __asm__ volatile ("decl %0\n" : "=m" (val->count));
     55        asm volatile ("decl %0\n" : "=m" (val->count));
    5656#endif /* CONFIG_SMP */
    5757}
     
    6161        long r = 1;
    6262
    63         __asm__ volatile (
     63        asm volatile (
    6464                "lock xaddl %1, %0\n"
    6565                : "=m" (val->count), "+r" (r)
     
    7373        long r = -1;
    7474       
    75         __asm__ volatile (
     75        asm volatile (
    7676                "lock xaddl %1, %0\n"
    7777                : "=m" (val->count), "+r"(r)
     
    8787        uint32_t v;
    8888       
    89         __asm__ volatile (
     89        asm volatile (
    9090                "movl $1, %0\n"
    9191                "xchgl %0, %1\n"
     
    102102
    103103        preemption_disable();
    104         __asm__ volatile (
     104        asm volatile (
    105105                "0:;"
    106106#ifdef CONFIG_HT
  • kernel/arch/ia32/include/barrier.h

    r62c63fc re7b7be3f  
    4747 */
    4848
    49 #define CS_ENTER_BARRIER()      __asm__ volatile ("" ::: "memory")
    50 #define CS_LEAVE_BARRIER()      __asm__ volatile ("" ::: "memory")
     49#define CS_ENTER_BARRIER()      asm volatile ("" ::: "memory")
     50#define CS_LEAVE_BARRIER()      asm volatile ("" ::: "memory")
    5151
    5252static inline void cpuid_serialization(void)
    5353{
    54         __asm__ volatile (
     54        asm volatile (
    5555                "xorl %%eax, %%eax\n"
    5656                "cpuid\n"
     
    6060
    6161#ifdef CONFIG_FENCES_P4
    62 #       define memory_barrier()         __asm__ volatile ("mfence\n" ::: "memory")
    63 #       define read_barrier()           __asm__ volatile ("lfence\n" ::: "memory")
     62#       define memory_barrier()         asm volatile ("mfence\n" ::: "memory")
     63#       define read_barrier()           asm volatile ("lfence\n" ::: "memory")
    6464#       ifdef CONFIG_WEAK_MEMORY
    65 #               define write_barrier()  __asm__ volatile ("sfence\n" ::: "memory")
     65#               define write_barrier()  asm volatile ("sfence\n" ::: "memory")
    6666#       else
    67 #               define write_barrier()  __asm__ volatile( "" ::: "memory");
     67#               define write_barrier()  asm volatile( "" ::: "memory");
    6868#       endif
    6969#elif CONFIG_FENCES_P3
     
    7171#       define read_barrier()           cpuid_serialization()
    7272#       ifdef CONFIG_WEAK_MEMORY
    73 #               define write_barrier()  __asm__ volatile ("sfence\n" ::: "memory")
     73#               define write_barrier()  asm volatile ("sfence\n" ::: "memory")
    7474#       else
    75 #               define write_barrier()  __asm__ volatile( "" ::: "memory");
     75#               define write_barrier()  asm volatile( "" ::: "memory");
    7676#       endif
    7777#else
     
    8181#               define write_barrier()  cpuid_serialization()
    8282#       else
    83 #               define write_barrier()  __asm__ volatile( "" ::: "memory");
     83#               define write_barrier()  asm volatile( "" ::: "memory");
    8484#       endif
    8585#endif
  • kernel/arch/ia32/include/cpuid.h

    r62c63fc re7b7be3f  
    7777        uint32_t val, ret;
    7878       
    79         __asm__ volatile (
     79        asm volatile (
    8080                "pushf\n"               /* read flags */
    8181                "popl %0\n"
     
    100100static inline void cpuid(uint32_t cmd, cpu_info_t *info)
    101101{
    102         __asm__ volatile (
     102        asm volatile (
    103103                "movl %4, %%eax\n"
    104104                "cpuid\n"
  • kernel/arch/ia32/include/memstr.h

    r62c63fc re7b7be3f  
    5252        unative_t d0, d1, d2;
    5353
    54         __asm__ __volatile__(
     54        asm volatile(
    5555                /* copy all full dwords */
    5656                "rep movsl\n\t"
     
    8989        int ret;
    9090       
    91         __asm__ (
     91        asm (
    9292                "repe cmpsb\n\t"
    9393                "je 1f\n\t"
     
    115115        uint32_t d0, d1;
    116116       
    117         __asm__ __volatile__ (
     117        asm volatile (
    118118                "rep stosw\n\t"
    119119                : "=&D" (d0), "=&c" (d1), "=a" (x)
     
    137137        uint32_t d0, d1;
    138138       
    139         __asm__ __volatile__ (
     139        asm volatile (
    140140                "rep stosb\n\t"
    141141                : "=&D" (d0), "=&c" (d1), "=a" (x)
Note: See TracChangeset for help on using the changeset viewer.