Commit a79b0f25 authored by David Mosberger's avatar David Mosberger

ia64: Switch over to using place-relative ("ip"-relative) entries in

	the exception table.
parent 76f0944e
...@@ -17,14 +17,14 @@ search_extable (const struct exception_table_entry *first, ...@@ -17,14 +17,14 @@ search_extable (const struct exception_table_entry *first,
{ {
const struct exception_table_entry *mid; const struct exception_table_entry *mid;
unsigned long mid_ip; unsigned long mid_ip;
long diff, base = (long) first; long diff;
while (first <= last) { while (first <= last) {
mid = &first[(last - first)/2]; mid = &first[(last - first)/2];
mid_ip = base + mid->addr; mid_ip = (u64) &mid->addr + mid->addr;
diff = mid_ip - ip; diff = mid_ip - ip;
if (diff == 0) if (diff == 0)
return (void *) ((long) base + mid->cont); return mid;
else if (diff < 0) else if (diff < 0)
first = mid + 1; first = mid + 1;
else else
...@@ -36,7 +36,8 @@ search_extable (const struct exception_table_entry *first, ...@@ -36,7 +36,8 @@ search_extable (const struct exception_table_entry *first,
void void
handle_exception (struct pt_regs *regs, const struct exception_table_entry *e) handle_exception (struct pt_regs *regs, const struct exception_table_entry *e)
{ {
long fix = (long) e; long fix = (u64) &e->cont + e->cont;
regs->r8 = -EFAULT; regs->r8 = -EFAULT;
if (fix & 4) if (fix & 4)
regs->r9 = 0; regs->r9 = 0;
......
...@@ -30,28 +30,9 @@ SECTIONS ...@@ -30,28 +30,9 @@ SECTIONS
_text = .; _text = .;
_stext = .; _stext = .;
.text.ivt : AT(ADDR(.text.ivt) - PAGE_OFFSET)
{
*(.text.ivt)
}
/*
* Due to a linker bug (still present as of binutils 2.13.90.0.10),
* the exception table must come before any code that uses the
* uaccess.h macros; otherwise, the linker will silently truncate negative @secrel()
* values to 0!! Just love it when bugs like these sneak in...
*/
/* Exception table */
. = ALIGN(16);
__ex_table : AT(ADDR(__ex_table) - PAGE_OFFSET)
{
__start___ex_table = .;
*(__ex_table)
__stop___ex_table = .;
}
.text : AT(ADDR(.text) - PAGE_OFFSET) .text : AT(ADDR(.text) - PAGE_OFFSET)
{ {
*(.text.ivt)
*(.text) *(.text)
} }
.text2 : AT(ADDR(.text2) - PAGE_OFFSET) .text2 : AT(ADDR(.text2) - PAGE_OFFSET)
...@@ -64,6 +45,15 @@ SECTIONS ...@@ -64,6 +45,15 @@ SECTIONS
/* Read-only data */ /* Read-only data */
/* Exception table */
. = ALIGN(16);
__ex_table : AT(ADDR(__ex_table) - PAGE_OFFSET)
{
__start___ex_table = .;
*(__ex_table)
__stop___ex_table = .;
}
/* Global data */ /* Global data */
_data = .; _data = .;
......
...@@ -44,18 +44,18 @@ ...@@ -44,18 +44,18 @@
.previous .previous
#if __GNUC__ >= 3 #if __GNUC__ >= 3
# define EX(y,x...) \ # define EX(y,x...) \
.xdata4 "__ex_table", @secrel(99f), @secrel(y); \ .xdata4 "__ex_table", 99f-., y-.; \
[99:] x [99:] x
# define EXCLR(y,x...) \ # define EXCLR(y,x...) \
.xdata4 "__ex_table", @secrel(99f), @secrel(y)+4; \ .xdata4 "__ex_table", 99f-., y-.+4; \
[99:] x [99:] x
#else #else
# define EX(y,x...) \ # define EX(y,x...) \
.xdata4 "__ex_table", @secrel(99f), @secrel(y); \ .xdata4 "__ex_table", 99f-., y-.; \
99: x 99: x
# define EXCLR(y,x...) \ # define EXCLR(y,x...) \
.xdata4 "__ex_table", @secrel(99f), @secrel(y)+4; \ .xdata4 "__ex_table", 99f-., y-.+4; \
99: x 99: x
#endif #endif
......
...@@ -140,25 +140,25 @@ asm (".section \"__ex_table\", \"a\"\n\t.previous"); ...@@ -140,25 +140,25 @@ asm (".section \"__ex_table\", \"a\"\n\t.previous");
#define __get_user_64(addr) \ #define __get_user_64(addr) \
asm ("\n"_LL"\tld8 %0=%2%P2\t// %0 and %1 get overwritten by exception handler\n" \ asm ("\n"_LL"\tld8 %0=%2%P2\t// %0 and %1 get overwritten by exception handler\n" \
"\t.xdata4 \"__ex_table\", @secrel(1b), @secrel(1f)+4\n" \ "\t.xdata4 \"__ex_table\", 1b-., 1f-.+4\n" \
_LL \ _LL \
: "=r"(__gu_val), "=r"(__gu_err) : "m"(__m(addr)), "1"(__gu_err)); : "=r"(__gu_val), "=r"(__gu_err) : "m"(__m(addr)), "1"(__gu_err));
#define __get_user_32(addr) \ #define __get_user_32(addr) \
asm ("\n"_LL"\tld4 %0=%2%P2\t// %0 and %1 get overwritten by exception handler\n" \ asm ("\n"_LL"\tld4 %0=%2%P2\t// %0 and %1 get overwritten by exception handler\n" \
"\t.xdata4 \"__ex_table\", @secrel(1b), @secrel(1f)+4\n" \ "\t.xdata4 \"__ex_table\", 1b-., 1f-.+4\n" \
_LL \ _LL \
: "=r"(__gu_val), "=r"(__gu_err) : "m"(__m(addr)), "1"(__gu_err)); : "=r"(__gu_val), "=r"(__gu_err) : "m"(__m(addr)), "1"(__gu_err));
#define __get_user_16(addr) \ #define __get_user_16(addr) \
asm ("\n"_LL"\tld2 %0=%2%P2\t// %0 and %1 get overwritten by exception handler\n" \ asm ("\n"_LL"\tld2 %0=%2%P2\t// %0 and %1 get overwritten by exception handler\n" \
"\t.xdata4 \"__ex_table\", @secrel(1b), @secrel(1f)+4\n" \ "\t.xdata4 \"__ex_table\", 1b-., 1f-.+4\n" \
_LL \ _LL \
: "=r"(__gu_val), "=r"(__gu_err) : "m"(__m(addr)), "1"(__gu_err)); : "=r"(__gu_val), "=r"(__gu_err) : "m"(__m(addr)), "1"(__gu_err));
#define __get_user_8(addr) \ #define __get_user_8(addr) \
asm ("\n"_LL"\tld1 %0=%2%P2\t// %0 and %1 get overwritten by exception handler\n" \ asm ("\n"_LL"\tld1 %0=%2%P2\t// %0 and %1 get overwritten by exception handler\n" \
"\t.xdata4 \"__ex_table\", @secrel(1b), @secrel(1f)+4\n" \ "\t.xdata4 \"__ex_table\", 1b-., 1f-.+4\n" \
_LL \ _LL \
: "=r"(__gu_val), "=r"(__gu_err) : "m"(__m(addr)), "1"(__gu_err)); : "=r"(__gu_val), "=r"(__gu_err) : "m"(__m(addr)), "1"(__gu_err));
...@@ -202,28 +202,28 @@ extern void __put_user_unknown (void); ...@@ -202,28 +202,28 @@ extern void __put_user_unknown (void);
#define __put_user_64(x,addr) \ #define __put_user_64(x,addr) \
asm volatile ( \ asm volatile ( \
"\n"_LL"\tst8 %1=%r2%P1\t// %0 gets overwritten by exception handler\n" \ "\n"_LL"\tst8 %1=%r2%P1\t// %0 gets overwritten by exception handler\n" \
"\t.xdata4 \"__ex_table\", @secrel(1b), @secrel(1f)\n" \ "\t.xdata4 \"__ex_table\", 1b-., 1f-.\n" \
_LL \ _LL \
: "=r"(__pu_err) : "m"(__m(addr)), "rO"(x), "0"(__pu_err)) : "=r"(__pu_err) : "m"(__m(addr)), "rO"(x), "0"(__pu_err))
#define __put_user_32(x,addr) \ #define __put_user_32(x,addr) \
asm volatile ( \ asm volatile ( \
"\n"_LL"\tst4 %1=%r2%P1\t// %0 gets overwritten by exception handler\n" \ "\n"_LL"\tst4 %1=%r2%P1\t// %0 gets overwritten by exception handler\n" \
"\t.xdata4 \"__ex_table\", @secrel(1b), @secrel(1f)\n" \ "\t.xdata4 \"__ex_table\", 1b-., 1f-.\n" \
_LL \ _LL \
: "=r"(__pu_err) : "m"(__m(addr)), "rO"(x), "0"(__pu_err)) : "=r"(__pu_err) : "m"(__m(addr)), "rO"(x), "0"(__pu_err))
#define __put_user_16(x,addr) \ #define __put_user_16(x,addr) \
asm volatile ( \ asm volatile ( \
"\n"_LL"\tst2 %1=%r2%P1\t// %0 gets overwritten by exception handler\n" \ "\n"_LL"\tst2 %1=%r2%P1\t// %0 gets overwritten by exception handler\n" \
"\t.xdata4 \"__ex_table\", @secrel(1b), @secrel(1f)\n" \ "\t.xdata4 \"__ex_table\", 1b-., 1f-.\n" \
_LL \ _LL \
: "=r"(__pu_err) : "m"(__m(addr)), "rO"(x), "0"(__pu_err)) : "=r"(__pu_err) : "m"(__m(addr)), "rO"(x), "0"(__pu_err))
#define __put_user_8(x,addr) \ #define __put_user_8(x,addr) \
asm volatile ( \ asm volatile ( \
"\n"_LL"\tst1 %1=%r2%P1\t// %0 gets overwritten by exception handler\n" \ "\n"_LL"\tst1 %1=%r2%P1\t// %0 gets overwritten by exception handler\n" \
"\t.xdata4 \"__ex_table\", @secrel(1b), @secrel(1f)\n" \ "\t.xdata4 \"__ex_table\", 1b-., 1f-.\n" \
_LL \ _LL \
: "=r"(__pu_err) : "m"(__m(addr)), "rO"(x), "0"(__pu_err)) : "=r"(__pu_err) : "m"(__m(addr)), "rO"(x), "0"(__pu_err))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment