This fixes the stack end detection properly, and verifies that the
stack content printing does not overflow into the next page even
partially.
This is required especially for x86 BIOSes that misalign the stack,
together with the page access debugging that unmaps unused kernel
pages to check for valid accesses.
Architectures with special needs (eg HPPA with stacks that grow up)
can override the kernel stack end test with __HAVE_ARCH_KSTACK_END
if they ever enable the anal slab debugging code.
#ifdef CONFIG_KALLSYMS
printk("\n");
#endif
- while (((long) stack & (THREAD_SIZE-4)) != 0) {
+ while (!kstack_end(stack)) {
addr = *stack++;
if (kernel_text_address(addr)) {
printk(" [<%08lx>] ", addr);
stack = esp;
for(i = 0; i < kstack_depth_to_print; i++) {
- if (((long) stack & (THREAD_SIZE-4)) == 0)
+ if (kstack_end(stack))
break;
if (i && ((i % 8) == 0))
printk("\n ");
unsigned long stack[INIT_THREAD_SIZE/sizeof(long)];
};
+#ifndef __HAVE_ARCH_KSTACK_END
+static inline int kstack_end(void *addr)
+{
+ /* Reliable end of stack detection:
+ * Some APM bios versions misalign the stack
+ */
+ return !(((unsigned long)addr+sizeof(void*)-1) & (THREAD_SIZE-sizeof(void*)));
+}
+#endif
+
extern union thread_union init_thread_union;
extern struct task_struct init_task;
unsigned long *sptr = &caller;
unsigned long svalue;
- while (((long) sptr & (THREAD_SIZE-4)) != 0) {
+ while (!kstack_end(sptr)) {
svalue = *sptr++;
if (kernel_text_address(svalue)) {
*addr++=svalue;