1 Index: linux-2.4.21-171/arch/i386/kernel/entry.S
2 ===================================================================
3 --- linux-2.4.21-171.orig/arch/i386/kernel/entry.S 2004-02-24 13:43:40.000000000 -0500
4 +++ linux-2.4.21-171/arch/i386/kernel/entry.S 2004-04-03 16:02:32.000000000 -0500
6 #include <linux/linkage.h>
7 #include <asm/segment.h>
9 +#include <asm/current.h>
17 -#define GET_CURRENT(reg) \
22 pushfl # We get a different stack layout with call gates,
23 pushl %eax # which has to be cleaned up later..
28 - andl $-8192,%ebx # GET_CURRENT
29 + andl $-THREAD_SIZE,%ebx # GET_CURRENT
30 movl exec_domain(%ebx),%edx # Get the execution domain
31 movl 4(%edx),%edx # Get the lcall7 handler for the domain
37 - andl $-8192,%ebx # GET_CURRENT
38 + andl $-THREAD_SIZE,%ebx # GET_CURRENT
39 movl exec_domain(%ebx),%edx # Get the execution domain
40 movl 4(%edx),%edx # Get the lcall7 handler for the domain
42 Index: linux-2.4.21-171/arch/i386/kernel/smpboot.c
43 ===================================================================
44 --- linux-2.4.21-171.orig/arch/i386/kernel/smpboot.c 2004-02-24 13:43:40.000000000 -0500
45 +++ linux-2.4.21-171/arch/i386/kernel/smpboot.c 2004-04-03 16:02:32.000000000 -0500
48 /* So we see what's up */
49 printk("Booting processor %d/%d eip %lx\n", cpu, apicid, start_eip);
50 - stack_start.esp = (void *) (1024 + PAGE_SIZE + (char *)idle);
51 + stack_start.esp = (void *)idle->thread.esp;
54 * This grunge runs the startup process for
56 Dprintk("CPU has booted.\n");
59 - if (*((volatile unsigned char *)phys_to_virt(8192))
60 + if (*((volatile unsigned char *)phys_to_virt(THREAD_SIZE))
62 /* trampoline started but...? */
67 /* mark "stuck" area as not stuck */
68 - *((volatile unsigned long *)phys_to_virt(8192)) = 0;
69 + *((volatile unsigned long *)phys_to_virt(THREAD_SIZE)) = 0;
73 Index: linux-2.4.21-171/arch/i386/kernel/traps.c
74 ===================================================================
75 --- linux-2.4.21-171.orig/arch/i386/kernel/traps.c 2004-02-24 13:43:40.000000000 -0500
76 +++ linux-2.4.21-171/arch/i386/kernel/traps.c 2004-04-03 16:02:32.000000000 -0500
78 unsigned long esp = tsk->thread.esp;
80 /* User space on another CPU? */
81 - if ((esp ^ (unsigned long)tsk) & (PAGE_MASK<<1))
82 + if ((esp ^ (unsigned long)tsk) & ~(THREAD_SIZE - 1))
84 show_trace((unsigned long *)esp);
86 Index: linux-2.4.21-171/arch/i386/kernel/head.S
87 ===================================================================
88 --- linux-2.4.21-171.orig/arch/i386/kernel/head.S 2004-02-24 13:43:40.000000000 -0500
89 +++ linux-2.4.21-171/arch/i386/kernel/head.S 2004-04-03 16:02:32.000000000 -0500
92 #include <asm/pgtable.h>
94 +#include <asm/current.h>
96 #define OLD_CL_MAGIC_ADDR 0x90020
97 #define OLD_CL_MAGIC 0xA33F
102 - .long SYMBOL_NAME(init_task_union)+8192
103 + .long SYMBOL_NAME(init_task_union)+THREAD_SIZE
106 /* This is the default interrupt "handler" :-) */
107 Index: linux-2.4.21-171/arch/i386/kernel/irq.c
108 ===================================================================
109 --- linux-2.4.21-171.orig/arch/i386/kernel/irq.c 2004-02-24 13:43:40.000000000 -0500
110 +++ linux-2.4.21-171/arch/i386/kernel/irq.c 2004-04-03 16:05:17.000000000 -0500
114 /* Debugging check for stack overflow: is there less than 1KB free? */
115 - __asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : "0" (8191));
116 + __asm__ __volatile__(
118 + : "=r" (esp) : "0" (THREAD_SIZE-1));
119 if (unlikely(esp < (sizeof(struct task_struct) + sysctl_stackwarn))) {
120 static unsigned long next_jiffies; /* ratelimiting */
121 static long least_esp = THREAD_SIZE;
122 Index: linux-2.4.21-171/arch/i386/lib/getuser.S
123 ===================================================================
124 --- linux-2.4.21-171.orig/arch/i386/lib/getuser.S 2004-02-24 13:43:40.000000000 -0500
125 +++ linux-2.4.21-171/arch/i386/lib/getuser.S 2004-04-03 16:02:32.000000000 -0500
127 * as they get called from within inline assembly.
130 +/* Duplicated from asm/processor.h */
131 +#include <asm/current.h>
132 +#include <linux/config.h>
141 - andl $0xffffe000,%edx
142 + andl $~(THREAD_SIZE - 1),%edx
143 cmpl addr_limit(%edx),%eax
145 1: movzbl (%eax),%edx
150 - andl $0xffffe000,%edx
151 + andl $~(THREAD_SIZE - 1),%edx
152 cmpl addr_limit(%edx),%eax
154 2: movzwl -1(%eax),%edx
159 - andl $0xffffe000,%edx
160 + andl $~(THREAD_SIZE - 1),%edx
161 cmpl addr_limit(%edx),%eax
163 3: movl -3(%eax),%edx
164 Index: linux-2.4.21-171/arch/i386/config.in
165 ===================================================================
166 --- linux-2.4.21-171.orig/arch/i386/config.in 2004-02-24 13:43:40.000000000 -0500
167 +++ linux-2.4.21-171/arch/i386/config.in 2004-04-03 16:02:32.000000000 -0500
169 if [ "$CONFIG_SMP" = "y" -a "$CONFIG_X86_CMPXCHG" = "y" ]; then
170 define_bool CONFIG_HAVE_DEC_LOCK y
173 +choice 'Bigger Stack Size Support' \
174 + "off CONFIG_NOBIGSTACK \
175 + 16KB CONFIG_STACK_SIZE_16KB \
176 + 32KB CONFIG_STACK_SIZE_32KB \
177 + 64KB CONFIG_STACK_SIZE_64KB" off
179 +if [ "$CONFIG_NOBIGSTACK" = "y" ]; then
180 + define_int CONFIG_STACK_SIZE_SHIFT 1
182 + if [ "$CONFIG_STACK_SIZE_16KB" = "y" ]; then
183 + define_int CONFIG_STACK_SIZE_SHIFT 2
185 + if [ "$CONFIG_STACK_SIZE_32KB" = "y" ]; then
186 + define_int CONFIG_STACK_SIZE_SHIFT 3
188 + if [ "$CONFIG_STACK_SIZE_64KB" = "y" ]; then
189 + define_int CONFIG_STACK_SIZE_SHIFT 4
197 mainmenu_option next_comment
198 Index: linux-2.4.21-171/arch/i386/vmlinux.lds.S
199 ===================================================================
200 --- linux-2.4.21-171.orig/arch/i386/vmlinux.lds.S 2004-02-24 13:43:40.000000000 -0500
201 +++ linux-2.4.21-171/arch/i386/vmlinux.lds.S 2004-04-03 16:02:32.000000000 -0500
204 _edata = .; /* End of data section */
206 - . = ALIGN(8192); /* init_task */
207 +/* chose the biggest of the possible stack sizes here? */
208 + . = ALIGN(65536); /* init_task */
209 .data.init_task : { *(.data.init_task) }
211 . = ALIGN(4096); /* Init code and data */
212 Index: linux-2.4.21-171/include/asm-i386/current.h
213 ===================================================================
214 --- linux-2.4.21-171.orig/include/asm-i386/current.h 2004-02-24 13:42:29.000000000 -0500
215 +++ linux-2.4.21-171/include/asm-i386/current.h 2004-04-03 16:02:32.000000000 -0500
217 #ifndef _I386_CURRENT_H
218 #define _I386_CURRENT_H
219 +#include <asm/page.h>
222 + * Configurable page sizes on i386, mainly for debugging purposes.
228 +#define PAGE_SIZE 4096 /* as cannot handle 1UL << 12 */
229 +#define THREAD_SIZE ((1 << CONFIG_STACK_SIZE_SHIFT) * PAGE_SIZE)
231 +#define GET_CURRENT(reg) \
232 + movl $-THREAD_SIZE, reg; \
235 +#else /* __ASSEMBLY__ */
237 +#define THREAD_SIZE ((1 << CONFIG_STACK_SIZE_SHIFT) * PAGE_SIZE)
238 +#define alloc_task_struct() \
239 + ((struct task_struct *) __get_free_pages(GFP_KERNEL,CONFIG_STACK_SIZE_SHIFT))
241 +#define free_task_struct(p) \
242 + free_pages((unsigned long) (p), CONFIG_STACK_SIZE_SHIFT)
244 +#define INIT_TASK_SIZE THREAD_SIZE
248 static inline struct task_struct * get_current(void)
250 struct task_struct *current;
251 - __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
252 + __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~(THREAD_SIZE - 1)));
256 #define current get_current()
258 +#endif /* __ASSEMBLY__ */
260 #endif /* !(_I386_CURRENT_H) */
261 Index: linux-2.4.21-171/include/asm-i386/hw_irq.h
262 ===================================================================
263 --- linux-2.4.21-171.orig/include/asm-i386/hw_irq.h 2004-02-24 13:42:29.000000000 -0500
264 +++ linux-2.4.21-171/include/asm-i386/hw_irq.h 2004-04-03 16:02:32.000000000 -0500
266 #include <linux/sched.h>
267 #include <asm/atomic.h>
269 +#include <asm/current.h>
272 * IDT vectors usable for external interrupt sources start
274 #define IRQ_NAME2(nr) nr##_interrupt(void)
275 #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
277 -#define GET_CURRENT \
278 - "movl %esp, %ebx\n\t" \
279 - "andl $-8192, %ebx\n\t"
282 * SMP has a few special interrupts for IPI messages
284 Index: linux-2.4.21-171/include/asm-i386/processor.h
285 ===================================================================
286 --- linux-2.4.21-171.orig/include/asm-i386/processor.h 2004-02-24 13:42:29.000000000 -0500
287 +++ linux-2.4.21-171/include/asm-i386/processor.h 2004-04-03 16:02:32.000000000 -0500
289 #include <asm/types.h>
290 #include <asm/sigcontext.h>
291 #include <asm/cpufeature.h>
292 +#include <asm/current.h>
293 #include <linux/cache.h>
294 #include <linux/config.h>
295 #include <linux/threads.h>
297 #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019])
298 #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022])
300 -#define THREAD_SIZE (2*PAGE_SIZE)
301 -#define alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
302 -#define free_task_struct(p) free_pages((unsigned long) (p), 1)
303 #define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count)
305 #define init_task (init_task_union.task)
306 Index: linux-2.4.21-171/include/linux/sched.h
307 ===================================================================
308 --- linux-2.4.21-171.orig/include/linux/sched.h 2004-03-31 14:58:26.000000000 -0500
309 +++ linux-2.4.21-171/include/linux/sched.h 2004-04-03 16:02:32.000000000 -0500
311 #define _LINUX_SCHED_H
313 #include <asm/param.h> /* for HZ */
314 +#include <asm/current.h> /* maybe for INIT_TASK_SIZE */
316 extern unsigned long event;