[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] [PATCH] load_external_table() crashes on 68000



Hello.

I noticed that FreeMiNT crashes at startup on 68000. This is because the keyboard tables may not be aligned on even addresses, and the quickmove() function does not support that on 68000. I replaced it by quickmovb(), now it works fine on all processors (at least, now it passes that step).

Please commit.

keytable.patch
Fixed load_external_table() crash on 68000. Contributed by Vincent Riviere.

--
Vincent Rivière
--- freemint-1.18.orig/sys/keyboard.c	2013-02-08 00:18:13.093750000 +0100
+++ freemint-1.18/sys/keyboard.c	2013-02-25 23:45:14.734375000 +0100
@@ -1477,7 +1477,7 @@
 	assert(pointers);
 
 	/* Copy the master table over */
-	quickmove(tables, keytab_buffer, keytab_size);
+	quickmovb(tables, keytab_buffer, keytab_size);
 
 	/* Setup the standard vectors */
 	pointers->unshift = tables;
@@ -1589,7 +1589,7 @@
 		{
 			case 0x2771:		/* magic word for std format */
 			{
-				quickmove(kbuf, kbuf + sizeof(short), size - sizeof(short) + 2);
+				quickmovb(kbuf, kbuf + sizeof(short), size - sizeof(short) + 2);
 				break;
 			}
 			case 0x2772:		/* magic word for ext format */
@@ -1605,7 +1605,7 @@
 				if ((sbuf[1] >= 0) && (sbuf[1] <= MAXAKP))
 					gl_kbd = sbuf[1];
 
-				quickmove(kbuf, kbuf + sizeof(long), size - sizeof(long) + 2);
+				quickmovb(kbuf, kbuf + sizeof(long), size - sizeof(long) + 2);
 				break;
 			}
 			case 0x2773:		/* the ISO format (as of 30.VII.2004) */
@@ -1623,7 +1623,7 @@
 				if ((sbuf[3] > 0) && (sbuf[3] <= 10))
 				{
 					iso_8859_code = (long)sbuf[3];
-					quickmove(kbuf, kbuf + (sizeof(long)*2), \
+					quickmovb(kbuf, kbuf + (sizeof(long)*2), \
 							size - (sizeof(long)*2) + 2);
 				}
 				else
@@ -1725,13 +1725,13 @@
 	p = kbuf;
 	mint_bzero(p, size);
 
-	quickmove(p, tos_keytab->unshift, 128);
+	quickmovb(p, tos_keytab->unshift, 128);
 	p += 128;
 
-	quickmove(p, tos_keytab->shift, 128);
+	quickmovb(p, tos_keytab->shift, 128);
 	p += 128;
 
-	quickmove(p, tos_keytab->caps, 128);
+	quickmovb(p, tos_keytab->caps, 128);
 	p += 128;
 
 # ifndef WITHOUT_TOS
@@ -1739,21 +1739,21 @@
 	if (tosvers >= 0x0400)
 	{
 		len = strlen((char *)tos_keytab->alt) + 1;
-		quickmove(p, tos_keytab->alt, len);
+		quickmovb(p, tos_keytab->alt, len);
 		p += len;
 
 		len = strlen((char *)tos_keytab->altshift) + 1;
-		quickmove(p, tos_keytab->altshift, len);
+		quickmovb(p, tos_keytab->altshift, len);
 		p += len;
 
 		len = strlen((char *)tos_keytab->altcaps) + 1;
-		quickmove(p, tos_keytab->altcaps, len);
+		quickmovb(p, tos_keytab->altcaps, len);
 		p += len;
 
 		if (mch == MILAN_C)
 		{
 			len = strlen((char *)tos_keytab->altgr) + 1;
-			quickmove(p, tos_keytab->altgr, len);
+			quickmovb(p, tos_keytab->altgr, len);
 		}
 	}
 
@@ -1763,23 +1763,23 @@
 	 */
 
 	len = strlen((char *)tos_keytab->alt) + 1;
-	quickmove(p, tos_keytab->alt, len);
+	quickmovb(p, tos_keytab->alt, len);
 	p += len;
 
 	len = strlen((char *)tos_keytab->altshift) + 1;
-	quickmove(p, tos_keytab->altshift, len);
+	quickmovb(p, tos_keytab->altshift, len);
 	p += len;
 
 	len = strlen((char *)tos_keytab->altcaps) + 1;
-	quickmove(p, tos_keytab->altcaps, len);
+	quickmovb(p, tos_keytab->altcaps, len);
 	p += len;
 
 	len = strlen((char *)tos_keytab->altgr) + 1;
-	quickmove(p, tos_keytab->altgr, len);
+	quickmovb(p, tos_keytab->altgr, len);
 	p += len;
 
 	len = strlen((char *)tos_keytab->deadkeys) + 1;
-	quickmove(p, tos_keytab->deadkeys, len);
+	quickmovb(p, tos_keytab->deadkeys, len);
 
 	gl_kbd = default_akp;
 # endif