Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Patch for ARM builds #228

Merged
merged 1 commit into from

3 participants

@limburgher

This is based on my Fedora patch, and works on Fedora on ARM.

@gatesphere

Works on Raspian Wheezy armhf.

Just realized that this could (probably will) break builds on other architectures.

@limburgher

Didn't break the builds for x86_64 or i386.

@gatesphere

Wow, never mind, I'm out of it today. Just realized that the context.c changes were in a #define block for arm.

Sorry, ignore my previous post.

@limburgher

No worries, though that did get me to run-test it on x86_64, and it's fine. :)

@stevedekorte stevedekorte merged commit bb02b51 into stevedekorte:master
@stevedekorte

Thanks Jon :)

@limburgher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 21, 2012
  1. @limburgher
This page is out of date. Refresh to see the latest.
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
/*
Something went wrong with that request. Please try again.