Print this page
6648 illumos build should be explicit about C standards

Split Close
Expand all
Collapse all
          --- old/usr/src/grub/grub-0.97/netboot/io.h
          +++ new/usr/src/grub/grub-0.97/netboot/io.h
        1 +#include <sys/ccompile.h>
        2 +
   1    3  #ifndef IO_H
   2    4  #define IO_H
   3    5  
   4      -
   5    6  /* Amount of relocation etherboot is experiencing */
   6    7  extern unsigned long virt_offset;
   7    8  
   8    9  /* Don't require identity mapped physical memory,
   9   10   * osloader.c is the only valid user at the moment.
  10   11   */
  11   12  unsigned long virt_to_phys(volatile const void *virt_addr);
  12   13  void *phys_to_virt(unsigned long phys_addr);
  13   14  
  14   15  /* virt_to_bus converts an addresss inside of etherboot [_start, _end]
↓ open down ↓ 85 lines elided ↑ open up ↑
 100  101   * in which all writes are seen in the program order even
 101  102   * outside the CPU.
 102  103   *
 103  104   * I expect future Intel CPU's to have a weaker ordering,
 104  105   * but I'd also expect them to finally get their act together
 105  106   * and add some real memory barriers if so.
 106  107   *
 107  108   * Some non intel clones support out of order store. wmb() ceases to be a
 108  109   * nop for these.
 109  110   */
 110      - 
      111 +
 111  112  #define mb()    __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory")
 112  113  #define rmb()   mb()
 113  114  #define wmb()   mb();
 114  115  
 115  116  
 116  117  /*
 117  118   * Talk about misusing macros..
 118  119   */
 119  120  
 120  121  #define __OUT1(s,x) \
 121  122  extern void __out##s(unsigned x value, unsigned short port); \
 122      -extern inline void __out##s(unsigned x value, unsigned short port) {
      123 +extern __GNU_INLINE \
      124 +void __out##s(unsigned x value, unsigned short port) {
 123  125  
 124  126  #define __OUT2(s,s1,s2) \
 125  127  __asm__ __volatile__ ("out" #s " %" s1 "0,%" s2 "1"
 126  128  
 127  129  #define __OUT(s,s1,x) \
 128  130  __OUT1(s,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); } \
 129  131  __OUT1(s##c,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); } \
 130  132  __OUT1(s##_p,x) __OUT2(s,s1,"w") : : "a" (value), "d" (port)); SLOW_DOWN_IO; } \
 131  133  __OUT1(s##c_p,x) __OUT2(s,s1,"") : : "a" (value), "id" (port)); SLOW_DOWN_IO; }
 132  134  
 133  135  #define __IN1(s,x) \
 134  136  extern unsigned x __in##s(unsigned short port); \
 135      -extern inline unsigned x __in##s(unsigned short port) { unsigned x _v;
      137 +extern __GNU_INLINE \
      138 +unsigned x __in##s(unsigned short port) { unsigned x _v;
 136  139  
 137  140  #define __IN2(s,s1,s2) \
 138  141  __asm__ __volatile__ ("in" #s " %" s2 "1,%" s1 "0"
 139  142  
 140  143  #define __IN(s,s1,x,i...) \
 141  144  __IN1(s,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); return _v; } \
 142  145  __IN1(s##c,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); return _v; } \
 143  146  __IN1(s##_p,x) __IN2(s,s1,"w") : "=a" (_v) : "d" (port) ,##i ); SLOW_DOWN_IO; return _v; } \
 144  147  __IN1(s##c_p,x) __IN2(s,s1,"") : "=a" (_v) : "id" (port) ,##i ); SLOW_DOWN_IO; return _v; }
 145  148  
 146  149  #define __INS(s) \
 147  150  extern void ins##s(unsigned short port, void * addr, unsigned long count); \
 148      -extern inline void ins##s(unsigned short port, void * addr, unsigned long count) \
      151 +extern __GNU_INLINE \
      152 +void ins##s(unsigned short port, void * addr, unsigned long count)      \
 149  153  { __asm__ __volatile__ ("cld ; rep ; ins" #s \
 150  154  : "=D" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
 151  155  
 152  156  #define __OUTS(s) \
 153  157  extern void outs##s(unsigned short port, const void * addr, unsigned long  count); \
 154      -extern inline void outs##s(unsigned short port, const void * addr, unsigned long count) \
      158 +extern __GNU_INLINE \
      159 +void outs##s(unsigned short port, const void * addr, unsigned long count) \
 155  160  { __asm__ __volatile__ ("cld ; rep ; outs" #s \
 156  161  : "=S" (addr), "=c" (count) : "d" (port),"0" (addr),"1" (count)); }
 157  162  
 158  163  __IN(b,"", char)
 159  164  __IN(w,"",short)
 160  165  __IN(l,"", long)
 161  166  
 162  167  __OUT(b,"b",char)
 163  168  __OUT(w,"w",short)
 164  169  __OUT(l,,int)
↓ open down ↓ 75 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX