#endif
#endif
-size_t dynamic_space_size = DEFAULT_DYNAMIC_SPACE_SIZE;
-size_t thread_control_stack_size = DEFAULT_CONTROL_STACK_SIZE;
+os_vm_size_t dynamic_space_size = DEFAULT_DYNAMIC_SPACE_SIZE;
+os_vm_size_t thread_control_stack_size = DEFAULT_CONTROL_STACK_SIZE;
inline static boolean
forwarding_pointer_p(lispobj *pointer) {
* of the enclosing object.
*/
int
-looks_like_valid_lisp_pointer_p(lispobj *pointer, lispobj *start_addr)
+looks_like_valid_lisp_pointer_p(lispobj pointer, lispobj *start_addr)
{
- if (!is_lisp_pointer((lispobj)pointer)) {
+ if (!is_lisp_pointer(pointer)) {
return 0;
}
/* Check that the object pointed to is consistent with the pointer
* low tag. */
- switch (lowtag_of((lispobj)pointer)) {
+ switch (lowtag_of(pointer)) {
case FUN_POINTER_LOWTAG:
/* Start_addr should be the enclosing code object, or a closure
* header. */
switch (widetag_of(*start_addr)) {
case CODE_HEADER_WIDETAG:
- /* Make sure we actually point to a function in the code object,
- * as opposed to a random point there. */
- if (SIMPLE_FUN_HEADER_WIDETAG==widetag_of(*((lispobj *)(((unsigned long)pointer)-FUN_POINTER_LOWTAG))))
- return 1;
- else
- return 0;
+ /* Make sure we actually point to a function in the code object,
+ * as opposed to a random point there. */
+ if (SIMPLE_FUN_HEADER_WIDETAG==widetag_of(native_pointer(pointer)[0]))
+ return 1;
+ else
+ return 0;
case CLOSURE_HEADER_WIDETAG:
case FUNCALLABLE_INSTANCE_HEADER_WIDETAG:
- if ((unsigned long)pointer !=
- ((unsigned long)start_addr+FUN_POINTER_LOWTAG)) {
+ if (pointer != make_lispobj(start_addr, FUN_POINTER_LOWTAG)) {
return 0;
}
break;
}
break;
case LIST_POINTER_LOWTAG:
- if ((unsigned long)pointer !=
- ((unsigned long)start_addr+LIST_POINTER_LOWTAG)) {
+ if (pointer != make_lispobj(start_addr, LIST_POINTER_LOWTAG)) {
return 0;
}
/* Is it plausible cons? */
return 0;
}
case INSTANCE_POINTER_LOWTAG:
- if ((unsigned long)pointer !=
- ((unsigned long)start_addr+INSTANCE_POINTER_LOWTAG)) {
+ if (pointer != make_lispobj(start_addr, INSTANCE_POINTER_LOWTAG)) {
return 0;
}
if (widetag_of(start_addr[0]) != INSTANCE_HEADER_WIDETAG) {
* cannot be found by simply walking the heap, therefore we
* need to check for it. -- AB, 2010-Jun-04 */
if ((widetag_of(start_addr[0]) == CODE_HEADER_WIDETAG)) {
- lispobj *potential_lra =
- (lispobj *)(((unsigned long)pointer) - OTHER_POINTER_LOWTAG);
+ lispobj *potential_lra = native_pointer(pointer);
if ((widetag_of(potential_lra[0]) == RETURN_PC_HEADER_WIDETAG) &&
((potential_lra - HeaderValue(potential_lra[0])) == start_addr)) {
return 1; /* It's as good as we can verify. */
}
#endif
- if ((unsigned long)pointer !=
- ((unsigned long)start_addr+OTHER_POINTER_LOWTAG)) {
+ if (pointer != make_lispobj(start_addr, OTHER_POINTER_LOWTAG)) {
return 0;
}
/* Is it plausible? Not a cons. XXX should check the headers. */
if (((start=search_dynamic_space(pointer))!=NULL) ||
((start=search_static_space(pointer))!=NULL) ||
((start=search_read_only_space(pointer))!=NULL))
- return looks_like_valid_lisp_pointer_p(pointer, start);
+ return looks_like_valid_lisp_pointer_p((lispobj)pointer, start);
else
return 0;
}
struct thread *th = arch_os_get_current_thread();
os_vm_address_t guard_page_address = CONTROL_STACK_GUARD_PAGE(th);
os_vm_address_t hard_guard_page_address = CONTROL_STACK_HARD_GUARD_PAGE(th);
- lispobj *sp;
#ifdef LISP_FEATURE_C_STACK_IS_CONTROL_STACK
- sp = (lispobj *)&sp - 1;
+ /* On these targets scrubbing from C is a bad idea, so we punt to
+ * a routine in $ARCH-assem.S. */
+ extern void arch_scrub_control_stack(struct thread *, os_vm_address_t, os_vm_address_t);
+ arch_scrub_control_stack(th, guard_page_address, hard_guard_page_address);
#else
- sp = access_control_stack_pointer(th);
-#endif
+ lispobj *sp = access_control_stack_pointer(th);
scrub:
if ((((os_vm_address_t)sp < (hard_guard_page_address + os_vm_page_size)) &&
((os_vm_address_t)sp >= hard_guard_page_address)) ||
goto scrub;
} while (((unsigned long)++sp) & (BYTES_ZERO_BEFORE_END - 1));
#endif
+#endif /* LISP_FEATURE_C_STACK_IS_CONTROL_STACK */
}
\f
#if !defined(LISP_FEATURE_X86) && !defined(LISP_FEATURE_X86_64)