1 Index: linux-2.4.21-27.EL/include/asm-i386/hw_irq.h
2 ===================================================================
3 --- linux-2.4.21-27.EL.orig/include/asm-i386/hw_irq.h 2004-12-21 13:51:09.000000000 -0500
4 +++ linux-2.4.21-27.EL/include/asm-i386/hw_irq.h 2005-01-07 10:55:45.367690072 -0500
7 /* load the real stack - keep the offset */ \
10 + movl $- " STR(THREAD_SIZE) ", %ebx; \
12 movl 36(%ebx), %edx; \
14 - andl $0x1fff, %ebx; \
15 + andl $( " STR(THREAD_SIZE) "-1), %ebx; \
19 #define IRQ_NAME2(nr) nr##_interrupt(void)
20 #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
22 -#define GET_CURRENT \
23 - "movl %esp, %ebx\n\t" \
24 - "andl $-8192, %ebx\n\t"
27 * SMP has a few special interrupts for IPI messages
29 Index: linux-2.4.21-27.EL/include/asm-i386/processor.h
30 ===================================================================
31 --- linux-2.4.21-27.EL.orig/include/asm-i386/processor.h 2004-12-21 13:51:31.000000000 -0500
32 +++ linux-2.4.21-27.EL/include/asm-i386/processor.h 2005-01-07 10:55:45.376688704 -0500
34 #include <asm/types.h>
35 #include <asm/sigcontext.h>
36 #include <asm/cpufeature.h>
37 +#include <asm/current.h>
38 #include <linux/cache.h>
39 #include <linux/config.h>
40 #include <linux/threads.h>
42 #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019])
43 #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022])
45 -#define THREAD_SIZE (2*PAGE_SIZE)
46 -#define __alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
47 -#define __free_task_struct(p) do { BUG_ON((p)->state < TASK_ZOMBIE); free_pages((unsigned long) (p), 1); } while (0)
49 #define init_task (init_task_union.task)
50 #define init_stack (init_task_union.stack)
52 Index: linux-2.4.21-27.EL/include/asm-i386/current.h
53 ===================================================================
54 --- linux-2.4.21-27.EL.orig/include/asm-i386/current.h 1998-08-14 19:35:22.000000000 -0400
55 +++ linux-2.4.21-27.EL/include/asm-i386/current.h 2005-01-07 10:55:45.356691744 -0500
57 #ifndef _I386_CURRENT_H
58 #define _I386_CURRENT_H
59 +#include <asm/page.h>
62 + * Configurable page sizes on i386, mainly for debugging purposes.
66 +/* enumerate the values, include/asm-i386/hw_irq.h in particular needs this */
67 +#if (PAGE_SIZE != 4096)
68 +#error PAGE_SIZE != 4096 unsupported
71 +#if (CONFIG_STACK_SIZE_SHIFT == 0)
72 +#define THREAD_SIZE 4096
73 +#elif (CONFIG_STACK_SIZE_SHIFT == 1)
74 +#define THREAD_SIZE 8192
75 +#elif (CONFIG_STACK_SIZE_SHIFT == 2)
76 +#define THREAD_SIZE 16384
77 +#elif (CONFIG_STACK_SIZE_SHIFT == 3)
78 +#define THREAD_SIZE 32768
79 +#elif (CONFIG_STACK_SIZE_SHIFT == 4)
80 +#define THREAD_SIZE 65536
82 +#error CONFIG_STACK_SIZE_SHIFT > 4 unsupported
85 +#if (CONFIG_STACK_SIZE_SHIFT != 1) && defined(CONFIG_X86_4G)
86 +#error Large stacks with 4G/4G split unsupported
91 +#define GET_CURRENT(reg) \
92 + movl $-THREAD_SIZE, reg; \
95 +#else /* __ASSEMBLY__ */
97 +#define __alloc_task_struct() \
98 + ((struct task_struct *) __get_free_pages(GFP_KERNEL, CONFIG_STACK_SIZE_SHIFT))
100 +#define __free_task_struct(p) do { \
101 + BUG_ON((p)->state < TASK_ZOMBIE); \
102 + free_pages((unsigned long) (p), CONFIG_STACK_SIZE_SHIFT); \
105 +#define INIT_TASK_SIZE THREAD_SIZE
109 static inline struct task_struct * get_current(void)
111 struct task_struct *current;
112 - __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
113 + __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~(THREAD_SIZE - 1)));
117 #define current get_current()
119 +#endif /* __ASSEMBLY__ */
121 #endif /* !(_I386_CURRENT_H) */
122 Index: linux-2.4.21-27.EL/include/asm-x86_64/processor.h
123 ===================================================================
124 --- linux-2.4.21-27.EL.orig/include/asm-x86_64/processor.h 2004-12-21 13:51:31.000000000 -0500
125 +++ linux-2.4.21-27.EL/include/asm-x86_64/processor.h 2005-01-07 10:58:24.167548824 -0500
127 /* Note: most of the infrastructure to separate stack and task_struct
128 are already there. When you run out of stack try this first. */
130 -#define __alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
131 -#define __free_task_struct(p) free_pages((unsigned long) (p), 1)
132 +#define __alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL, THREAD_ORDER))
133 +#define __free_task_struct(p) free_pages((unsigned long) (p), THREAD_ORDER)
135 #define init_task (init_task_union.task)
136 #define init_stack (init_task_union.stack)
137 Index: linux-2.4.21-27.EL/include/asm-x86_64/page.h
138 ===================================================================
139 --- linux-2.4.21-27.EL.orig/include/asm-x86_64/page.h 2004-12-21 13:51:10.000000000 -0500
140 +++ linux-2.4.21-27.EL/include/asm-x86_64/page.h 2005-01-07 10:55:45.404684448 -0500
142 /* We still hope 8K is enough, but ... */
143 /* Currently it is actually ~6k. This would change when task_struct moves into
145 -#define THREAD_ORDER 1
146 -#define THREAD_SIZE (2*PAGE_SIZE)
147 +#define THREAD_ORDER CONFIG_STACK_SIZE_SHIFT
148 +#define THREAD_SIZE ((1 << CONFIG_STACK_SIZE_SHIFT) * PAGE_SIZE)
150 #define INIT_TASK_SIZE THREAD_SIZE
151 #define CURRENT_MASK (~(THREAD_SIZE-1))
152 Index: linux-2.4.21-27.EL/include/asm-x86_64/current.h
153 ===================================================================
154 --- linux-2.4.21-27.EL.orig/include/asm-x86_64/current.h 2002-11-28 18:53:15.000000000 -0500
155 +++ linux-2.4.21-27.EL/include/asm-x86_64/current.h 2005-01-07 10:55:45.394685968 -0500
160 +#include <asm/page.h>
162 static inline struct task_struct *get_current(void)
164 Index: linux-2.4.21-27.EL/arch/x86_64/config.in
165 ===================================================================
166 --- linux-2.4.21-27.EL.orig/arch/x86_64/config.in 2004-12-21 13:51:30.000000000 -0500
167 +++ linux-2.4.21-27.EL/arch/x86_64/config.in 2005-01-07 10:55:45.324696608 -0500
169 define_bool CONFIG_NUMA y
172 +choice 'Bigger Stack Size Support' \
173 + "off CONFIG_NOBIGSTACK \
174 + 16KB CONFIG_STACK_SIZE_16KB \
175 + 32KB CONFIG_STACK_SIZE_32KB \
176 + 64KB CONFIG_STACK_SIZE_64KB" off
178 +if [ "$CONFIG_NOBIGSTACK" = "y" ]; then
179 + define_int CONFIG_STACK_SIZE_SHIFT 1
181 + if [ "$CONFIG_STACK_SIZE_16KB" = "y" ]; then
182 + define_int CONFIG_STACK_SIZE_SHIFT 2
184 + if [ "$CONFIG_STACK_SIZE_32KB" = "y" ]; then
185 + define_int CONFIG_STACK_SIZE_SHIFT 3
187 + if [ "$CONFIG_STACK_SIZE_64KB" = "y" ]; then
188 + define_int CONFIG_STACK_SIZE_SHIFT 4
196 mainmenu_option next_comment
197 Index: linux-2.4.21-27.EL/arch/x86_64/kernel/smpboot.c
198 ===================================================================
199 --- linux-2.4.21-27.EL.orig/arch/x86_64/kernel/smpboot.c 2004-12-21 13:51:01.000000000 -0500
200 +++ linux-2.4.21-27.EL/arch/x86_64/kernel/smpboot.c 2005-01-07 10:55:45.325696456 -0500
202 Dprintk("CPU has booted.\n");
205 - if (*((volatile unsigned char *)phys_to_virt(8192))
206 + if (*((volatile unsigned char *)phys_to_virt(THREAD_SIZE))
208 /* trampoline started but...? */
209 printk("Stuck ??\n");
213 /* mark "stuck" area as not stuck */
214 - *((volatile unsigned int *)phys_to_virt(8192)) = 0;
215 + *((volatile unsigned int *)phys_to_virt(THREAD_SIZE)) = 0;
219 Index: linux-2.4.21-27.EL/arch/x86_64/kernel/traps.c
220 ===================================================================
221 --- linux-2.4.21-27.EL.orig/arch/x86_64/kernel/traps.c 2004-12-21 13:51:15.000000000 -0500
222 +++ linux-2.4.21-27.EL/arch/x86_64/kernel/traps.c 2005-01-07 10:55:45.326696304 -0500
224 unsigned long rsp = tsk->thread.rsp;
226 /* User space on another CPU? */
227 - if ((rsp ^ (unsigned long)tsk) & (PAGE_MASK<<1))
228 + if ((rsp ^ (unsigned long)tsk) & ~(THREAD_SIZE - 1))
230 show_trace((unsigned long *)rsp);
232 Index: linux-2.4.21-27.EL/arch/x86_64/vmlinux.lds
233 ===================================================================
234 --- linux-2.4.21-27.EL.orig/arch/x86_64/vmlinux.lds 2003-06-13 10:51:32.000000000 -0400
235 +++ linux-2.4.21-27.EL/arch/x86_64/vmlinux.lds 2005-01-07 10:55:45.327696152 -0500
237 .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT (LOADADDR(.vsyscall_0) + 1024) { *(.vsyscall_1) }
238 . = LOADADDR(.vsyscall_0) + 4096;
240 - . = ALIGN(8192); /* init_task */
241 +/* chose the biggest of the possible stack sizes here? */
242 + . = ALIGN(65536); /* init_task */
243 .data.init_task : { *(.data.init_task) }
246 Index: linux-2.4.21-27.EL/arch/i386/config.in
247 ===================================================================
248 --- linux-2.4.21-27.EL.orig/arch/i386/config.in 2004-12-21 13:51:31.000000000 -0500
249 +++ linux-2.4.21-27.EL/arch/i386/config.in 2005-01-07 10:55:45.324696608 -0500
254 +choice 'Bigger Stack Size Support' \
255 + "off CONFIG_NOBIGSTACK \
256 + 16KB CONFIG_STACK_SIZE_16KB \
257 + 32KB CONFIG_STACK_SIZE_32KB \
258 + 64KB CONFIG_STACK_SIZE_64KB" off
260 +if [ "$CONFIG_NOBIGSTACK" = "y" ]; then
261 + define_int CONFIG_STACK_SIZE_SHIFT 1
263 + if [ "$CONFIG_STACK_SIZE_16KB" = "y" ]; then
264 + define_int CONFIG_STACK_SIZE_SHIFT 2
266 + if [ "$CONFIG_STACK_SIZE_32KB" = "y" ]; then
267 + define_int CONFIG_STACK_SIZE_SHIFT 3
269 + if [ "$CONFIG_STACK_SIZE_64KB" = "y" ]; then
270 + define_int CONFIG_STACK_SIZE_SHIFT 4
276 if [ "$CONFIG_SMP" = "y" -a "$CONFIG_X86_CMPXCHG" = "y" ]; then
277 define_bool CONFIG_HAVE_DEC_LOCK y
279 Index: linux-2.4.21-27.EL/arch/i386/kernel/entry.S
280 ===================================================================
281 --- linux-2.4.21-27.EL.orig/arch/i386/kernel/entry.S 2004-12-21 13:51:31.000000000 -0500
282 +++ linux-2.4.21-27.EL/arch/i386/kernel/entry.S 2005-01-07 10:55:45.271704664 -0500
284 #include <asm/segment.h>
285 #include <asm/page.h>
287 +#include <asm/current.h>
288 #include <asm/unistd.h>
295 -#define GET_CURRENT(reg) \
296 - movl $-8192, reg; \
299 #if CONFIG_X86_HIGH_ENTRY
301 #define call_SYMBOL_NAME_ABS(X) movl $X, %ebp; call *%ebp
304 movl real_stack(%ebx), %edx; \
306 - andl $0x1fff, %ebx; \
307 + andl $(THREAD_SIZE-1), %ebx; \
312 return_path_start_marker: \
315 - andl $0x1fff, %ebx; \
316 + andl $(THREAD_SIZE-1), %ebx; \
320 Index: linux-2.4.21-27.EL/arch/i386/kernel/irq.c
321 ===================================================================
322 --- linux-2.4.21-27.EL.orig/arch/i386/kernel/irq.c 2004-12-21 13:51:22.000000000 -0500
323 +++ linux-2.4.21-27.EL/arch/i386/kernel/irq.c 2005-01-07 10:55:45.307699192 -0500
325 #include <asm/delay.h>
326 #include <asm/desc.h>
328 +#include <asm/current.h>
335 /* Debugging check for stack overflow: is there less than 1KB free? */
336 - __asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : "0" (8191));
337 + __asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : "0" (THREAD_SIZE-1));
338 if (unlikely(esp < (sizeof(struct task_struct) + 1024))) {
339 extern void show_stack(unsigned long *);
341 Index: linux-2.4.21-27.EL/arch/i386/kernel/smpboot.c
342 ===================================================================
343 --- linux-2.4.21-27.EL.orig/arch/i386/kernel/smpboot.c 2004-12-21 13:51:01.000000000 -0500
344 +++ linux-2.4.21-27.EL/arch/i386/kernel/smpboot.c 2005-01-07 10:55:45.305699496 -0500
347 /* So we see what's up */
348 printk("Booting processor %d/%d eip %lx\n", cpu, apicid, start_eip);
349 - stack_start.esp = (void *) (1024 + PAGE_SIZE + (char *)idle);
350 + stack_start.esp = (void *)idle->thread.esp;
353 * This grunge runs the startup process for
355 Dprintk("CPU has booted.\n");
358 - if (*((volatile unsigned char *)phys_to_virt(8192))
359 + if (*((volatile unsigned char *)phys_to_virt(THREAD_SIZE))
361 /* trampoline started but...? */
362 printk("Stuck ??\n");
366 /* mark "stuck" area as not stuck */
367 - *((volatile unsigned long *)phys_to_virt(8192)) = 0;
368 + *((volatile unsigned long *)phys_to_virt(THREAD_SIZE)) = 0;
370 if(clustered_apic_mode == CLUSTERED_APIC_NUMAQ) {
371 printk("Restoring NMI vector\n");
372 Index: linux-2.4.21-27.EL/arch/i386/kernel/traps.c
373 ===================================================================
374 --- linux-2.4.21-27.EL.orig/arch/i386/kernel/traps.c 2004-12-21 13:51:15.000000000 -0500
375 +++ linux-2.4.21-27.EL/arch/i386/kernel/traps.c 2005-01-07 10:55:45.306699344 -0500
377 unsigned long esp = tsk->thread.esp;
379 /* User space on another CPU? */
380 - if ((esp ^ (unsigned long)tsk) & (PAGE_MASK<<1))
381 + if ((esp ^ (unsigned long)tsk) & ~(THREAD_SIZE - 1))
383 show_trace((unsigned long *)esp);
385 Index: linux-2.4.21-27.EL/arch/i386/kernel/head.S
386 ===================================================================
387 --- linux-2.4.21-27.EL.orig/arch/i386/kernel/head.S 2004-12-21 13:51:07.000000000 -0500
388 +++ linux-2.4.21-27.EL/arch/i386/kernel/head.S 2005-01-07 10:55:45.307699192 -0500
390 #include <asm/page.h>
391 #include <asm/pgtable.h>
392 #include <asm/desc.h>
393 +#include <asm/current.h>
395 #define OLD_CL_MAGIC_ADDR 0x90020
396 #define OLD_CL_MAGIC 0xA33F
401 - .long SYMBOL_NAME(init_task_union)+8192
402 + .long SYMBOL_NAME(init_task_union)+THREAD_SIZE
405 /* This is the default interrupt "handler" :-) */
406 Index: linux-2.4.21-27.EL/arch/i386/lib/getuser.S
407 ===================================================================
408 --- linux-2.4.21-27.EL.orig/arch/i386/lib/getuser.S 1998-01-12 16:42:52.000000000 -0500
409 +++ linux-2.4.21-27.EL/arch/i386/lib/getuser.S 2005-01-07 10:55:45.323696760 -0500
411 * as they get called from within inline assembly.
414 +/* Duplicated from asm/processor.h */
415 +#include <asm/current.h>
416 +#include <linux/config.h>
425 - andl $0xffffe000,%edx
426 + andl $~(THREAD_SIZE - 1),%edx
427 cmpl addr_limit(%edx),%eax
429 1: movzbl (%eax),%edx
434 - andl $0xffffe000,%edx
435 + andl $~(THREAD_SIZE - 1),%edx
436 cmpl addr_limit(%edx),%eax
438 2: movzwl -1(%eax),%edx
443 - andl $0xffffe000,%edx
444 + andl $~(THREAD_SIZE - 1),%edx
445 cmpl addr_limit(%edx),%eax
447 3: movl -3(%eax),%edx
448 Index: linux-2.4.21-27.EL/arch/i386/vmlinux.lds.in
449 ===================================================================
450 --- linux-2.4.21-27.EL.orig/arch/i386/vmlinux.lds.in 2004-12-21 13:51:08.000000000 -0500
451 +++ linux-2.4.21-27.EL/arch/i386/vmlinux.lds.in 2005-01-07 10:55:45.324696608 -0500
455 #include <asm/page.h>
456 +#include <asm/current.h>
458 /* ld script to make i386 Linux kernel
459 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>;
462 _edata = .; /* End of data section */
464 - . = ALIGN(8192); /* init_task */
465 + . = ALIGN(THREAD_SIZE); /* init_task */
466 .data.init_task : { *(.data.init_task) }
468 entry_tramp_start = .;