diff -urpN -X /home/fletch/.diff.exclude 202-kgdb_fixes/arch/i386/kernel/entry.S 220-thread_info_cleanup/arch/i386/kernel/entry.S --- 202-kgdb_fixes/arch/i386/kernel/entry.S Sun Apr 20 22:06:50 2003 +++ 220-thread_info_cleanup/arch/i386/kernel/entry.S Sun Apr 20 22:07:00 2003 @@ -160,7 +160,7 @@ do_lcall: movl %eax,EFLAGS(%ebp) # movl %edx,EIP(%ebp) # Now we move them to their "normal" places movl %ecx,CS(%ebp) # - andl $-8192, %ebp # GET_THREAD_INFO + GET_THREAD_INFO_WITH_ESP(%ebp) # GET_THREAD_INFO movl TI_EXEC_DOMAIN(%ebp), %edx # Get the execution domain call *4(%edx) # Call the lcall7 handler for the domain addl $4, %esp diff -urpN -X /home/fletch/.diff.exclude 202-kgdb_fixes/arch/i386/kernel/head.S 220-thread_info_cleanup/arch/i386/kernel/head.S --- 202-kgdb_fixes/arch/i386/kernel/head.S Mon Mar 17 21:43:38 2003 +++ 220-thread_info_cleanup/arch/i386/kernel/head.S Sun Apr 20 22:07:00 2003 @@ -16,6 +16,7 @@ #include #include #include +#include #define OLD_CL_MAGIC_ADDR 0x90020 #define OLD_CL_MAGIC 0xA33F @@ -325,7 +326,7 @@ rp_sidt: ret ENTRY(stack_start) - .long init_thread_union+8192 + .long init_thread_union+THREAD_SIZE .long __BOOT_DS /* This is the default interrupt "handler" :-) */ diff -urpN -X /home/fletch/.diff.exclude 202-kgdb_fixes/include/asm-i386/page.h 220-thread_info_cleanup/include/asm-i386/page.h --- 202-kgdb_fixes/include/asm-i386/page.h Sun Apr 20 21:09:40 2003 +++ 220-thread_info_cleanup/include/asm-i386/page.h Sun Apr 20 22:07:00 2003 @@ -3,7 +3,11 @@ /* PAGE_SHIFT determines the page size */ #define PAGE_SHIFT 12 -#define PAGE_SIZE (1UL << PAGE_SHIFT) +#ifndef __ASSEMBLY__ +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#else +#define PAGE_SIZE (1 << PAGE_SHIFT) +#endif #define PAGE_MASK (~(PAGE_SIZE-1)) #define LARGE_PAGE_MASK (~(LARGE_PAGE_SIZE-1)) diff -urpN -X /home/fletch/.diff.exclude 202-kgdb_fixes/include/asm-i386/thread_info.h 220-thread_info_cleanup/include/asm-i386/thread_info.h --- 202-kgdb_fixes/include/asm-i386/thread_info.h Mon Mar 17 21:43:48 2003 +++ 220-thread_info_cleanup/include/asm-i386/thread_info.h Sun Apr 20 22:07:00 2003 @@ -9,6 +9,7 @@ #ifdef __KERNEL__ +#include #ifndef __ASSEMBLY__ #include #endif @@ -59,11 +60,14 @@ struct thread_info { * * preempt_count needs to be 1 initially, until the scheduler is functional. */ +#define THREAD_ORDER 1 +#define INIT_THREAD_SIZE THREAD_SIZE + #ifndef __ASSEMBLY__ #define INIT_THREAD_INFO(tsk) \ { \ - .task = &tsk, \ + .task = &tsk, \ .exec_domain = &default_exec_domain, \ .flags = 0, \ .cpu = 0, \ @@ -77,30 +81,36 @@ struct thread_info { #define init_thread_info (init_thread_union.thread_info) #define init_stack (init_thread_union.stack) +/* thread information allocation */ +#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) +#define alloc_thread_info() ((struct thread_info *) __get_free_pages(GFP_KERNEL,THREAD_ORDER)) +#define free_thread_info(ti) free_pages((unsigned long) (ti), THREAD_ORDER) +#define get_thread_info(ti) get_task_struct((ti)->task) +#define put_thread_info(ti) put_task_struct((ti)->task) + /* how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) { struct thread_info *ti; - __asm__("andl %%esp,%0; ":"=r" (ti) : "0" (~8191UL)); + __asm__("andl %%esp,%0; ":"=r" (ti) : "0" (~(THREAD_SIZE - 1))); return ti; } -/* thread information allocation */ -#define THREAD_SIZE (2*PAGE_SIZE) -#define alloc_thread_info() ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) -#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) - #else /* !__ASSEMBLY__ */ +#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) + /* how to get the thread information struct from ASM */ #define GET_THREAD_INFO(reg) \ - movl $-8192, reg; \ + movl $-THREAD_SIZE, reg; \ andl %esp, reg -#endif +/* use this one if reg already contains %esp */ +#define GET_THREAD_INFO_WITH_ESP(reg) \ + andl $-THREAD_SIZE, reg +#endif + /* * thread information flags * - these are process state flags that various assembly files may need to access