Skip to content

Commit 535c0c3

Browse files
author
H. Peter Anvin
committed
x86, extable: Add _ASM_EXTABLE_EX() macro
Add _ASM_EXTABLE_EX() to generate the special extable entries that are associated with uaccess_err. This allows us to change the protocol associated with these special entries. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Cc: David Daney <david.daney@cavium.com> Link: http://lkml.kernel.org/r/CA%2B55aFyijf43qSu3N9nWHEBwaGbb7T2Oq9A=9EyR=Jtyqfq_cQ@mail.gmail.com
1 parent a3e859f commit 535c0c3

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

arch/x86/include/asm/asm.h

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,28 @@
4040

4141
/* Exception table entry */
4242
#ifdef __ASSEMBLY__
43-
# define _ASM_EXTABLE(from,to) \
44-
.pushsection "__ex_table","a" ; \
45-
_ASM_ALIGN ; \
46-
_ASM_PTR from , to ; \
43+
# define _ASM_EXTABLE(from,to) \
44+
.pushsection "__ex_table","a" ; \
45+
_ASM_ALIGN ; \
46+
_ASM_PTR from , to ; \
47+
.popsection
48+
49+
# define _ASM_EXTABLE_EX(from,to) \
50+
.pushsection "__ex_table","a" ; \
51+
_ASM_ALIGN ; \
52+
_ASM_PTR from , (to) - (from) ; \
4753
.popsection
4854
#else
49-
# define _ASM_EXTABLE(from,to) \
50-
" .pushsection \"__ex_table\",\"a\"\n" \
51-
_ASM_ALIGN "\n" \
52-
_ASM_PTR #from "," #to "\n" \
55+
# define _ASM_EXTABLE(from,to) \
56+
" .pushsection \"__ex_table\",\"a\"\n" \
57+
_ASM_ALIGN "\n" \
58+
_ASM_PTR #from "," #to "\n" \
59+
" .popsection\n"
60+
61+
# define _ASM_EXTABLE_EX(from,to) \
62+
" .pushsection \"__ex_table\",\"a\"\n" \
63+
_ASM_ALIGN "\n" \
64+
_ASM_PTR #from ",(" #to ")-(" #from ")\n" \
5365
" .popsection\n"
5466
#endif
5567

arch/x86/include/asm/uaccess.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ extern int __get_user_bad(void);
202202
asm volatile("1: movl %%eax,0(%1)\n" \
203203
"2: movl %%edx,4(%1)\n" \
204204
"3:\n" \
205-
_ASM_EXTABLE(1b, 2b - 1b) \
206-
_ASM_EXTABLE(2b, 3b - 2b) \
205+
_ASM_EXTABLE_EX(1b, 2b) \
206+
_ASM_EXTABLE_EX(2b, 3b) \
207207
: : "A" (x), "r" (addr))
208208

209209
#define __put_user_x8(x, ptr, __ret_pu) \
@@ -408,7 +408,7 @@ do { \
408408
#define __get_user_asm_ex(x, addr, itype, rtype, ltype) \
409409
asm volatile("1: mov"itype" %1,%"rtype"0\n" \
410410
"2:\n" \
411-
_ASM_EXTABLE(1b, 2b - 1b) \
411+
_ASM_EXTABLE_EX(1b, 2b) \
412412
: ltype(x) : "m" (__m(addr)))
413413

414414
#define __put_user_nocheck(x, ptr, size) \
@@ -450,7 +450,7 @@ struct __large_struct { unsigned long buf[100]; };
450450
#define __put_user_asm_ex(x, addr, itype, rtype, ltype) \
451451
asm volatile("1: mov"itype" %"rtype"0,%1\n" \
452452
"2:\n" \
453-
_ASM_EXTABLE(1b, 2b - 1b) \
453+
_ASM_EXTABLE_EX(1b, 2b) \
454454
: : ltype(x), "m" (__m(addr)))
455455

456456
/*

0 commit comments

Comments
 (0)