XIP fails on kernels 2.6.12 and higher

Jared Hulbert jaredeh at gmail.com
Wed Oct 12 15:05:07 EDT 2005


On 9/29/05, Jared Hulbert <jaredeh at gmail.com> wrote:
> > If you can find the exact intermediate release between 2.6.11 and 2.6.12
> > that broke it that would be extrelely helpful.

I found it.  This is the change that was causing my problem
-----------------------------------------------------------------------------------
commit 3871b11e8c07c9e6652f81ae5afc1ae3bb120c40
Author: mpm <mpm>
Date:   Tue Mar 8 18:05:40 2005 +0000

    [PATCH] lib/sort: Replace insertion sort in exception tables

    Replace exception table insertion sort with lib/sort

    Signed-off-by: Matt Mackall <mpm at selenic.com>
    Signed-off-by: Andrew Morton <akpm at osdl.org>
    Signed-off-by: Linus Torvalds <torvalds at osdl.org>

    BKrev: 422de974WUZpIt5eM36-PMJe_h6Nfg
-----------------------------------------------------------------------------------

The following is the diff from the old git repository.  Unpatching
this in the 2.6.14-rc4 kernel made the xipImage work.  What is going
on???

Index: lib/extable.c
===================================================================
--- lib/extable.c	(revision 29)
+++ lib/extable.c	(revision 28)
@@ -13,6 +13,7 @@
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/sort.h>
 #include <asm/uaccess.h>

 extern struct exception_table_entry __start___ex_table[];
@@ -25,26 +26,17 @@
  * This is used both for the kernel exception table and for
  * the exception tables of modules that get loaded.
  */
+static int cmp_ex(const void *a, const void *b)
+{
+	const struct exception_table_entry *x = a, *y = b;
+	return x->insn - y->insn;
+}
+
 void sort_extable(struct exception_table_entry *start,
 		  struct exception_table_entry *finish)
 {
-	struct exception_table_entry el, *p, *q;
-
-	/* insertion sort */
-	for (p = start + 1; p < finish; ++p) {
-		/* start .. p-1 is sorted */
-		if (p[0].insn < p[-1].insn) {
-			/* move element p down to its right place */
-			el = *p;
-			q = p;
-			do {
-				/* el comes before q[-1], move q[-1] up one */
-				q[0] = q[-1];
-				--q;
-			} while (q > start && el.insn < q[-1].insn);
-			*q = el;
-		}
-	}
+	sort(start, finish - start, sizeof(struct exception_table_entry),
+	     cmp_ex, NULL);
 }
 #endif




More information about the linux-mtd mailing list