[v3,2/9] aarch64: Share code in syscall-cancel.h
diff mbox

Message ID 1401046909-25821-3-git-send-email-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson May 25, 2014, 7:41 p.m. UTC
From: Richard Henderson <rth@redhat.com>

Fold nocancel and error handling paths.
---
 .../unix/sysv/linux/aarch64/nptl/sysdep-cancel.h   | 28 +++++++++++-----------
 1 file changed, 14 insertions(+), 14 deletions(-)

Comments

Marcus Shawcroft May 29, 2014, 3:21 a.m. UTC | #1
On 25 May 2014 20:41, Richard Henderson <rth@twiddle.net> wrote:
> From: Richard Henderson <rth@redhat.com>

>  # undef PSEUDO
>  # define PSEUDO(name, syscall_name, args)                              \
>         .section ".text";                                               \
> -       .type   __##syscall_name##_nocancel,%function;                  \
> -       .globl  __##syscall_name##_nocancel;                            \
> -__##syscall_name##_nocancel:                                           \
> -       cfi_startproc;                                                  \
> +ENTRY (__##syscall_name##_nocancel);                                   \

This hunk simply switches to the use of ENTRY(), which looks OK.

> +.Lpseudo_nocancel:                                                     \
>         DO_CALL (syscall_name, args);                                   \
> +.Lpseudo_finish:                                                       \
>         cmn     x0, 4095;                                               \
>         b.cs    .Lsyscall_error;                                        \
> -       PSEUDO_RET;                                                     \
> -       cfi_endproc;                                                    \

I think there is a 'ret' missing here ?

/Marcus
Richard Henderson May 29, 2014, 3:55 a.m. UTC | #2
On 05/28/2014 08:21 PM, Marcus Shawcroft wrote:
> On 25 May 2014 20:41, Richard Henderson <rth@twiddle.net> wrote:
>> From: Richard Henderson <rth@redhat.com>
> 
>>  # undef PSEUDO
>>  # define PSEUDO(name, syscall_name, args)                              \
>>         .section ".text";                                               \
>> -       .type   __##syscall_name##_nocancel,%function;                  \
>> -       .globl  __##syscall_name##_nocancel;                            \
>> -__##syscall_name##_nocancel:                                           \
>> -       cfi_startproc;                                                  \
>> +ENTRY (__##syscall_name##_nocancel);                                   \
> 
> This hunk simply switches to the use of ENTRY(), which looks OK.
> 
>> +.Lpseudo_nocancel:                                                     \
>>         DO_CALL (syscall_name, args);                                   \
>> +.Lpseudo_finish:                                                       \
>>         cmn     x0, 4095;                                               \
>>         b.cs    .Lsyscall_error;                                        \
>> -       PSEUDO_RET;                                                     \
>> -       cfi_endproc;                                                    \
> 
> I think there is a 'ret' missing here ?

That happens in the main assembly file, in the form of

  PSEUDO(xxx)
	ret		<- here
  PSEUDO_END(xxx)

The .subsection and .previous in that macro let the main body above appear in
the middle in the proper place.


r~
Marcus Shawcroft May 29, 2014, 4:12 a.m. UTC | #3
>>> +.Lpseudo_nocancel:                                                     \
>>>         DO_CALL (syscall_name, args);                                   \
>>> +.Lpseudo_finish:                                                       \
>>>         cmn     x0, 4095;                                               \
>>>         b.cs    .Lsyscall_error;                                        \
>>> -       PSEUDO_RET;                                                     \
>>> -       cfi_endproc;                                                    \
>>
>> I think there is a 'ret' missing here ?
>
> That happens in the main assembly file, in the form of
>
>   PSEUDO(xxx)
>         ret             <- here
>   PSEUDO_END(xxx)

Understood. OK.
/Marcus

Patch
diff mbox

diff --git a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
index 26d4c0e..41502de 100644
--- a/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
+++ b/sysdeps/unix/sysv/linux/aarch64/nptl/sysdep-cancel.h
@@ -27,24 +27,17 @@ 
 # undef PSEUDO
 # define PSEUDO(name, syscall_name, args)				\
 	.section ".text";						\
-	.type	__##syscall_name##_nocancel,%function;			\
-	.globl	__##syscall_name##_nocancel;				\
-__##syscall_name##_nocancel:						\
-	cfi_startproc;							\
+ENTRY (__##syscall_name##_nocancel);					\
+.Lpseudo_nocancel:							\
 	DO_CALL (syscall_name, args);					\
+.Lpseudo_finish:							\
 	cmn	x0, 4095;						\
 	b.cs	.Lsyscall_error;					\
-	PSEUDO_RET;							\
-	cfi_endproc;							\
+	.subsection 2;							\
 	.size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
 ENTRY (name);								\
 	SINGLE_THREAD_P;						\
-	bne .Lpseudo_cancel;						\
-	DO_CALL (syscall_name, 0);					\
-	cmn x0, 4095;							\
-	b.cs .Lsyscall_error;						\
-	PSEUDO_RET;							\
-.Lpseudo_cancel:							\
+	beq .Lpseudo_nocancel;						\
 	DOCARGS_##args;	/* save syscall args etc. around CENABLE.  */	\
 	CENABLE;							\
 	mov	x16, x0;	/* put mask in safe place.  */		\
@@ -60,8 +53,15 @@  ENTRY (name);								\
 	ldr	x30, [sp], 16;						\
 	cfi_adjust_cfa_offset (-16);					\
 	cfi_restore (x30);						\
-	cmn	x0, 4095;						\
-	b.cs	.Lsyscall_error;
+	b	.Lpseudo_finish;					\
+	cfi_endproc;							\
+	.size	name, .-name;						\
+	.previous
+
+# undef PSEUDO_END
+# define PSEUDO_END(name)						\
+	SYSCALL_ERROR_HANDLER;						\
+	cfi_endproc
 
 # define DOCARGS_0							\
 	str x30, [sp, -16]!;						\