]> gitweb.factorcode.org Git - factor.git/blob - unmaintained/javascriptcore/ffi/hack/hack.factor
30ba881c7213e6c65e75edf34ab4926b577b7cd8
[factor.git] / unmaintained / javascriptcore / ffi / hack / hack.factor
1 ! Copyright (C) 2010 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien alien.accessors alien.c-types alien.syntax kernel
4 kernel.private math system ;
5 IN: javascriptcore.ffi.hack
6
7 HOOK: set-callstack-bounds os ( -- )
8
9 HOOK: macosx-callstack-start-offset cpu ( -- address )
10 HOOK: macosx-callstack-size-offset cpu ( -- address )
11
12 M: ppc macosx-callstack-start-offset 0x188 ;
13 M: ppc macosx-callstack-size-offset 0x18c ;
14
15 M: x86.32 macosx-callstack-start-offset 0xc48 ;
16 M: x86.32 macosx-callstack-size-offset 0xc4c ;
17
18 M: x86.64 macosx-callstack-start-offset 0x1860 ;
19 M: x86.64 macosx-callstack-size-offset 0x1868 ;
20
21 M: object set-callstack-bounds ;
22
23 FUNCTION: void* pthread_self ( ) ;
24
25 M: macosx set-callstack-bounds
26     callstack-bounds over [ alien-address ] bi@ -
27     pthread_self
28     [ macosx-callstack-size-offset set-alien-unsigned-cell ]
29     [ macosx-callstack-start-offset set-alien-cell ] bi ;