mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
bitkeeper revision 1.1159.194.1 (41a5c5c5J8BRAOOMMsDGqEcd_8brmg)
Sort exception tables during Xen boot. This will fix some nasty crashes that some people have seen in the last day or so.
This commit is contained in:
1 parent
bd28987fc4
commit
100723a89e
3 files changed
+33
-6
No files matched your search
+30
-6
@@ -3,6 +3,36 @@
|
||||
#include <xen/spinlock.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
extern struct exception_table_entry __start___ex_table[];
|
||||
extern struct exception_table_entry __stop___ex_table[];
|
||||
extern struct exception_table_entry __start___pre_ex_table[];
|
||||
extern struct exception_table_entry __stop___pre_ex_table[];
|
||||
|
||||
static void sort_exception_table(struct exception_table_entry *start,
|
||||
struct exception_table_entry *end)
|
||||
{
|
||||
struct exception_table_entry *p, *q, tmp;
|
||||
|
||||
for ( p = start; p < end; p++ )
|
||||
{
|
||||
for ( q = p-1; q > start; q-- )
|
||||
if ( p->insn > q->insn )
|
||||
break;
|
||||
if ( ++q != p )
|
||||
{
|
||||
tmp = *p;
|
||||
memmove(q+1, q, (p-q)*sizeof(*p));
|
||||
*q = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sort_exception_tables(void)
|
||||
{
|
||||
sort_exception_table(__start___ex_table, __stop___ex_table);
|
||||
sort_exception_table(__start___pre_ex_table, __stop___pre_ex_table);
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
search_one_table(const struct exception_table_entry *first,
|
||||
const struct exception_table_entry *last,
|
||||
@@ -28,21 +58,15 @@ search_one_table(const struct exception_table_entry *first,
|
||||
unsigned long
|
||||
search_exception_table(unsigned long addr)
|
||||
{
|
||||
extern const struct exception_table_entry __start___ex_table[];
|
||||
extern const struct exception_table_entry __stop___ex_table[];
|
||||
return search_one_table(
|
||||
__start___ex_table, __stop___ex_table-1, addr);
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
unsigned long
|
||||
search_pre_exception_table(unsigned long addr)
|
||||
{
|
||||
extern const struct exception_table_entry __start___pre_ex_table[];
|
||||
extern const struct exception_table_entry __stop___pre_ex_table[];
|
||||
unsigned long fixup = search_one_table(
|
||||
__start___pre_ex_table, __stop___pre_ex_table-1, addr);
|
||||
DPRINTK("Pre-exception: %08lx -> %08lx\n", addr, fixup);
|
||||
return fixup;
|
||||
}
|
||||
#endif
|
||||
@@ -326,6 +326,8 @@ void __init start_of_day(void)
|
||||
if ( opt_watchdog )
|
||||
nmi_watchdog = NMI_LOCAL_APIC;
|
||||
|
||||
sort_exception_tables();
|
||||
|
||||
/* Tell the PCI layer not to allocate too close to the RAM area.. */
|
||||
low_mem_size = ((max_page << PAGE_SHIFT) + 0xfffff) & ~0xfffff;
|
||||
if ( low_mem_size > pci_mem_start ) pci_mem_start = low_mem_size;
|
||||
|
||||
@@ -85,6 +85,7 @@ struct exception_table_entry
|
||||
};
|
||||
|
||||
extern unsigned long search_exception_table(unsigned long);
|
||||
extern void sort_exception_tables(void);
|
||||
|
||||
/**
|
||||
* get_user: - Get a simple variable from user space.
|
||||
|
||||