trapping code: transition from native to haskell rts
[mate.git] / trap.c
diff --git a/trap.c b/trap.c
new file mode 100644 (file)
index 0000000..a1e5ddc
--- /dev/null
+++ b/trap.c
@@ -0,0 +1,17 @@
+#include <stdio.h>
+
+void callertrap(void)
+{
+       char buf[5];
+       unsigned int *ptr = (unsigned int) (buf + 1);
+
+       printf("callertrap by 0x%08x\n", *(ptr + 4));
+       /* TODO:
+        * call magic haskell function
+        * with environment information */
+}
+
+unsigned int getaddr(void)
+{
+       return (unsigned int) callertrap;
+}