Patchwork [12/29,AARCH64] Use PTR_REG/PTR_SIZE/PTR_SIZE_LOG in dl-tlsesc.S

login
register
mail settings
Submitter Andrew Pinski
Date Oct. 27, 2014, 7:59 a.m.
Message ID <1414396793-9005-13-git-send-email-apinski@cavium.com>
Download mbox | patch
Permalink /patch/3409/
State New
Headers show

Comments

Andrew Pinski - Oct. 27, 2014, 7:59 a.m.
This converts dl-tlsdesc.S code over to use the new macros which allows for
sharing between ILP32 and LP64 code.

* sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return): Use PTR_REG.
(_dl_tlsdesc_undefweak): Use PTR_REG, PTR_SIZE.
(_dl_tlsdesc_dynamic): Likewise.
(_dl_tlsdesc_resolve_rela): Likewise.
(_dl_tlsdesc_resolve_hold): Likewise.
---
 sysdeps/aarch64/dl-tlsdesc.S |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)
Will Newton - Nov. 18, 2014, 12:23 p.m.
On 27 October 2014 07:59, Andrew Pinski <apinski@cavium.com> wrote:
> This converts dl-tlsdesc.S code over to use the new macros which allows for
> sharing between ILP32 and LP64 code.
>
> * sysdeps/aarch64/dl-tlsdesc.S (_dl_tlsdesc_return): Use PTR_REG.
> (_dl_tlsdesc_undefweak): Use PTR_REG, PTR_SIZE.
> (_dl_tlsdesc_dynamic): Likewise.
> (_dl_tlsdesc_resolve_rela): Likewise.
> (_dl_tlsdesc_resolve_hold): Likewise.
> ---
>  sysdeps/aarch64/dl-tlsdesc.S |   36 ++++++++++++++++++------------------
>  1 files changed, 18 insertions(+), 18 deletions(-)

This looks ok, although as with all these patches I would want to see
the test results for AArch64 and AArch64 ILP32 before they are
committed.

> diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
> index ded5471..6004115 100644
> --- a/sysdeps/aarch64/dl-tlsdesc.S
> +++ b/sysdeps/aarch64/dl-tlsdesc.S
> @@ -74,7 +74,7 @@
>         cfi_startproc
>         .align 2
>  _dl_tlsdesc_return:
> -       ldr     x0, [x0, #8]
> +       ldr     PTR_REG (0), [x0, #PTR_SIZE]
>         RET
>         cfi_endproc
>         .size   _dl_tlsdesc_return, .-_dl_tlsdesc_return
> @@ -96,9 +96,9 @@ _dl_tlsdesc_return:
>  _dl_tlsdesc_undefweak:
>         str     x1, [sp, #-16]!
>         cfi_adjust_cfa_offset(16)
> -       ldr     x0, [x0, #8]
> +       ldr     PTR_REG (0), [x0, #PTR_SIZE]
>         mrs     x1, tpidr_el0
> -       sub     x0, x0, x1
> +       sub     PTR_REG (0), PTR_REG (0), PTR_REG (1)
>         ldr     x1, [sp], #16
>         cfi_adjust_cfa_offset(16)
>         RET
> @@ -152,20 +152,20 @@ _dl_tlsdesc_dynamic:
>         stp     x3,  x4, [sp, #32+16*1]
>
>         mrs     x4, tpidr_el0
> -       ldr     x1, [x0,#8]
> -       ldr     x0, [x4]
> -       ldr     x3, [x1,#16]
> -       ldr     x2, [x0]
> -       cmp     x3, x2
> +       ldr     PTR_REG (1), [x0,#PTR_SIZE]
> +       ldr     PTR_REG (0), [x4]
> +       ldr     PTR_REG (3), [x1,#(PTR_SIZE * 2)]
> +       ldr     PTR_REG (2), [x0]
> +       cmp     PTR_REG (3), PTR_REG (2)
>         b.hi    2f
> -       ldr     x2, [x1]
> -       add     x0, x0, x2, lsl #4
> -       ldr     x0, [x0]
> +       ldr     PTR_REG (2), [x1]
> +       add     PTR_REG (0), PTR_REG (0), PTR_REG (2), lsl #(PTR_LOG_SIZE + 1)
> +       ldr     PTR_REG (0), [x0]
>         cmn     x0, #0x1
>         b.eq    2f
> -       ldr     x1, [x1,#8]
> -       add     x0, x0, x1
> -       sub     x0, x0, x4
> +       ldr     PTR_REG (1), [x1,#(PTR_SIZE * 2)]
> +       add     PTR_REG (0), PTR_REG (0), PTR_REG (1)
> +       sub     PTR_REG (0), PTR_REG (0), PTR_REG (4)
>  1:
>         ldp      x1,  x2, [sp, #32+16*0]
>         ldp      x3,  x4, [sp, #32+16*1]
> @@ -196,7 +196,7 @@ _dl_tlsdesc_dynamic:
>         bl      __tls_get_addr
>
>         mrs     x1, tpidr_el0
> -       sub     x0, x0, x1
> +       sub     PTR_REG (0), PTR_REG (0), PTR_REG (1)
>
>         RESTORE_Q_REGISTERS
>
> @@ -242,13 +242,13 @@ _dl_tlsdesc_resolve_rela:
>
>         SAVE_Q_REGISTERS
>
> -       ldr     x1, [x3, #8]
> +       ldr     PTR_REG (1), [x3, #PTR_SIZE]
>         bl      _dl_tlsdesc_resolve_rela_fixup
>
>         RESTORE_Q_REGISTERS
>
>         ldr     x0, [sp, #32+16*8]
> -       ldr     x1, [x0]
> +       ldr     PTR_REG (1), [x0]
>         blr     x1
>
>         ldp      x1,  x4, [sp, #32+16*0]
> @@ -309,7 +309,7 @@ _dl_tlsdesc_resolve_hold:
>         RESTORE_Q_REGISTERS
>
>         ldr     x0, [sp, #32+16*9]
> -       ldr     x1, [x0]
> +       ldr     PTR_REG (1), [x0]
>         blr     x1
>
>         ldp      x1,  x2, [sp, #32+16*0]
> --
> 1.7.2.5
>

Patch

diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S
index ded5471..6004115 100644
--- a/sysdeps/aarch64/dl-tlsdesc.S
+++ b/sysdeps/aarch64/dl-tlsdesc.S
@@ -74,7 +74,7 @@ 
 	cfi_startproc
 	.align 2
 _dl_tlsdesc_return:
-	ldr	x0, [x0, #8]
+	ldr	PTR_REG (0), [x0, #PTR_SIZE]
 	RET
 	cfi_endproc
 	.size	_dl_tlsdesc_return, .-_dl_tlsdesc_return
@@ -96,9 +96,9 @@  _dl_tlsdesc_return:
 _dl_tlsdesc_undefweak:
 	str	x1, [sp, #-16]!
 	cfi_adjust_cfa_offset(16)
-	ldr	x0, [x0, #8]
+	ldr	PTR_REG (0), [x0, #PTR_SIZE]
 	mrs	x1, tpidr_el0
-	sub	x0, x0, x1
+	sub	PTR_REG (0), PTR_REG (0), PTR_REG (1)
 	ldr	x1, [sp], #16
 	cfi_adjust_cfa_offset(16)
 	RET
@@ -152,20 +152,20 @@  _dl_tlsdesc_dynamic:
 	stp	x3,  x4, [sp, #32+16*1]
 
 	mrs	x4, tpidr_el0
-	ldr	x1, [x0,#8]
-	ldr	x0, [x4]
-	ldr	x3, [x1,#16]
-	ldr	x2, [x0]
-	cmp	x3, x2
+	ldr	PTR_REG (1), [x0,#PTR_SIZE]
+	ldr	PTR_REG (0), [x4]
+	ldr	PTR_REG (3), [x1,#(PTR_SIZE * 2)]
+	ldr	PTR_REG (2), [x0]
+	cmp	PTR_REG (3), PTR_REG (2)
 	b.hi	2f
-	ldr	x2, [x1]
-	add	x0, x0, x2, lsl #4
-	ldr	x0, [x0]
+	ldr	PTR_REG (2), [x1]
+	add	PTR_REG (0), PTR_REG (0), PTR_REG (2), lsl #(PTR_LOG_SIZE + 1)
+	ldr	PTR_REG (0), [x0]
 	cmn	x0, #0x1
 	b.eq	2f
-	ldr	x1, [x1,#8]
-	add	x0, x0, x1
-	sub	x0, x0, x4
+	ldr	PTR_REG (1), [x1,#(PTR_SIZE * 2)]
+	add	PTR_REG (0), PTR_REG (0), PTR_REG (1)
+	sub	PTR_REG (0), PTR_REG (0), PTR_REG (4)
 1:
 	ldp	 x1,  x2, [sp, #32+16*0]
 	ldp	 x3,  x4, [sp, #32+16*1]
@@ -196,7 +196,7 @@  _dl_tlsdesc_dynamic:
 	bl	__tls_get_addr
 
 	mrs	x1, tpidr_el0
-	sub	x0, x0, x1
+	sub	PTR_REG (0), PTR_REG (0), PTR_REG (1)
 
 	RESTORE_Q_REGISTERS
 
@@ -242,13 +242,13 @@  _dl_tlsdesc_resolve_rela:
 
 	SAVE_Q_REGISTERS
 
-	ldr	x1, [x3, #8]
+	ldr	PTR_REG (1), [x3, #PTR_SIZE]
 	bl	_dl_tlsdesc_resolve_rela_fixup
 
 	RESTORE_Q_REGISTERS
 
 	ldr	x0, [sp, #32+16*8]
-	ldr	x1, [x0]
+	ldr	PTR_REG (1), [x0]
 	blr	x1
 
 	ldp	 x1,  x4, [sp, #32+16*0]
@@ -309,7 +309,7 @@  _dl_tlsdesc_resolve_hold:
 	RESTORE_Q_REGISTERS
 
 	ldr	x0, [sp, #32+16*9]
-	ldr	x1, [x0]
+	ldr	PTR_REG (1), [x0]
 	blr	x1
 
 	ldp	 x1,  x2, [sp, #32+16*0]