This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[Patch] aarch64: Fix tst-makecontext3 in ILP32 mode.
- From: Steve Ellcey <sellcey at cavium dot com>
- To: libc-alpha <libc-alpha at sourceware dot org>
- Date: Tue, 15 Aug 2017 11:09:15 -0700
- Subject: [Patch] aarch64: Fix tst-makecontext3 in ILP32 mode.
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Steve dot Ellcey at cavium dot com;
- Reply-to: sellcey at cavium dot com
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
This is an additional patch for ILP32 aarch64 support, it fixes a failure
with the tst-makecontext3 test in ILP32 mode. That ABI has not
been checked in yet but I wanted to submit this patch in order to share
it and see if there is any feedback. The basic problem is that makecontext
was using 'long int *' as the sp pointer type and that is 32 bytes in
ILP32 mode instead of 64 bytes. By using uint64_t instead we get 64
bytes for both ILP32 and LP64 modes and the makecontext test works in both
modes and there are no regressions.
Steve Ellcey
sellcey@cavium.com
2017-08-15 Steve Ellcey <sellcey@cavium.com>
* sysdeps/unix/sysv/linux/aarch64/makecontext.c (__makecontext):
Use pointer to uint64_t instead of long int for sp.
diff --git a/sysdeps/unix/sysv/linux/aarch64/makecontext.c b/sysdeps/unix/sysv/linux/aarch64/makecontext.c
index f510f48..8e52b5d 100644
--- a/sysdeps/unix/sysv/linux/aarch64/makecontext.c
+++ b/sysdeps/unix/sysv/linux/aarch64/makecontext.c
@@ -42,18 +42,18 @@ void
__makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
{
extern void __startcontext (void);
- unsigned long int *sp;
+ uint64_t *sp;
va_list ap;
int i;
- sp = (unsigned long int *)
+ sp = (uint64_t *)
((uintptr_t) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
/* Allocate stack arguments. */
sp -= argc < 8 ? 0 : argc - 8;
/* Keep the stack aligned. */
- sp = (unsigned long int *) (((uintptr_t) sp) & -16L);
+ sp = (uint64_t *) (((uintptr_t) sp) & -16L);
ucp->uc_mcontext.regs[19] = (uintptr_t) ucp->uc_link;
ucp->uc_mcontext.sp = (uintptr_t) sp;
@@ -66,7 +66,7 @@ __makecontext (ucontext_t *ucp, void (*func) (void), int argc, ...)
if (i < 8)
ucp->uc_mcontext.regs[i] = va_arg (ap, unsigned long int);
else
- sp[i - 8] = va_arg (ap, unsigned long int);
+ sp[i - 8] = va_arg (ap, uint64_t);
va_end (ap);
}