Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Patch for ARM builds, Issue 226.

  • Loading branch information...
commit bbddc60f4e70db1fee50b1b4aa45554536c44381 1 parent 10badbd
@limburgher limburgher authored
View
12 libs/coroutine/source/context.c
@@ -100,11 +100,15 @@ makecontext(ucontext_t *uc, void (*fn)(void), int argc, ...)
sp = (int*)uc->uc_stack.ss_sp+uc->uc_stack.ss_size/4;
va_start(arg, argc);
- for(i=0; i<4 && i<argc; i++)
- uc->uc_mcontext.gregs[i] = va_arg(arg, uint);
+
+ if(argc-- > 0) uc->uc_mcontext.arm_r0 = va_arg(arg, uint);
+ if(argc-- > 0) uc->uc_mcontext.arm_r1 = va_arg(arg, uint);
+ if(argc-- > 0) uc->uc_mcontext.arm_r2 = va_arg(arg, uint);
+ if(argc-- > 0) uc->uc_mcontext.arm_r3 = va_arg(arg, uint);
+
va_end(arg);
- uc->uc_mcontext.gregs[13] = (uint)sp;
- uc->uc_mcontext.gregs[14] = (uint)fn;
+ uc->uc_mcontext.arm_sp = (uint)sp;
+ uc->uc_mcontext.arm_lr = (uint)fn;
}
#endif
View
4 libs/coroutine/source/taskimpl.h
@@ -143,8 +143,8 @@ extern pid_t rfork_thread(int, void*, int(*)(void*), void*);
#if defined(__arm__)
int getmcontext(mcontext_t*);
void setmcontext(const mcontext_t*);
-#define setcontext(u) setmcontext(&(u)->uc_mcontext)
-#define getcontext(u) getmcontext(&(u)->uc_mcontext)
+#define setcontext(u) setmcontext((void *)&((u)->uc_mcontext.arm_r0))
+#define getcontext(u) getmcontext((void *)&((u)->uc_mcontext.arm_r0))
#endif
/*
Please sign in to comment.
Something went wrong with that request. Please try again.