+++ /dev/null
-Index: kernel-2.4.21/arch/i386/kernel/entry.S
-===================================================================
---- kernel-2.4.21.orig/arch/i386/kernel/entry.S 2003-06-13 07:51:29.000000000 -0700
-+++ kernel-2.4.21/arch/i386/kernel/entry.S 2003-12-04 11:57:01.000000000 -0800
-@@ -45,6 +45,7 @@
- #include <linux/linkage.h>
- #include <asm/segment.h>
- #include <asm/smp.h>
-+#include <asm/current.h>
-
- EBX = 0x00
- ECX = 0x04
-@@ -130,10 +131,6 @@
- .long 3b,6b; \
- .previous
-
--#define GET_CURRENT(reg) \
-- movl $-8192, reg; \
-- andl %esp, reg
--
- ENTRY(lcall7)
- pushfl # We get a different stack layout with call gates,
- pushl %eax # which has to be cleaned up later..
-@@ -149,7 +146,7 @@
- movl %ecx,CS(%esp) #
- movl %esp,%ebx
- pushl %ebx
-- andl $-8192,%ebx # GET_CURRENT
-+ andl $-THREAD_SIZE,%ebx # GET_CURRENT
- movl exec_domain(%ebx),%edx # Get the execution domain
- movl 4(%edx),%edx # Get the lcall7 handler for the domain
- pushl $0x7
-@@ -173,7 +170,7 @@
- movl %ecx,CS(%esp) #
- movl %esp,%ebx
- pushl %ebx
-- andl $-8192,%ebx # GET_CURRENT
-+ andl $-THREAD_SIZE,%ebx # GET_CURRENT
- movl exec_domain(%ebx),%edx # Get the execution domain
- movl 4(%edx),%edx # Get the lcall7 handler for the domain
- pushl $0x27
-Index: kernel-2.4.21/arch/i386/kernel/smpboot.c
-===================================================================
---- kernel-2.4.21.orig/arch/i386/kernel/smpboot.c 2003-06-13 07:51:29.000000000 -0700
-+++ kernel-2.4.21/arch/i386/kernel/smpboot.c 2003-12-04 11:57:01.000000000 -0800
-@@ -819,7 +819,7 @@
-
- /* So we see what's up */
- printk("Booting processor %d/%d eip %lx\n", cpu, apicid, start_eip);
-- stack_start.esp = (void *) (1024 + PAGE_SIZE + (char *)idle);
-+ stack_start.esp = (void *)idle->thread.esp;
-
- /*
- * This grunge runs the startup process for
-@@ -892,7 +892,7 @@
- Dprintk("CPU has booted.\n");
- } else {
- boot_error= 1;
-- if (*((volatile unsigned char *)phys_to_virt(8192))
-+ if (*((volatile unsigned char *)phys_to_virt(THREAD_SIZE))
- == 0xA5)
- /* trampoline started but...? */
- printk("Stuck ??\n");
-@@ -915,7 +915,7 @@
- }
-
- /* mark "stuck" area as not stuck */
-- *((volatile unsigned long *)phys_to_virt(8192)) = 0;
-+ *((volatile unsigned long *)phys_to_virt(THREAD_SIZE)) = 0;
-
- if(clustered_apic_mode == CLUSTERED_APIC_NUMAQ) {
- printk("Restoring NMI vector\n");
-Index: kernel-2.4.21/arch/i386/kernel/traps.c
-===================================================================
---- kernel-2.4.21.orig/arch/i386/kernel/traps.c 2002-11-28 15:53:09.000000000 -0800
-+++ kernel-2.4.21/arch/i386/kernel/traps.c 2003-12-04 11:57:01.000000000 -0800
-@@ -158,7 +158,7 @@
- unsigned long esp = tsk->thread.esp;
-
- /* User space on another CPU? */
-- if ((esp ^ (unsigned long)tsk) & (PAGE_MASK<<1))
-+ if ((esp ^ (unsigned long)tsk) & ~(THREAD_SIZE - 1))
- return;
- show_trace((unsigned long *)esp);
- }
-Index: kernel-2.4.21/arch/i386/kernel/head.S
-===================================================================
---- kernel-2.4.21.orig/arch/i386/kernel/head.S 2003-06-13 07:51:29.000000000 -0700
-+++ kernel-2.4.21/arch/i386/kernel/head.S 2003-12-04 11:57:01.000000000 -0800
-@@ -15,6 +15,7 @@
- #include <asm/page.h>
- #include <asm/pgtable.h>
- #include <asm/desc.h>
-+#include <asm/current.h>
-
- #define OLD_CL_MAGIC_ADDR 0x90020
- #define OLD_CL_MAGIC 0xA33F
-@@ -320,7 +321,7 @@
- ret
-
- ENTRY(stack_start)
-- .long SYMBOL_NAME(init_task_union)+8192
-+ .long SYMBOL_NAME(init_task_union)+THREAD_SIZE
- .long __KERNEL_DS
-
- /* This is the default interrupt "handler" :-) */
-Index: kernel-2.4.21/arch/i386/kernel/irq.c
-===================================================================
---- kernel-2.4.21.orig/arch/i386/kernel/irq.c 2002-11-28 15:53:09.000000000 -0800
-+++ kernel-2.4.21/arch/i386/kernel/irq.c 2003-12-04 11:57:01.000000000 -0800
-@@ -581,7 +581,10 @@
- long esp;
-
- /* Debugging check for stack overflow: is there less than 1KB free? */
-- __asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : "0" (8191));
-+ __asm__ __volatile__(
-+ "andl %%esp,%0"
-+ : "=r" (esp) : "0" (THREAD_SIZE-1));
-+
- if (unlikely(esp < (sizeof(struct task_struct) + 1024))) {
- extern void show_stack(unsigned long *);
-
-Index: kernel-2.4.21/arch/i386/lib/getuser.S
-===================================================================
---- kernel-2.4.21.orig/arch/i386/lib/getuser.S 1998-01-12 13:42:52.000000000 -0800
-+++ kernel-2.4.21/arch/i386/lib/getuser.S 2003-12-04 11:57:01.000000000 -0800
-@@ -21,6 +21,10 @@
- * as they get called from within inline assembly.
- */
-
-+/* Duplicated from asm/processor.h */
-+#include <asm/current.h>
-+#include <linux/config.h>
-+
- addr_limit = 12
-
- .text
-@@ -28,7 +32,7 @@
- .globl __get_user_1
- __get_user_1:
- movl %esp,%edx
-- andl $0xffffe000,%edx
-+ andl $~(THREAD_SIZE - 1),%edx
- cmpl addr_limit(%edx),%eax
- jae bad_get_user
- 1: movzbl (%eax),%edx
-@@ -41,7 +45,7 @@
- addl $1,%eax
- movl %esp,%edx
- jc bad_get_user
-- andl $0xffffe000,%edx
-+ andl $~(THREAD_SIZE - 1),%edx
- cmpl addr_limit(%edx),%eax
- jae bad_get_user
- 2: movzwl -1(%eax),%edx
-@@ -54,7 +58,7 @@
- addl $3,%eax
- movl %esp,%edx
- jc bad_get_user
-- andl $0xffffe000,%edx
-+ andl $~(THREAD_SIZE - 1),%edx
- cmpl addr_limit(%edx),%eax
- jae bad_get_user
- 3: movl -3(%eax),%edx
-Index: kernel-2.4.21/arch/i386/config.in
-===================================================================
---- kernel-2.4.21.orig/arch/i386/config.in 2003-06-13 07:51:29.000000000 -0700
-+++ kernel-2.4.21/arch/i386/config.in 2003-12-04 11:57:01.000000000 -0800
-@@ -256,6 +256,29 @@
- if [ "$CONFIG_SMP" = "y" -a "$CONFIG_X86_CMPXCHG" = "y" ]; then
- define_bool CONFIG_HAVE_DEC_LOCK y
- fi
-+
-+choice 'Bigger Stack Size Support' \
-+ "off CONFIG_NOBIGSTACK \
-+ 16KB CONFIG_STACK_SIZE_16KB \
-+ 32KB CONFIG_STACK_SIZE_32KB \
-+ 64KB CONFIG_STACK_SIZE_64KB" off
-+
-+if [ "$CONFIG_NOBIGSTACK" = "y" ]; then
-+ define_int CONFIG_STACK_SIZE_SHIFT 1
-+else
-+ if [ "$CONFIG_STACK_SIZE_16KB" = "y" ]; then
-+ define_int CONFIG_STACK_SIZE_SHIFT 2
-+ else
-+ if [ "$CONFIG_STACK_SIZE_32KB" = "y" ]; then
-+ define_int CONFIG_STACK_SIZE_SHIFT 3
-+ else
-+ if [ "$CONFIG_STACK_SIZE_64KB" = "y" ]; then
-+ define_int CONFIG_STACK_SIZE_SHIFT 4
-+ fi
-+ fi
-+ fi
-+fi
-+
- endmenu
-
- mainmenu_option next_comment
-Index: kernel-2.4.21/arch/i386/vmlinux.lds
-===================================================================
---- kernel-2.4.21.orig/arch/i386/vmlinux.lds 2002-02-25 11:37:53.000000000 -0800
-+++ kernel-2.4.21/arch/i386/vmlinux.lds 2003-12-04 11:57:01.000000000 -0800
-@@ -35,7 +35,8 @@
-
- _edata = .; /* End of data section */
-
-- . = ALIGN(8192); /* init_task */
-+/* chose the biggest of the possible stack sizes here? */
-+ . = ALIGN(65536); /* init_task */
- .data.init_task : { *(.data.init_task) }
-
- . = ALIGN(4096); /* Init code and data */
-Index: kernel-2.4.21/include/asm-i386/current.h
-===================================================================
---- kernel-2.4.21.orig/include/asm-i386/current.h 1998-08-14 16:35:22.000000000 -0700
-+++ kernel-2.4.21/include/asm-i386/current.h 2003-12-04 11:57:01.000000000 -0800
-@@ -1,15 +1,43 @@
- #ifndef _I386_CURRENT_H
- #define _I386_CURRENT_H
-+#include <asm/page.h>
-+
-+/*
-+ * Configurable page sizes on i386, mainly for debugging purposes.
-+ * (c) Balbir Singh
-+ */
-+
-+#ifdef __ASSEMBLY__
-+
-+#define PAGE_SIZE 4096 /* as cannot handle 1UL << 12 */
-+#define THREAD_SIZE ((1 << CONFIG_STACK_SIZE_SHIFT) * PAGE_SIZE)
-+
-+#define GET_CURRENT(reg) \
-+ movl $-THREAD_SIZE, reg; \
-+ andl %esp, reg
-+
-+#else /* __ASSEMBLY__ */
-+
-+#define THREAD_SIZE ((1 << CONFIG_STACK_SIZE_SHIFT) * PAGE_SIZE)
-+#define alloc_task_struct() \
-+ ((struct task_struct *) __get_free_pages(GFP_KERNEL,CONFIG_STACK_SIZE_SHIFT))
-+
-+#define free_task_struct(p) \
-+ free_pages((unsigned long) (p), CONFIG_STACK_SIZE_SHIFT)
-+
-+#define INIT_TASK_SIZE THREAD_SIZE
-
- struct task_struct;
-
- static inline struct task_struct * get_current(void)
- {
- struct task_struct *current;
-- __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
-+ __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~(THREAD_SIZE - 1)));
- return current;
- }
-
- #define current get_current()
-
-+#endif /* __ASSEMBLY__ */
-+
- #endif /* !(_I386_CURRENT_H) */
-Index: kernel-2.4.21/include/asm-i386/hw_irq.h
-===================================================================
---- kernel-2.4.21.orig/include/asm-i386/hw_irq.h 2001-11-22 11:46:18.000000000 -0800
-+++ kernel-2.4.21/include/asm-i386/hw_irq.h 2003-12-04 11:57:01.000000000 -0800
-@@ -15,6 +15,7 @@
- #include <linux/config.h>
- #include <asm/atomic.h>
- #include <asm/irq.h>
-+#include <asm/current.h>
-
- /*
- * IDT vectors usable for external interrupt sources start
-@@ -113,10 +114,6 @@
- #define IRQ_NAME2(nr) nr##_interrupt(void)
- #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
-
--#define GET_CURRENT \
-- "movl %esp, %ebx\n\t" \
-- "andl $-8192, %ebx\n\t"
--
- /*
- * SMP has a few special interrupts for IPI messages
- */
-Index: kernel-2.4.21/include/asm-i386/processor.h
-===================================================================
---- kernel-2.4.21.orig/include/asm-i386/processor.h 2003-06-13 07:51:38.000000000 -0700
-+++ kernel-2.4.21/include/asm-i386/processor.h 2003-12-04 11:57:01.000000000 -0800
-@@ -14,6 +14,7 @@
- #include <asm/types.h>
- #include <asm/sigcontext.h>
- #include <asm/cpufeature.h>
-+#include <asm/current.h>
- #include <linux/cache.h>
- #include <linux/config.h>
- #include <linux/threads.h>
-@@ -453,9 +454,6 @@
- #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019])
- #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022])
-
--#define THREAD_SIZE (2*PAGE_SIZE)
--#define alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
--#define free_task_struct(p) free_pages((unsigned long) (p), 1)
- #define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count)
-
- #define init_task (init_task_union.task)
-Index: kernel-2.4.21/include/linux/sched.h
-===================================================================
---- kernel-2.4.21.orig/include/linux/sched.h 2003-06-13 15:26:52.000000000 -0700
-+++ kernel-2.4.21/include/linux/sched.h 2003-12-04 12:00:14.000000000 -0800
-@@ -2,6 +2,7 @@
- #define _LINUX_SCHED_H
-
- #include <asm/param.h> /* for HZ */
-+#include <asm/current.h> /* maybe for INIT_TASK_SIZE */
-
- extern unsigned long event;
-