Re: 2.5.69-mjb1

Dave Hansen (haveblue@us.ibm.com)
Mon, 12 May 2003 08:05:15 -0700


Martin J. Bligh wrote:
> --On Monday, May 12, 2003 06:29:39 -0700 William Lee Irwin III <wli@holomorphy.com> wrote:
>
>
>>On Sat, May 10, 2003 at 08:44:09PM -0700, Martin J. Bligh wrote:
>>
>>>thread_info_cleanup (4K stacks pt 1) Dave Hansen / Ben LaHaise
>>> Prep work to reduce kernel stacks to 4K
>>>interrupt_stacks (4K stacks pt 2) Dave Hansen / Ben LaHaise
>>> Create a per-cpu interrupt stack.
>>>stack_usage_check (4K stacks pt 3) Dave Hansen / Ben LaHaise
>>> Check for kernel stack overflows.
>>>4k_stack (4K stacks pt 4) Dave Hansen
>>> Config option to reduce kernel stacks to 4K
>>
>>
>>diff -urpN linux-2.5.69/include/asm-i386/processor.h kstk-2.5.69-1/include/asm-i386/processor.h
>>--- linux-2.5.69/include/asm-i386/processor.h 2003-05-04 16:53:00.000000000 -0700
>>+++ kstk-2.5.69-1/include/asm-i386/processor.h 2003-05-12 06:05:39.000000000 -0700
>>@@ -470,8 +470,8 @@ extern int kernel_thread(int (*fn)(void
>> extern unsigned long thread_saved_pc(struct task_struct *tsk);
>>
>> unsigned long get_wchan(struct task_struct *p);
>>-#define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)->thread_info))[1019])
>>-#define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)->thread_info))[1022])
>>+#define KSTK_EIP(task) (((unsigned long *)(task)->thread_info)[THREAD_SIZE/sizeof(unsigned long) - 5])
>>+#define KSTK_ESP(task) (((unsigned long *)(task)->thread_info)[THREAD_SIZE/sizeof(unsigned long) - 2])
>>
>> struct microcode {
>> unsigned int hdrver;
>
> Can I get some sort of vague explanation please? ;-)

Wow, that's intuitive :)

They're trying to access the variables that have been pushed onto the
top of the stack. The thread_info field points to the bottom of the
kernel's stack (no matter how big it is). I don't know where the -5 and
-2 come from. It needs a big, fat stinking comment.

-- 
Dave Hansen
haveblue@us.ibm.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/