xen-vtx-unstable

view xen/arch/x86/extable.c @ 6759:b5d91089e42c

Newer binutils is a bit stricter and errors out when you try
to use movl on a 16 bit word on x86_64. Using just a "mov"
compiles fine and should result in the same code.

{standard input}: Assembler messages:
{standard input}:2138: Error: suffix or operands invalid for `mov'
{standard input}:2140: Error: suffix or operands invalid for `mov'
{standard input}:2142: Error: suffix or operands invalid for `mov'
{standard input}:2144: Error: suffix or operands invalid for `mov'

Signed-off-by: Rik van Riel <riel@redhat.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Sep 13 10:21:22 2005 +0000 (2005-09-13)
parents fea2f7f8df31
children
line source
2 #include <xen/config.h>
3 #include <xen/spinlock.h>
4 #include <asm/uaccess.h>
6 #ifdef PERF_COUNTERS
7 #include <xen/sched.h>
8 #include <xen/perfc.h>
9 #include <asm/current.h>
10 #endif
12 extern struct exception_table_entry __start___ex_table[];
13 extern struct exception_table_entry __stop___ex_table[];
14 extern struct exception_table_entry __start___pre_ex_table[];
15 extern struct exception_table_entry __stop___pre_ex_table[];
17 static void sort_exception_table(struct exception_table_entry *start,
18 struct exception_table_entry *end)
19 {
20 struct exception_table_entry *p, *q, tmp;
22 for ( p = start; p < end; p++ )
23 {
24 for ( q = p-1; q > start; q-- )
25 if ( p->insn > q->insn )
26 break;
27 if ( ++q != p )
28 {
29 tmp = *p;
30 memmove(q+1, q, (p-q)*sizeof(*p));
31 *q = tmp;
32 }
33 }
34 }
36 void sort_exception_tables(void)
37 {
38 sort_exception_table(__start___ex_table, __stop___ex_table);
39 sort_exception_table(__start___pre_ex_table, __stop___pre_ex_table);
40 }
42 static inline unsigned long
43 search_one_table(const struct exception_table_entry *first,
44 const struct exception_table_entry *last,
45 unsigned long value)
46 {
47 const struct exception_table_entry *mid;
48 long diff;
50 while ( first <= last )
51 {
52 mid = (last - first) / 2 + first;
53 diff = mid->insn - value;
54 if (diff == 0)
55 return mid->fixup;
56 else if (diff < 0)
57 first = mid+1;
58 else
59 last = mid-1;
60 }
61 return 0;
62 }
64 unsigned long
65 search_exception_table(unsigned long addr)
66 {
67 return search_one_table(
68 __start___ex_table, __stop___ex_table-1, addr);
69 }
71 unsigned long
72 search_pre_exception_table(struct cpu_user_regs *regs)
73 {
74 unsigned long addr = (unsigned long)regs->eip;
75 unsigned long fixup = search_one_table(
76 __start___pre_ex_table, __stop___pre_ex_table-1, addr);
77 DPRINTK("Pre-exception: %p -> %p\n", _p(addr), _p(fixup));
78 #ifdef PERF_COUNTERS
79 if ( fixup )
80 perfc_incrc(exception_fixed);
81 #endif
82 return fixup;
83 }