From 41b3e8b9893a8561af7e85ca98444bc284b4013d Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sun, 19 Jan 2020 22:39:22 -0500 Subject: libthread: use consistent stack calculation code in makecontext Also reduce duplication: makecontext is per-arch not per-os-arch. May fix #353. --- src/libthread/Linux-arm-swapcontext.c | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 src/libthread/Linux-arm-swapcontext.c (limited to 'src/libthread/Linux-arm-swapcontext.c') diff --git a/src/libthread/Linux-arm-swapcontext.c b/src/libthread/Linux-arm-swapcontext.c deleted file mode 100644 index fc0dfdda..00000000 --- a/src/libthread/Linux-arm-swapcontext.c +++ /dev/null @@ -1,24 +0,0 @@ -#include "threadimpl.h" - -void -makecontext(ucontext_t *uc, void (*fn)(void), int argc, ...) -{ - int i, *sp; - va_list arg; - - sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4; - va_start(arg, argc); - for(i=0; i<4 && iuc_mcontext.arm_r0)[i] = va_arg(arg, uint); - va_end(arg); - uc->uc_mcontext.arm_sp = (uint)sp; - uc->uc_mcontext.arm_lr = (uint)fn; -} - -int -swapcontext(ucontext_t *oucp, const ucontext_t *ucp) -{ - if(getcontext(oucp) == 0) - setcontext(ucp); - return 0; -} -- cgit v1.2.3