Changeset 105a0dc in mainline


Ignore:
Timestamp:
2005-09-18T19:37:14Z (19 years ago)
Author:
Sergey Bondari <bondari@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
650d976
Parents:
e158717
Message:

Get from port functions are now inline

Location:
arch/ia32
Files:
2 edited

Legend:

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

    re158717 r105a0dc  
    3939extern void interrupt_handlers(void);
    4040
    41 extern __u8 inb(int port);
    42 extern __u16 inw(int port);
    43 extern __u32 inl(int port);
    44 
    4541extern void enable_l_apic_in_msr(void);
    4642
     
    9995static inline void outw(__u16 port, __u16 val) { __asm__ volatile ("outw %w0, %w1\n" : : "a" (val), "d" (port) ); }
    10096
    101 
    102 
    10397/** Double word to port
    10498 *
     
    109103 */
    110104static inline void outl(__u16 port, __u32 val) { __asm__ volatile ("outl %l0, %w1\n" : : "a" (val), "d" (port) ); }
     105
     106/** Byte from port
     107 *
     108 * Get byte from port
     109 *
     110 * @param port Port to read from
     111 * @return Value read
     112 */
     113static inline __u8 inb(__u16 port) { __u8 val; __asm__ volatile ("inb %w1, %b0 \n" : "=a" (val) : "d" (port) ); return val; }
     114
     115/** Word from port
     116 *
     117 * Get word from port
     118 *
     119 * @param port Port to read from
     120 * @return Value read
     121 */
     122static inline __u16 inw(__u16 port) { __u16 val; __asm__ volatile ("inw %w1, %w0 \n" : "=a" (val) : "d" (port) ); return val; }
     123
     124/** Double word from port
     125 *
     126 * Get double word from port
     127 *
     128 * @param port Port to read from
     129 * @return Value read
     130 */
     131static inline __u32 inl(__u16 port) { __u32 val; __asm__ volatile ("inl %w1, %l0 \n" : "=a" (val) : "d" (port) ); return val; }
    111132
    112133/** Set priority level low
  • arch/ia32/src/asm.S

    re158717 r105a0dc  
    156156#       handler 192 256
    157157h_end:
    158 
    159 
    160 ## I/O input (byte)
    161 #
    162 # Get a byte from I/O port and store it AL.
    163 #
    164 inb:
    165         xorl %eax,%eax
    166         movl 4(%esp),%edx
    167         inb %dx,%al
    168         ret
    169 
    170 
    171 ## I/O input (word)
    172 #
    173 # Get a word from I/O port and store it AX.
    174 #
    175 inw:
    176         xorl %eax,%eax
    177         movl 4(%esp),%edx
    178         inw %dx,%ax
    179         ret
    180 
    181 
    182 ## I/O input (dword)
    183 #
    184 # Get a dword from I/O port and store it EAX.
    185 #
    186 inl:
    187         xorl %eax,%eax
    188         movl 4(%esp),%edx
    189         inl %dx,%eax
    190         ret
    191158
    192159
Note: See TracChangeset for help on using the changeset viewer.