]> gitweb.factorcode.org Git - factor-unmaintained.git/blobdiff - javascriptcore/ffi/hack/hack.factor
unmaintained: New home for misfit Factor vocabularies.
[factor-unmaintained.git] / javascriptcore / ffi / hack / hack.factor
diff --git a/javascriptcore/ffi/hack/hack.factor b/javascriptcore/ffi/hack/hack.factor
new file mode 100644 (file)
index 0000000..30ba881
--- /dev/null
@@ -0,0 +1,29 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.accessors alien.c-types alien.syntax kernel
+kernel.private math system ;
+IN: javascriptcore.ffi.hack
+
+HOOK: set-callstack-bounds os ( -- )
+
+HOOK: macosx-callstack-start-offset cpu ( -- address )
+HOOK: macosx-callstack-size-offset cpu ( -- address )
+
+M: ppc macosx-callstack-start-offset 0x188 ;
+M: ppc macosx-callstack-size-offset 0x18c ;
+
+M: x86.32 macosx-callstack-start-offset 0xc48 ;
+M: x86.32 macosx-callstack-size-offset 0xc4c ;
+
+M: x86.64 macosx-callstack-start-offset 0x1860 ;
+M: x86.64 macosx-callstack-size-offset 0x1868 ;
+
+M: object set-callstack-bounds ;
+
+FUNCTION: void* pthread_self ( ) ;
+
+M: macosx set-callstack-bounds
+    callstack-bounds over [ alien-address ] bi@ -
+    pthread_self
+    [ macosx-callstack-size-offset set-alien-unsigned-cell ]
+    [ macosx-callstack-start-offset set-alien-cell ] bi ;