[xtensa-cvscommit] linux/arch/xtensa/mm extable.c,1.1.1.1,1.2
Brought to you by:
zankel
|
From: <joe...@us...> - 2003-06-12 23:43:56
|
Update of /cvsroot/xtensa/linux/arch/xtensa/mm
In directory sc8-pr-cvs1:/tmp/cvs-serv10730/arch/xtensa/mm
Modified Files:
extable.c
Log Message:
We need to sort the exception table, else a task error crashes the kernel.
Index: extable.c
===================================================================
RCS file: /cvsroot/xtensa/linux/arch/xtensa/mm/extable.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** extable.c 28 Aug 2002 16:10:14 -0000 1.1.1.1
--- extable.c 12 Jun 2003 23:43:53 -0000 1.2
***************
*** 10,13 ****
--- 10,46 ----
extern const struct exception_table_entry __stop___ex_table[];
+ /*
+ * The exception table needs to be sorted because we use the macros
+ * which put things into the exception table in a variety of segments.
+ */
+ static inline void
+ sort_ex_table(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;
+ }
+ }
+ }
+
+ void
+ sort_exception_table(void)
+ {
+ sort_ex_table(__start___ex_table, __stop___ex_table);
+ }
+
static inline unsigned long
search_one_table(const struct exception_table_entry *first,
|