Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Oct 2006 03:22:19 GMT
From:      Matt Jacob <mjacob@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 108207 for review
Message-ID:  <200610210322.k9L3MJK2041780@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=108207

Change 108207 by mjacob@newisp on 2006/10/21 03:21:20

	IFC

Affected files ...

.. //depot/projects/newisp/arm/arm/trap.c#3 integrate
.. //depot/projects/newisp/dev/pci/pci.c#4 integrate
.. //depot/projects/newisp/netinet/ip_fw_pfil.c#3 integrate
.. //depot/projects/newisp/netinet/ip_input.c#3 integrate

Differences ...

==== //depot/projects/newisp/arm/arm/trap.c#3 (text+ko) ====

@@ -82,7 +82,7 @@
 #include "opt_ktrace.h"
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/arm/trap.c,v 1.28 2006/10/20 11:00:03 cognet Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/arm/trap.c,v 1.30 2006/10/21 00:46:56 cognet Exp $");
 
 #include <sys/types.h>
 
@@ -900,9 +900,9 @@
 		
 		nap--;
 	} else if (code == SYS___syscall) {
-		code = *ap++;
+		code = ap[_QUAD_LOWWORD];
 		nap -= 2;
-		ap++;
+		ap += 2;
 	}
 	if (p->p_sysent->sv_mask)
 		code &= p->p_sysent->sv_mask;
@@ -940,8 +940,23 @@
 	}
 	switch (error) {
 	case 0: 
-      		frame->tf_r0 = td->td_retval[0];
-		frame->tf_r1 = td->td_retval[1];
+#ifdef __ARMEB__
+		if ((insn & 0x000fffff) == SYS___syscall &&
+		    (code != SYS_lseek)) {
+			/*
+			 * 64-bit return, 32-bit syscall. Fixup byte order
+			 */ 
+			frame->tf_r0 = 0;
+			frame->tf_r1 = td->td_retval[0];
+		} else {
+			frame->tf_r0 = td->td_retval[0];
+			frame->tf_r1 = td->td_retval[1];
+		}
+#else
+		frame->tf_r0 = td->td_retval[0];
+	  	frame->tf_r1 = td->td_retval[1];
+#endif
+					      
 		frame->tf_spsr &= ~PSR_C_bit;   /* carry bit */
 		break;
 		

==== //depot/projects/newisp/dev/pci/pci.c#4 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.315 2006/10/09 16:15:55 jmg Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.316 2006/10/20 21:28:11 jmg Exp $");
 
 #include "opt_bus.h"
 
@@ -653,12 +653,37 @@
 			cfg->vpd.vpd_ros[off].keyword[0] = byte;
 			cfg->vpd.vpd_ros[off].keyword[1] = vpd_nextbyte(&vrs);
 			dflen = vpd_nextbyte(&vrs);
-			cfg->vpd.vpd_ros[off].value = malloc((dflen + 1) *
-			    sizeof *cfg->vpd.vpd_ros[off].value,
-			    M_DEVBUF, M_WAITOK);
+			if (dflen == 0 &&
+			    strncmp(cfg->vpd.vpd_ros[off].keyword, "RV",
+			    2) == 0) {
+				/*
+				 * if this happens, we can't trust the rest
+				 * of the VPD.
+				 */
+				printf("pci%d:%d:%d: bad keyword length: %d\n",
+				    cfg->bus, cfg->slot, cfg->func, dflen);
+				cksumvalid = 0;
+				end = 1;
+				break;
+			} else if (dflen == 0) {
+				cfg->vpd.vpd_ros[off].value = malloc(1 *
+				    sizeof *cfg->vpd.vpd_ros[off].value,
+				    M_DEVBUF, M_WAITOK);
+				cfg->vpd.vpd_ros[off].value[0] = '\x00';
+			} else
+				cfg->vpd.vpd_ros[off].value = malloc(
+				    (dflen + 1) *
+				    sizeof *cfg->vpd.vpd_ros[off].value,
+				    M_DEVBUF, M_WAITOK);
 			remain -= 3;
 			i = 0;
-			state = 3;
+			/* keep in sync w/ state 3's transistions */
+			if (dflen == 0 && remain == 0)
+				state = 0;
+			else if (dflen == 0)
+				state = 2;
+			else
+				state = 3;
 			break;
 
 		case 3:	/* VPD-R Keyword Value */
@@ -673,10 +698,13 @@
 					    cfg->bus, cfg->slot, cfg->func,
 					    vrs.cksum);
 					cksumvalid = 0;
+					end = 1;
+					break;
 				}
 			}
 			dflen--;
 			remain--;
+			/* keep in sync w/ state 2's transistions */
 			if (dflen == 0)
 				cfg->vpd.vpd_ros[off++].value[i++] = '\0';
 			if (dflen == 0 && remain == 0) {
@@ -710,13 +738,20 @@
 			    M_DEVBUF, M_WAITOK);
 			remain -= 3;
 			i = 0;
-			state = 6;
+			/* keep in sync w/ state 6's transistions */
+			if (dflen == 0 && remain == 0)
+				state = 0;
+			else if (dflen == 0)
+				state = 5;
+			else
+				state = 6;
 			break;
 
 		case 6:	/* VPD-W Keyword Value */
 			cfg->vpd.vpd_w[off].value[i++] = byte;
 			dflen--;
 			remain--;
+			/* keep in sync w/ state 5's transistions */
 			if (dflen == 0)
 				cfg->vpd.vpd_w[off++].value[i++] = '\0';
 			if (dflen == 0 && remain == 0) {
@@ -736,6 +771,15 @@
 			break;
 		}
 	}
+
+	if (cksumvalid == 0) {
+		/* read-only data bad, clean up */
+		for (; off; off--)
+			free(cfg->vpd.vpd_ros[off].value, M_DEVBUF);
+
+		free(cfg->vpd.vpd_ros, M_DEVBUF);
+		cfg->vpd.vpd_ros = NULL;
+	}
 #undef REG
 }
 
@@ -1111,12 +1155,12 @@
 				struct vpd_readonly *vrop;
 				vrop = &cfg->vpd.vpd_ros[i];
 				if (strncmp("CP", vrop->keyword, 2) == 0)
-					printf("CP: id %d, BAR%d, off %#x\n",
+					printf("\tCP: id %d, BAR%d, off %#x\n",
 					    vrop->value[0], vrop->value[1],
 					    le16toh(
 					      *(uint16_t *)&vrop->value[2]));
 				else if (strncmp("RV", vrop->keyword, 2) == 0)
-					printf("RV: %#hhx\n", vrop->value[0]);
+					printf("\tRV: %#hhx\n", vrop->value[0]);
 				else 
 					printf("\t%.2s: %s\n", vrop->keyword,
 					    vrop->value);

==== //depot/projects/newisp/netinet/ip_fw_pfil.c#3 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/netinet/ip_fw_pfil.c,v 1.22 2006/10/20 19:32:08 julian Exp $
+ * $FreeBSD: src/sys/netinet/ip_fw_pfil.c,v 1.23 2006/10/21 00:16:31 julian Exp $
  */
 
 #if !defined(KLD_MODULE)
@@ -80,14 +80,6 @@
 /* ng_ipfw hooks. */
 ng_ipfw_input_t *ng_ipfw_input_p = NULL;
 
-/*
- * ipfw_ether and ipfw_bridge hooks.
- * XXX: Temporary until those are converted to pfil_hooks as well.
- */
-ip_fw_chk_t *ip_fw_chk_ptr = NULL;
-ip_dn_io_t *ip_dn_io_ptr = NULL;
-int fw_one_pass = 1;
-
 /* Forward declarations. */
 static int	ipfw_divert(struct mbuf **, int, int);
 #define	DIV_DIR_IN	1

==== //depot/projects/newisp/netinet/ip_input.c#3 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)ip_input.c	8.2 (Berkeley) 1/4/94
- * $FreeBSD: src/sys/netinet/ip_input.c,v 1.321 2006/10/20 19:32:08 julian Exp $
+ * $FreeBSD: src/sys/netinet/ip_input.c,v 1.322 2006/10/21 00:16:31 julian Exp $
  */
 
 #include "opt_bootp.h"
@@ -77,6 +77,10 @@
 
 #include <sys/socketvar.h>
 
+/* XXX: Temporary until ipfw_ether and ipfw_bridge are converted. */
+#include <netinet/ip_fw.h>
+#include <netinet/ip_dummynet.h>
+
 int rsvp_on = 0;
 
 int	ipforwarding = 0;
@@ -188,6 +192,14 @@
     &ipstealth, 0, "");
 #endif
 
+/*
+ * ipfw_ether and ipfw_bridge hooks.
+ * XXX: Temporary until those are converted to pfil_hooks as well.
+ */
+ip_fw_chk_t *ip_fw_chk_ptr = NULL;
+ip_dn_io_t *ip_dn_io_ptr = NULL;
+int fw_one_pass = 1;
+
 static void	ip_freef(struct ipqhead *, struct ipq *);
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610210322.k9L3MJK2041780>