Return to BSD News archive
Newsgroups: comp.os.386bsd.development Path: sserve!manuel.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!saimiri.primate.wisc.edu!sdd.hp.com!swrinde!cs.utexas.edu!wupost!dsuvax.dsu.edu!ghelmer From: ghelmer@dsuvax.dsu.edu (Guy Helmer) Subject: Re: Anyone converted xdr_float.c for 386BSD? Message-ID: <1993Mar1.201716.5381@dsuvax.dsu.edu> Organization: Dakota State University References: <C38405.2tyz@austin.ibm.com> Date: Mon, 1 Mar 1993 20:17:16 GMT Lines: 168 In <C38405.2tyz@austin.ibm.com> fredriks@austin.ibm.com (Lars Fredriksen) writes: >Hi, > I got the sunrpc package from ref.tfs.com, but when I tried >to compile the rpc library, xdr_float.c bombed out. I was under the >impression that the software was ported already, but there were no >diffs that I could find. > Anyone seen it? Here's patches I worked up a while ago and used with pvm (parallel virtual machine) on 386bsd. I never took the time to clean up the patches. The testing I did with pvm on 386bsd versus pvm on a Sun workstation showed no differences in the output, so I assume it mostly works. Since Intel's format is IEEE format (if there are exceptions in Intel's implementation the code should be modified to account for those differences, but I don't know of any), the bytes & words just need to be swapped around so the changes are simple. Here's the diffs for /usr/src/lib/librpc/rpc/xdr_float.c: -------------------------------------------------------------------- diff -c /usr/src/lib/librpc/rpc/xdr_float.c xdr_float.c *** /usr/src/lib/librpc/rpc/xdr_float.c Thu Aug 23 17:38:15 1990 --- xdr_float.c Thu Nov 12 14:09:12 1992 *************** *** 1,5 **** --- 1,11 ---- /* @(#)xdr_float.c 2.1 88/07/29 4.0 RPCSRC */ /* + Hacked by Guy Helmer (08/27/92) to support 386BSD on Intel 80386 + and compatible CPUS. + At this point, operation of xdr_double is not guaranteed and + may not be correct. Testing is needed. + */ + /* * Sun RPC is a product of Sun Microsystems, Inc. and is provided for * unrestricted use provided that this legend is included on all tape * media and as a part of the software program in whole or part. Users *************** *** 87,93 **** register XDR *xdrs; register float *fp; { ! #if !defined(mc68000) && !defined(sparc) struct ieee_single is; struct vax_single vs, *vsp; struct sgl_limits *lim; --- 93,99 ---- register XDR *xdrs; register float *fp; { ! #if !defined(mc68000) && !defined(sparc) && !defined(__386BSD__) struct ieee_single is; struct vax_single vs, *vsp; struct sgl_limits *lim; *************** *** 96,102 **** switch (xdrs->x_op) { case XDR_ENCODE: ! #if defined(mc68000) || defined(sparc) return (XDR_PUTLONG(xdrs, (long *)fp)); #else vs = *((struct vax_single *)fp); --- 102,108 ---- switch (xdrs->x_op) { case XDR_ENCODE: ! #if defined(mc68000) || defined(sparc) || defined(__386BSD__) return (XDR_PUTLONG(xdrs, (long *)fp)); #else vs = *((struct vax_single *)fp); *************** *** 118,124 **** #endif case XDR_DECODE: ! #if defined(mc68000) || defined(sparc) return (XDR_GETLONG(xdrs, (long *)fp)); #else vsp = (struct vax_single *)fp; --- 124,130 ---- #endif case XDR_DECODE: ! #if defined(mc68000) || defined(sparc) || defined(__386BSD__) return (XDR_GETLONG(xdrs, (long *)fp)); #else vsp = (struct vax_single *)fp; *************** *** 193,199 **** double *dp; { register long *lp; ! #if !defined(mc68000) && !defined(sparc) struct ieee_double id; struct vax_double vd; register struct dbl_limits *lim; --- 199,205 ---- double *dp; { register long *lp; ! #if !defined(mc68000) && !defined(sparc) && !defined(__386BSD__) struct ieee_double id; struct vax_double vd; register struct dbl_limits *lim; *************** *** 203,209 **** switch (xdrs->x_op) { case XDR_ENCODE: ! #if defined(mc68000) || defined(sparc) lp = (long *)dp; #else vd = *((struct vax_double *)dp); --- 209,215 ---- switch (xdrs->x_op) { case XDR_ENCODE: ! #if defined(mc68000) || defined(sparc) || defined(__386BSD__) lp = (long *)dp; #else vd = *((struct vax_double *)dp); *************** *** 228,239 **** id.sign = vd.sign; lp = (long *)&id; #endif return (XDR_PUTLONG(xdrs, lp++) && XDR_PUTLONG(xdrs, lp)); case XDR_DECODE: ! #if defined(mc68000) || defined(sparc) lp = (long *)dp; return (XDR_GETLONG(xdrs, lp++) && XDR_GETLONG(xdrs, lp)); #else lp = (long *)&id; if (!XDR_GETLONG(xdrs, lp++) || !XDR_GETLONG(xdrs, lp)) --- 234,256 ---- id.sign = vd.sign; lp = (long *)&id; #endif + #if defined(__386BSD__) + /* + Deal with reversed word order. + */ + return (XDR_PUTLONG(xdrs, (lp + 1)) && XDR_PUTLONG(xdrs, lp)); + #else return (XDR_PUTLONG(xdrs, lp++) && XDR_PUTLONG(xdrs, lp)); + #endif case XDR_DECODE: ! #if defined(mc68000) || defined(sparc) || defined(__386BSD__) lp = (long *)dp; + #if defined(__386BSD__) + return (XDR_GETLONG(xdrs, (lp + 1)) && XDR_GETLONG(xdrs, lp)); + #else return (XDR_GETLONG(xdrs, lp++) && XDR_GETLONG(xdrs, lp)); + #endif #else lp = (long *)&id; if (!XDR_GETLONG(xdrs, lp++) || !XDR_GETLONG(xdrs, lp)) -------------------------------------------------------------------------- -- Guy Helmer, Dakota State University Computing Services - ghelmer@dsuvax.dsu.edu