On Sun, May 01, 2016 at 11:23:00AM +0100, Mark Cave-Ayland wrote:
+struct context *switch_to(struct context *ctx) +{
- volatile struct context *save;
- struct context *ret;
- unsigned int lr;
- debug("switching to new context:\n");
- save = __context;
- __context = ctx;
- asm __volatile__ ("mflr %0\n\t" : "=r" (lr) : : );
- asm __volatile__ ("bl __switch_context\n");
- asm __volatile__ ("mtlr %0\n\t" : : "r" (lr) : );
- ret = __context;
- __context = (struct context *)save;
- return ret;
+}
This isn't correct; GCC is free to put LR-modifying code between the asm statements. You should do it in one asm statement.
- #ifdef __powerpc64__
- #define ULONG_SIZE 8
- #define STACKFRAME_MINSIZE 48
The miminum frame size for elfv1 is 112 and for elfv2 is 32. I think. But not 48, in any case.
Segher