Subject: Bug fix!
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Lennart Augustsson <augustss@cs.chalmers.se>
List: current-users
Date: 12/29/1993 16:22:06
The kernel from ca Dec 24 and later contains a big bug.
Here is the fix.  It makes the wd driver work again, i.e. it
cures the problems (with bugus drive data and reboot)
reported by several people.

The problem is in the new include file machine/pio.h.
The asm statements for ins* and outs* are bogus; the register
clobber list should contain names for real registers, not
constraint letters as the original.  The ins* should also
specify that memory is written by the instruction.

The diff to apply is included below.
This makes wd work again, and I hope that it will cure
some of the other instabilities that I have with the new kernel.

	-- Lennart


*** /sys/arch/i386/include/pio.h.old	Wed Dec 29 16:12:55 1993
--- /sys/arch/i386/include/pio.h	Wed Dec 29 14:06:36 1993
***************
*** 47,53 ****
  insb(u_short port, void *addr, int cnt)
  {
  	__asm __volatile("cld\n\trep\n\tinsb" :
! 			 : "d" (port), "D" (addr), "c" (cnt) : "D", "c");
  }
  
  static __inline u_short
--- 47,53 ----
  insb(u_short port, void *addr, int cnt)
  {
  	__asm __volatile("cld\n\trep\n\tinsb" :
! 			 : "d" (port), "D" (addr), "c" (cnt) : "%edi", "%ecx", "memory");
  }
  
  static __inline u_short
***************
*** 62,68 ****
  insw(u_short port, void *addr, int cnt)
  {
  	__asm __volatile("cld\n\trep\n\tinsw" :
! 			 : "d" (port), "D" (addr), "c" (cnt) : "D", "c");
  }
  
  static __inline u_int
--- 62,68 ----
  insw(u_short port, void *addr, int cnt)
  {
  	__asm __volatile("cld\n\trep\n\tinsw" :
! 			 : "d" (port), "D" (addr), "c" (cnt) : "%edi", "%ecx", "memory");
  }
  
  static __inline u_int
***************
*** 77,83 ****
  insl(u_short port, void *addr, int cnt)
  {
  	__asm __volatile("cld\n\trep\n\tinsl" :
! 			 : "d" (port), "D" (addr), "c" (cnt) : "D", "c");
  }
  
  static __inline void
--- 77,83 ----
  insl(u_short port, void *addr, int cnt)
  {
  	__asm __volatile("cld\n\trep\n\tinsl" :
! 			 : "d" (port), "D" (addr), "c" (cnt) : "%edi", "%ecx", "memory");
  }
  
  static __inline void
***************
*** 90,96 ****
  outsb(u_short port, void *addr, int cnt)
  {
  	__asm __volatile("cld\n\trep\n\toutsb" :
! 			 : "d" (port), "S" (addr), "c" (cnt) : "S", "c");
  }
  
  static __inline void
--- 90,96 ----
  outsb(u_short port, void *addr, int cnt)
  {
  	__asm __volatile("cld\n\trep\n\toutsb" :
! 			 : "d" (port), "S" (addr), "c" (cnt) : "%esi", "%ecx");
  }
  
  static __inline void
***************
*** 103,109 ****
  outsw(u_short port, void *addr, int cnt)
  {
  	__asm __volatile("cld\n\trep\n\toutsw" :
! 			 : "d" (port), "S" (addr), "c" (cnt) : "S", "c");
  }
  
  static __inline void
--- 103,109 ----
  outsw(u_short port, void *addr, int cnt)
  {
  	__asm __volatile("cld\n\trep\n\toutsw" :
! 			 : "d" (port), "S" (addr), "c" (cnt) : "%esi", "%ecx");
  }
  
  static __inline void
***************
*** 116,120 ****
  outsl(u_short port, void *addr, int cnt)
  {
  	__asm __volatile("cld\n\trep\n\toutsl" :
! 			 : "d" (port), "S" (addr), "c" (cnt) : "S", "c");
  }
--- 116,120 ----
  outsl(u_short port, void *addr, int cnt)
  {
  	__asm __volatile("cld\n\trep\n\toutsl" :
! 			 : "d" (port), "S" (addr), "c" (cnt) : "%esi", "%ecx");
  }

------------------------------------------------------------------------------