Skip to content

Commit 11f925e

Browse files
committed
fix build on aarch64
``` $ make gcc -std=gnu99 -D_DEFAULT_SOURCE -fPIC -DPIC -ggdb3 -O2 -Wall -Iinclude -Iarch/aarch64 -Iarch/common -Iarch/common/include -DFORCE_SOFT_FLOAT -DEXPORT_UNPREFIXED -c -o arch/aarch64/makecontext.o arch/aarch64/makecontext.c arch/aarch64/makecontext.c: In function ‘libucontext_makecontext’: arch/aarch64/makecontext.c:48:14: error: assignment to ‘long unsigned int *’ from incompatible pointer type ‘long long unsigned int *’ [-Wincompatible-pointer-types] 48 | regp = &(ucp->uc_mcontext.regs[0]); | ^ make: *** [Makefile:155: arch/aarch64/makecontext.o] Error 1 ``` this both fixes the build error and fixes the rest of mcontext_t to be compatible with glibc built on top of the work done in kaniini#59
1 parent 4b0b0c0 commit 11f925e

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

arch/aarch64/include/libucontext/bits.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ typedef struct {
1111
} libucontext_fpregset_t;
1212

1313
typedef struct sigcontext {
14-
unsigned long fault_address;
15-
unsigned long regs[31];
16-
unsigned long sp, pc, pstate;
17-
long double __reserved[256];
14+
unsigned long long fault_address;
15+
unsigned long long regs[31];
16+
unsigned long long sp, pc, pstate;
17+
unsigned char __reserved[4096] __attribute__((aligned(16)));
1818
} libucontext_mcontext_t;
1919

2020
typedef struct {

arch/aarch64/makecontext.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ _Static_assert(offsetof(libucontext_ucontext_t, uc_mcontext.pstate) == PSTATE_OF
2929
void
3030
libucontext_makecontext(libucontext_ucontext_t *ucp, void (*func)(void), int argc, ...)
3131
{
32-
unsigned long *sp;
33-
unsigned long *regp;
32+
unsigned long long *sp;
33+
unsigned long long *regp;
3434
va_list va;
3535
int i;
3636

37-
sp = (unsigned long *) ((uintptr_t) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
37+
sp = (unsigned long long *) ((uintptr_t) ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
3838
sp -= argc < 8 ? 0 : argc - 8;
39-
sp = (unsigned long *) (((uintptr_t) sp & -16L));
39+
sp = (unsigned long long *) (((uintptr_t) sp & -16L));
4040

4141
ucp->uc_mcontext.sp = (uintptr_t) sp;
4242
ucp->uc_mcontext.pc = (uintptr_t) func;
@@ -48,10 +48,10 @@ libucontext_makecontext(libucontext_ucontext_t *ucp, void (*func)(void), int arg
4848
regp = &(ucp->uc_mcontext.regs[0]);
4949

5050
for (i = 0; (i < argc && i < 8); i++)
51-
*regp++ = va_arg (va, unsigned long);
51+
*regp++ = va_arg (va, unsigned long long);
5252

5353
for (; i < argc; i++)
54-
*sp++ = va_arg (va, unsigned long);
54+
*sp++ = va_arg (va, unsigned long long);
5555

5656
va_end(va);
5757
}

0 commit comments

Comments
 (0)