Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 May 2002 20:20:38 -0400 (EDT)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        Craig <craig@cheetahusa.net>
Cc:        Rich Bud <rbud@fortean.com>, freebsd-alpha@freebsd.org
Subject:   Re: natd sig 10 under stable
Message-ID:  <15586.64342.316609.71281@grasshopper.cs.duke.edu>
In-Reply-To: <3CE2E558.9030707@cheetahusa.net>
References:  <20020515160407.T28044-100000@nemesis.fortean.com> <15586.55082.170680.378288@grasshopper.cs.duke.edu> <3CE2E558.9030707@cheetahusa.net>

next in thread | previous in thread | raw e-mail | index | archive | help



Here's an MFC candidate of the unaligned fixup additions to support the
bwx instructions (ldwu & stw).  

Please apply this to your system (cd /usr/src/sys; patch < thepatch),
rebuild your kernel & reboot to see if your natd problem is fixed.

Thanks,

Drew




Index: alpha/alpha/trap.c
===================================================================
RCS file: /home/ncvs/src/sys/alpha/alpha/trap.c,v
retrieving revision 1.26.2.4
diff -u -r1.26.2.4 trap.c
--- alpha/alpha/trap.c	5 Mar 2001 21:24:15 -0000	1.26.2.4
+++ alpha/alpha/trap.c	16 May 2002 00:16:30 -0000
@@ -921,6 +921,11 @@
 extern int	alpha_unaligned_print, alpha_unaligned_fix;
 extern int	alpha_unaligned_sigbus;
 
+struct unaligned_fixup_data {
+	const char *type;	/* opcode name */
+	int size;		/* size, 0 if fixup not supported */
+};
+
 int
 unaligned_fixup(va, opcode, reg, p)
 	unsigned long va, opcode, reg;
@@ -931,10 +936,11 @@
 	const char *type;
 	unsigned long *regptr, longdata, uac;
 	int intdata;		/* signed to get extension when storing */
-	struct {
-		const char *type;	/* opcode name */
-		int size;		/* size, 0 if fixup not supported */
-	} tab[0x10] = {
+	u_int16_t worddata;	/* unsigned to _avoid_ extension */
+	const struct unaligned_fixup_data tab_0c[0x2] = {
+		{ "ldwu",	2 },	{ "stw",	2 },
+	};
+	const struct unaligned_fixup_data tab_20[0x10] = {
 #ifdef FIX_UNALIGNED_VAX_FP
 		{ "ldf",	4 },	{ "ldg",	8 },
 #else
@@ -971,9 +977,12 @@
 	 * Find out which opcode it is.  Arrange to have the opcode
 	 * printed if it's an unknown opcode.
 	 */
-	if (opcode >= 0x20 && opcode <= 0x2f) {
-		type = tab[opcode - 0x20].type;
-		size = tab[opcode - 0x20].size;
+	if (opcode >= 0x0c && opcode <= 0x0d) {
+		type = tab_0c[opcode - 0x0c].type;
+		size = tab_0c[opcode - 0x0c].size;
+	} else if (opcode >= 0x20 && opcode <= 0x2f) {
+		type = tab_20[opcode - 0x20].type;
+		size = tab_20[opcode - 0x20].size;
 	} else {
 		type = "0x%lx";
 		size = 0;
@@ -1016,6 +1025,15 @@
 	signal = SIGBUS;
 	if (dofix && size != 0) {
 		switch (opcode) {
+		case 0x0c:                      /* ldwu */
+			/* XXX ONLY WORKS ON LITTLE-ENDIAN ALPHA */
+			unaligned_load_integer(worddata);
+			break;
+
+		case 0x0d:                      /* stw */
+			/* XXX ONLY WORKS ON LITTLE-ENDIAN ALPHA */
+			unaligned_store_integer(worddata);
+			break;
 #ifdef FIX_UNALIGNED_VAX_FP
 		case 0x20:			/* ldf */
 			unaligned_load_floating(intdata, Ffloat_to_reg);

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




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