[comp.unix.sysv386] Serious bug in Thomas Roell's X386 V1.1

john@feith1.UUCP (John L. Wehle) (05/26/91)

The routines contain in server/ddx/at386/bsdemul/byteorder.s
have a serious problem in that they violate C calling conventions
by removing the passed parameter from the stack.  Enclosed is
a patch which fixes this problem.

*** server/ddx/at386/bsdemul/byteorder.s.orig	Sat May 25 22:36:52 1991
--- server/ddx/at386/bsdemul/byteorder.s	Sat May 25 22:14:29 1991
***************
*** 33,38 ****
--- 33,39 ----
  htons:
          popl	%ecx		/* get return address */
  	popl	%eax		/* param */
+ 	pushl	%eax		/* fix stack */
  	xchgb	%al,%ah		/* swap */
  	jmp	*%ecx		/* return */
  
***************
*** 45,50 ****
--- 46,52 ----
  htonl:
          popl	%ecx		/* get return address */
  	popl	%eax		/* param */
+ 	pushl	%eax		/* fix stack */
  	xchgb	%al,%ah		/* swap lower bytes */
  	rorl	$16,%eax	/* swap words */
  	xchgb	%al,%ah		/* swap higher bytes */

-- 
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  | Email: john@feith1.UUCP |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------