[PATCH] Coco ARM uClibc setjmp implementation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Coco ARM uClibc setjmp implementation

Zachary P. Landau-4
Mike (and anyone interested),

Attached is my setjmp implementation for ARM under uClinux.  I've
tested it on an ARM9 under uClibc-0.9.28.3 and so far I haven't seen
any problems.  (I have verified that the previous problem I mentioned
was caused by me misusing copas).

I still plan to get you an assembler version, but I probably won't get
around to debugging it until this weekend.

--
Zachary P. Landau <[hidden email]>
diff -urN lua-5.1.1.orig/src/lcoco.c lua-5.1.1/src/lcoco.c
--- lua-5.1.1.orig/src/lcoco.c	2007-05-02 09:08:05.000000000 -0400
+++ lua-5.1.1/src/lcoco.c	2007-05-02 09:08:56.000000000 -0400
@@ -283,6 +283,16 @@
   stack[4] = (size_t)(a0);
 #endif
 
+#elif defined(__arm__) && defined(__UCLIBC__)
+
+#define COCO_PATCHCTX(coco, buf, func, stack, a0) \
+  buf->__jmpbuf[21] = (int)(func); \
+  buf->__jmpbuf[20] = (int)(stack); \
+  buf->__jmpbuf[19] = (int)0; /* ebp */ \
+  stack[0] = (size_t)(a0);
+#define COCO_STACKADJUST    1
+#define COCO_MAIN_PARAM     int _a, int _b, int _c, int _d, lua_State *L
+
 #endif /* arch check */
 
 #ifdef COCO_PATCHCTX