Re: git: 47ff149afaea - main - Move arm64 EENTRY uses before ENTRY

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Fri, 31 Mar 2023 16:00:45 UTC
On 31 Mar 2023, at 16:56, Andrew Turner <andrew@FreeBSD.org> wrote:
> 
> The branch main has been updated by andrew:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=47ff149afaea6a403b8d044e26673bc3cd605fe4
> 
> commit 47ff149afaea6a403b8d044e26673bc3cd605fe4
> Author:     Andrew Turner <andrew@FreeBSD.org>
> AuthorDate: 2023-03-31 12:34:51 +0000
> Commit:     Andrew Turner <andrew@FreeBSD.org>
> CommitDate: 2023-03-31 15:45:31 +0000
> 
>    Move arm64 EENTRY uses before ENTRY
> 
>    The ENTRY macro adds instructions to the start of a function but not
>    EENTRY. To use these instructions in both functions move the EENTRY
>    use before the ENTRY use.

This doesn’t work. ENTRY is what has the .text and .align 2, so this
could have the EENTRY symbols be unaligned or in the wrong section. In
this specific case it happens to work, but in general this is broken
and so your original problem needs fixing another way. Or I guess you
could make both ENTRY and EENTRY include the .text and .align 2 (but on
other architectures with variable-length instructions, or even on arm64
were you to ever want to over-align functions, this would still be
insufficient).

Jess

>    Sponsored by:   Arm Ltd
> ---
> sys/arm64/arm64/memcpy.S  | 4 ++--
> sys/arm64/arm64/support.S | 8 ++++----
> 2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/sys/arm64/arm64/memcpy.S b/sys/arm64/arm64/memcpy.S
> index d5fbfa64e0fa..b394d6c1d30a 100644
> --- a/sys/arm64/arm64/memcpy.S
> +++ b/sys/arm64/arm64/memcpy.S
> @@ -55,8 +55,8 @@
>    The loop tail is handled by always copying 64 bytes from the end.
> */
> 
> -ENTRY(memcpy)
> EENTRY(memmove)
> +ENTRY(memcpy)
> 	add	srcend, src, count
> 	add	dstend, dstin, count
> 	cmp	count, 128
> @@ -237,6 +237,6 @@ L(copy64_from_start):
> 	stp	B_l, B_h, [dstin, 16]
> 	stp	C_l, C_h, [dstin]
> 	ret
> -EEND(memmove)
> END(memcpy)
> +EEND(memmove)
> 
> diff --git a/sys/arm64/arm64/support.S b/sys/arm64/arm64/support.S
> index 885af5676159..28ac1d553fbc 100644
> --- a/sys/arm64/arm64/support.S
> +++ b/sys/arm64/arm64/support.S
> @@ -175,15 +175,15 @@ END(fueword32)
>  * long fueword(volatile const void *, int64_t *)
>  * int64_t fueword64(volatile const void *, int64_t *)
>  */
> -ENTRY(fueword)
> EENTRY(fueword64)
> +ENTRY(fueword)
> 	check_user_access 0, (VM_MAXUSER_ADDRESS-7), fsu_fault_nopcb
> 	fsudata	ldtr, x0, 0
> 	str	x0, [x1]		/* Save the data in kernel space */
> 	mov	x0, #0			/* Success */
> 	ret				/* Return */
> -EEND(fueword64)
> END(fueword)
> +EEND(fueword64)
> 
> /*
>  * int subyte(volatile void *, int)
> @@ -218,14 +218,14 @@ END(suword32)
> /*
>  * int suword(volatile void *, long)
>  */
> -ENTRY(suword)
> EENTRY(suword64)
> +ENTRY(suword)
> 	check_user_access 0, (VM_MAXUSER_ADDRESS-7), fsu_fault_nopcb
> 	fsudata	sttr, x1, 0
> 	mov	x0, #0			/* Success */
> 	ret				/* Return */
> -EEND(suword64)
> END(suword)
> +EEND(suword64)
> 
> ENTRY(setjmp)
> 	/* Store the stack pointer */