Commit 00e065ea authored by Jan Beulich's avatar Jan Beulich Committed by Andi Kleen

[PATCH] i386: Add dwarf2 annotations to *_user and checksum functions

Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent 37550907
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#include <linux/linkage.h>
#include <asm/dwarf2.h>
#include <asm/errno.h> #include <asm/errno.h>
/* /*
...@@ -36,8 +38,6 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) ...@@ -36,8 +38,6 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
*/ */
.text .text
.align 4
.globl csum_partial
#ifndef CONFIG_X86_USE_PPRO_CHECKSUM #ifndef CONFIG_X86_USE_PPRO_CHECKSUM
...@@ -48,9 +48,14 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) ...@@ -48,9 +48,14 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
* Fortunately, it is easy to convert 2-byte alignment to 4-byte * Fortunately, it is easy to convert 2-byte alignment to 4-byte
* alignment for the unrolled loop. * alignment for the unrolled loop.
*/ */
csum_partial: ENTRY(csum_partial)
CFI_STARTPROC
pushl %esi pushl %esi
CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET esi, 0
pushl %ebx pushl %ebx
CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET ebx, 0
movl 20(%esp),%eax # Function arg: unsigned int sum movl 20(%esp),%eax # Function arg: unsigned int sum
movl 16(%esp),%ecx # Function arg: int len movl 16(%esp),%ecx # Function arg: int len
movl 12(%esp),%esi # Function arg: unsigned char *buff movl 12(%esp),%esi # Function arg: unsigned char *buff
...@@ -128,16 +133,27 @@ csum_partial: ...@@ -128,16 +133,27 @@ csum_partial:
roll $8, %eax roll $8, %eax
8: 8:
popl %ebx popl %ebx
CFI_ADJUST_CFA_OFFSET -4
CFI_RESTORE ebx
popl %esi popl %esi
CFI_ADJUST_CFA_OFFSET -4
CFI_RESTORE esi
ret ret
CFI_ENDPROC
ENDPROC(csum_partial)
#else #else
/* Version for PentiumII/PPro */ /* Version for PentiumII/PPro */
csum_partial: ENTRY(csum_partial)
CFI_STARTPROC
pushl %esi pushl %esi
CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET esi, 0
pushl %ebx pushl %ebx
CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET ebx, 0
movl 20(%esp),%eax # Function arg: unsigned int sum movl 20(%esp),%eax # Function arg: unsigned int sum
movl 16(%esp),%ecx # Function arg: int len movl 16(%esp),%ecx # Function arg: int len
movl 12(%esp),%esi # Function arg: const unsigned char *buf movl 12(%esp),%esi # Function arg: const unsigned char *buf
...@@ -245,8 +261,14 @@ csum_partial: ...@@ -245,8 +261,14 @@ csum_partial:
roll $8, %eax roll $8, %eax
90: 90:
popl %ebx popl %ebx
CFI_ADJUST_CFA_OFFSET -4
CFI_RESTORE ebx
popl %esi popl %esi
CFI_ADJUST_CFA_OFFSET -4
CFI_RESTORE esi
ret ret
CFI_ENDPROC
ENDPROC(csum_partial)
#endif #endif
...@@ -278,19 +300,24 @@ unsigned int csum_partial_copy_generic (const char *src, char *dst, ...@@ -278,19 +300,24 @@ unsigned int csum_partial_copy_generic (const char *src, char *dst,
.long 9999b, 6002f ; \ .long 9999b, 6002f ; \
.previous .previous
.align 4
.globl csum_partial_copy_generic
#ifndef CONFIG_X86_USE_PPRO_CHECKSUM #ifndef CONFIG_X86_USE_PPRO_CHECKSUM
#define ARGBASE 16 #define ARGBASE 16
#define FP 12 #define FP 12
csum_partial_copy_generic: ENTRY(csum_partial_copy_generic)
CFI_STARTPROC
subl $4,%esp subl $4,%esp
CFI_ADJUST_CFA_OFFSET 4
pushl %edi pushl %edi
CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET edi, 0
pushl %esi pushl %esi
CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET esi, 0
pushl %ebx pushl %ebx
CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET ebx, 0
movl ARGBASE+16(%esp),%eax # sum movl ARGBASE+16(%esp),%eax # sum
movl ARGBASE+12(%esp),%ecx # len movl ARGBASE+12(%esp),%ecx # len
movl ARGBASE+4(%esp),%esi # src movl ARGBASE+4(%esp),%esi # src
...@@ -400,10 +427,19 @@ DST( movb %cl, (%edi) ) ...@@ -400,10 +427,19 @@ DST( movb %cl, (%edi) )
.previous .previous
popl %ebx popl %ebx
CFI_ADJUST_CFA_OFFSET -4
CFI_RESTORE ebx
popl %esi popl %esi
CFI_ADJUST_CFA_OFFSET -4
CFI_RESTORE esi
popl %edi popl %edi
CFI_ADJUST_CFA_OFFSET -4
CFI_RESTORE edi
popl %ecx # equivalent to addl $4,%esp popl %ecx # equivalent to addl $4,%esp
CFI_ADJUST_CFA_OFFSET -4
ret ret
CFI_ENDPROC
ENDPROC(csum_partial_copy_generic)
#else #else
...@@ -421,10 +457,17 @@ DST( movb %cl, (%edi) ) ...@@ -421,10 +457,17 @@ DST( movb %cl, (%edi) )
#define ARGBASE 12 #define ARGBASE 12
csum_partial_copy_generic: ENTRY(csum_partial_copy_generic)
CFI_STARTPROC
pushl %ebx pushl %ebx
CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET ebx, 0
pushl %edi pushl %edi
CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET edi, 0
pushl %esi pushl %esi
CFI_ADJUST_CFA_OFFSET 4
CFI_REL_OFFSET esi, 0
movl ARGBASE+4(%esp),%esi #src movl ARGBASE+4(%esp),%esi #src
movl ARGBASE+8(%esp),%edi #dst movl ARGBASE+8(%esp),%edi #dst
movl ARGBASE+12(%esp),%ecx #len movl ARGBASE+12(%esp),%ecx #len
...@@ -485,9 +528,17 @@ DST( movb %dl, (%edi) ) ...@@ -485,9 +528,17 @@ DST( movb %dl, (%edi) )
.previous .previous
popl %esi popl %esi
CFI_ADJUST_CFA_OFFSET -4
CFI_RESTORE esi
popl %edi popl %edi
CFI_ADJUST_CFA_OFFSET -4
CFI_RESTORE edi
popl %ebx popl %ebx
CFI_ADJUST_CFA_OFFSET -4
CFI_RESTORE ebx
ret ret
CFI_ENDPROC
ENDPROC(csum_partial_copy_generic)
#undef ROUND #undef ROUND
#undef ROUND1 #undef ROUND1
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
* return an error value in addition to the "real" * return an error value in addition to the "real"
* return value. * return value.
*/ */
#include <linux/linkage.h>
#include <asm/dwarf2.h>
#include <asm/thread_info.h> #include <asm/thread_info.h>
...@@ -24,19 +26,19 @@ ...@@ -24,19 +26,19 @@
*/ */
.text .text
.align 4 ENTRY(__get_user_1)
.globl __get_user_1 CFI_STARTPROC
__get_user_1:
GET_THREAD_INFO(%edx) GET_THREAD_INFO(%edx)
cmpl TI_addr_limit(%edx),%eax cmpl TI_addr_limit(%edx),%eax
jae bad_get_user jae bad_get_user
1: movzbl (%eax),%edx 1: movzbl (%eax),%edx
xorl %eax,%eax xorl %eax,%eax
ret ret
CFI_ENDPROC
ENDPROC(__get_user_1)
.align 4 ENTRY(__get_user_2)
.globl __get_user_2 CFI_STARTPROC
__get_user_2:
addl $1,%eax addl $1,%eax
jc bad_get_user jc bad_get_user
GET_THREAD_INFO(%edx) GET_THREAD_INFO(%edx)
...@@ -45,10 +47,11 @@ __get_user_2: ...@@ -45,10 +47,11 @@ __get_user_2:
2: movzwl -1(%eax),%edx 2: movzwl -1(%eax),%edx
xorl %eax,%eax xorl %eax,%eax
ret ret
CFI_ENDPROC
ENDPROC(__get_user_2)
.align 4 ENTRY(__get_user_4)
.globl __get_user_4 CFI_STARTPROC
__get_user_4:
addl $3,%eax addl $3,%eax
jc bad_get_user jc bad_get_user
GET_THREAD_INFO(%edx) GET_THREAD_INFO(%edx)
...@@ -57,11 +60,16 @@ __get_user_4: ...@@ -57,11 +60,16 @@ __get_user_4:
3: movl -3(%eax),%edx 3: movl -3(%eax),%edx
xorl %eax,%eax xorl %eax,%eax
ret ret
CFI_ENDPROC
ENDPROC(__get_user_4)
bad_get_user: bad_get_user:
CFI_STARTPROC
xorl %edx,%edx xorl %edx,%edx
movl $-14,%eax movl $-14,%eax
ret ret
CFI_ENDPROC
END(bad_get_user)
.section __ex_table,"a" .section __ex_table,"a"
.long 1b,bad_get_user .long 1b,bad_get_user
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
* return an error value in addition to the "real" * return an error value in addition to the "real"
* return value. * return value.
*/ */
#include <linux/linkage.h>
#include <asm/dwarf2.h>
#include <asm/thread_info.h> #include <asm/thread_info.h>
...@@ -23,23 +25,28 @@ ...@@ -23,23 +25,28 @@
* as they get called from within inline assembly. * as they get called from within inline assembly.
*/ */
#define ENTER pushl %ebx ; GET_THREAD_INFO(%ebx) #define ENTER CFI_STARTPROC ; \
#define EXIT popl %ebx ; ret pushl %ebx ; \
CFI_ADJUST_CFA_OFFSET 4 ; \
CFI_REL_OFFSET ebx, 0 ; \
GET_THREAD_INFO(%ebx)
#define EXIT popl %ebx ; \
CFI_ADJUST_CFA_OFFSET -4 ; \
CFI_RESTORE ebx ; \
ret ; \
CFI_ENDPROC
.text .text
.align 4 ENTRY(__put_user_1)
.globl __put_user_1
__put_user_1:
ENTER ENTER
cmpl TI_addr_limit(%ebx),%ecx cmpl TI_addr_limit(%ebx),%ecx
jae bad_put_user jae bad_put_user
1: movb %al,(%ecx) 1: movb %al,(%ecx)
xorl %eax,%eax xorl %eax,%eax
EXIT EXIT
ENDPROC(__put_user_1)
.align 4 ENTRY(__put_user_2)
.globl __put_user_2
__put_user_2:
ENTER ENTER
movl TI_addr_limit(%ebx),%ebx movl TI_addr_limit(%ebx),%ebx
subl $1,%ebx subl $1,%ebx
...@@ -48,10 +55,9 @@ __put_user_2: ...@@ -48,10 +55,9 @@ __put_user_2:
2: movw %ax,(%ecx) 2: movw %ax,(%ecx)
xorl %eax,%eax xorl %eax,%eax
EXIT EXIT
ENDPROC(__put_user_2)
.align 4 ENTRY(__put_user_4)
.globl __put_user_4
__put_user_4:
ENTER ENTER
movl TI_addr_limit(%ebx),%ebx movl TI_addr_limit(%ebx),%ebx
subl $3,%ebx subl $3,%ebx
...@@ -60,10 +66,9 @@ __put_user_4: ...@@ -60,10 +66,9 @@ __put_user_4:
3: movl %eax,(%ecx) 3: movl %eax,(%ecx)
xorl %eax,%eax xorl %eax,%eax
EXIT EXIT
ENDPROC(__put_user_4)
.align 4 ENTRY(__put_user_8)
.globl __put_user_8
__put_user_8:
ENTER ENTER
movl TI_addr_limit(%ebx),%ebx movl TI_addr_limit(%ebx),%ebx
subl $7,%ebx subl $7,%ebx
...@@ -73,10 +78,16 @@ __put_user_8: ...@@ -73,10 +78,16 @@ __put_user_8:
5: movl %edx,4(%ecx) 5: movl %edx,4(%ecx)
xorl %eax,%eax xorl %eax,%eax
EXIT EXIT
ENDPROC(__put_user_8)
bad_put_user: bad_put_user:
CFI_STARTPROC simple
CFI_DEF_CFA esp, 2*4
CFI_OFFSET eip, -1*4
CFI_OFFSET ebx, -2*4
movl $-14,%eax movl $-14,%eax
EXIT EXIT
END(bad_put_user)
.section __ex_table,"a" .section __ex_table,"a"
.long 1b,bad_put_user .long 1b,bad_put_user
......
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