Annotation of Gnu-Mach/i386/grub/cpu/io.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  *  GRUB  --  GRand Unified Bootloader
                      3:  *  Copyright (C) 1996,2000,2002,2007  Free Software Foundation, Inc.
                      4:  *
                      5:  *  GRUB is free software: you can redistribute it and/or modify
                      6:  *  it under the terms of the GNU General Public License as published by
                      7:  *  the Free Software Foundation, either version 3 of the License, or
                      8:  *  (at your option) any later version.
                      9:  *
                     10:  *  GRUB is distributed in the hope that it will be useful,
                     11:  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
                     12:  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     13:  *  GNU General Public License for more details.
                     14:  *
                     15:  *  You should have received a copy of the GNU General Public License
                     16:  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
                     17:  */
                     18: 
                     19: /* Based on sys/io.h from GNU libc. */
                     20: 
                     21: #ifndef        GRUB_IO_H
                     22: #define        GRUB_IO_H       1
                     23: 
                     24: typedef unsigned short int grub_port_t;
                     25: 
                     26: static __inline unsigned char
                     27: grub_inb (unsigned short int port)
                     28: {
                     29:   unsigned char _v;
                     30: 
                     31:   __asm__ __volatile__ ("inb %w1,%0":"=a" (_v):"Nd" (port));
                     32:   return _v;
                     33: }
                     34: 
                     35: static __inline unsigned short int
                     36: grub_inw (unsigned short int port)
                     37: {
                     38:   unsigned short _v;
                     39: 
                     40:   __asm__ __volatile__ ("inw %w1,%0":"=a" (_v):"Nd" (port));
                     41:   return _v;
                     42: }
                     43: 
                     44: static __inline unsigned int
                     45: grub_inl (unsigned short int port)
                     46: {
                     47:   unsigned int _v;
                     48: 
                     49:   __asm__ __volatile__ ("inl %w1,%0":"=a" (_v):"Nd" (port));
                     50:   return _v;
                     51: }
                     52: 
                     53: static __inline void
                     54: grub_outb (unsigned char value, unsigned short int port)
                     55: {
                     56:   __asm__ __volatile__ ("outb %b0,%w1": :"a" (value), "Nd" (port));
                     57: }
                     58: 
                     59: static __inline void
                     60: grub_outw (unsigned short int value, unsigned short int port)
                     61: {
                     62:   __asm__ __volatile__ ("outw %w0,%w1": :"a" (value), "Nd" (port));
                     63: 
                     64: }
                     65: 
                     66: static __inline void
                     67: grub_outl (unsigned int value, unsigned short int port)
                     68: {
                     69:   __asm__ __volatile__ ("outl %0,%w1": :"a" (value), "Nd" (port));
                     70: }
                     71: 
                     72: #endif /* _SYS_IO_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.