2 Copyright (C) 2001-2007, The Perl Foundation.
7 src/cpu_dep.c - CPU-dependent functions
11 These functions are called while stackwalking during dead object
12 destruction. They implement conditional CPU-specific behaviour related
13 to register windowing.
15 Register windowing is a technique which avoids having to empty registers
16 by moving a virtual window up/down the register stack restricting the
17 number of registers which are visible.
19 Remember you read something about it in F<docs/infant.dev>?
25 #include "parrot/parrot.h"
27 /* HEADERIZER HFILE: include/parrot/dod.h */
29 /* HEADERIZER BEGIN: static */
31 static void trace_system_stack( PARROT_INTERP
)
32 __attribute__nonnull__(1);
34 /* HEADERIZER END: static */
38 # include <ucontext.h>
39 extern void *flush_reg_store(void);
40 # define BACKING_STORE_BASE 0x80000fff80000000
46 FUNCDOC: trace_system_areas
48 Traces the system stack and any additional CPU-specific areas.
53 trace_system_areas(PARROT_INTERP
)
55 #if defined(__sparc) /* Flush register windows */
57 unsigned int insns
[4];
61 0x81580000, /* flushw */
63 0x91d02003, /* ta ST_FLUSH_WINDOWS */
65 0x81c3e008, /* retl */
69 static void (*fn_ptr
)(void) = (void (*)(void))&u
.align_hack
[0];
72 #elif defined(__ia64__)
75 void *current_regstore_top
;
78 current_regstore_top
= flush_reg_store();
80 trace_mem_block(interp
, 0x80000fff80000000,
81 (size_t)current_regstore_top
);
84 # ifdef PARROT_HAS_HEADER_SETJMP
87 /* Zero the Parrot_jump_buff, otherwise you will trace stale objects */
88 memset(&env
, 0, sizeof (env
));
90 /* this should put registers in env, which then get marked in
91 * trace_system_stack below
99 trace_system_stack(interp
);
104 FUNCDOC: trace_system_stack
106 Traces the memory block starting at C<< interp->lo_var_ptr >>.
111 trace_system_stack(PARROT_INTERP
)
113 const size_t lo_var_ptr
= (size_t)interp
->lo_var_ptr
;
115 trace_mem_block(interp
, (size_t)lo_var_ptr
,
116 (size_t)&lo_var_ptr
);
123 F<src/dod.c>, F<include/parrot/dod.h> and F<docs/infant.dev>.
130 * c-file-style: "parrot"
132 * vim: expandtab shiftwidth=4: