Changeset e7b7be3f in mainline for kernel/arch/ia32/include/asm.h


Ignore:
Timestamp:
2007-01-22T13:10:08Z (18 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

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.