1 Index: linux-2.4.21/arch/i386/kernel/entry.S
2 ===================================================================
3 --- linux-2.4.21.orig/arch/i386/kernel/entry.S 2004-04-24 02:39:01.000000000 -0400
4 +++ linux-2.4.21/arch/i386/kernel/entry.S 2004-04-24 02:42:58.000000000 -0400
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/arch/i386/kernel/smpboot.c
43 ===================================================================
44 --- linux-2.4.21.orig/arch/i386/kernel/smpboot.c 2004-04-24 02:39:05.000000000 -0400
45 +++ linux-2.4.21/arch/i386/kernel/smpboot.c 2004-04-24 02:42:58.000000000 -0400
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/arch/i386/kernel/traps.c
74 ===================================================================
75 --- linux-2.4.21.orig/arch/i386/kernel/traps.c 2004-04-24 02:39:18.000000000 -0400
76 +++ linux-2.4.21/arch/i386/kernel/traps.c 2004-04-24 02:42:58.000000000 -0400
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/arch/i386/kernel/head.S
87 ===================================================================
88 --- linux-2.4.21.orig/arch/i386/kernel/head.S 2004-04-24 02:38:42.000000000 -0400
89 +++ linux-2.4.21/arch/i386/kernel/head.S 2004-04-24 02:42:58.000000000 -0400
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/arch/i386/kernel/irq.c
108 ===================================================================
109 --- linux-2.4.21.orig/arch/i386/kernel/irq.c 2004-04-24 02:39:18.000000000 -0400
110 +++ linux-2.4.21/arch/i386/kernel/irq.c 2004-04-24 02:44:26.000000000 -0400
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));
120 if (unlikely(esp < (sizeof(struct task_struct) + sysctl_stackwarn))) {
121 static unsigned long next_jiffies; /* ratelimiting */
122 static long least_esp = THREAD_SIZE;
123 Index: linux-2.4.21/arch/i386/lib/getuser.S
124 ===================================================================
125 --- linux-2.4.21.orig/arch/i386/lib/getuser.S 1998-01-12 16:42:52.000000000 -0500
126 +++ linux-2.4.21/arch/i386/lib/getuser.S 2004-04-24 02:42:58.000000000 -0400
128 * as they get called from within inline assembly.
131 +/* Duplicated from asm/processor.h */
132 +#include <asm/current.h>
133 +#include <linux/config.h>
142 - andl $0xffffe000,%edx
143 + andl $~(THREAD_SIZE - 1),%edx
144 cmpl addr_limit(%edx),%eax
146 1: movzbl (%eax),%edx
151 - andl $0xffffe000,%edx
152 + andl $~(THREAD_SIZE - 1),%edx
153 cmpl addr_limit(%edx),%eax
155 2: movzwl -1(%eax),%edx
160 - andl $0xffffe000,%edx
161 + andl $~(THREAD_SIZE - 1),%edx
162 cmpl addr_limit(%edx),%eax
164 3: movl -3(%eax),%edx
165 Index: linux-2.4.21/arch/i386/config.in
166 ===================================================================
167 --- linux-2.4.21.orig/arch/i386/config.in 2004-04-24 02:39:21.000000000 -0400
168 +++ linux-2.4.21/arch/i386/config.in 2004-04-24 02:42:58.000000000 -0400
170 if [ "$CONFIG_SMP" = "y" -a "$CONFIG_X86_CMPXCHG" = "y" ]; then
171 define_bool CONFIG_HAVE_DEC_LOCK y
174 +choice 'Bigger Stack Size Support' \
175 + "off CONFIG_NOBIGSTACK \
176 + 16KB CONFIG_STACK_SIZE_16KB \
177 + 32KB CONFIG_STACK_SIZE_32KB \
178 + 64KB CONFIG_STACK_SIZE_64KB" off
180 +if [ "$CONFIG_NOBIGSTACK" = "y" ]; then
181 + define_int CONFIG_STACK_SIZE_SHIFT 1
183 + if [ "$CONFIG_STACK_SIZE_16KB" = "y" ]; then
184 + define_int CONFIG_STACK_SIZE_SHIFT 2
186 + if [ "$CONFIG_STACK_SIZE_32KB" = "y" ]; then
187 + define_int CONFIG_STACK_SIZE_SHIFT 3
189 + if [ "$CONFIG_STACK_SIZE_64KB" = "y" ]; then
190 + define_int CONFIG_STACK_SIZE_SHIFT 4
198 mainmenu_option next_comment
199 Index: linux-2.4.21/arch/i386/vmlinux.lds.S
200 ===================================================================
201 --- linux-2.4.21.orig/arch/i386/vmlinux.lds.S 2004-04-24 02:38:06.000000000 -0400
202 +++ linux-2.4.21/arch/i386/vmlinux.lds.S 2004-04-24 02:42:58.000000000 -0400
205 _edata = .; /* End of data section */
207 - . = ALIGN(8192); /* init_task */
208 +/* chose the biggest of the possible stack sizes here? */
209 + . = ALIGN(65536); /* init_task */
210 .data.init_task : { *(.data.init_task) }
212 . = ALIGN(4096); /* Init code and data */
213 Index: linux-2.4.21/include/asm-i386/current.h
214 ===================================================================
215 --- linux-2.4.21.orig/include/asm-i386/current.h 1998-08-14 19:35:22.000000000 -0400
216 +++ linux-2.4.21/include/asm-i386/current.h 2004-04-24 02:42:58.000000000 -0400
218 #ifndef _I386_CURRENT_H
219 #define _I386_CURRENT_H
220 +#include <asm/page.h>
223 + * Configurable page sizes on i386, mainly for debugging purposes.
229 +#define PAGE_SIZE 4096 /* as cannot handle 1UL << 12 */
230 +#define THREAD_SIZE ((1 << CONFIG_STACK_SIZE_SHIFT) * PAGE_SIZE)
232 +#define GET_CURRENT(reg) \
233 + movl $-THREAD_SIZE, reg; \
236 +#else /* __ASSEMBLY__ */
238 +#define THREAD_SIZE ((1 << CONFIG_STACK_SIZE_SHIFT) * PAGE_SIZE)
239 +#define alloc_task_struct() \
240 + ((struct task_struct *) __get_free_pages(GFP_KERNEL,CONFIG_STACK_SIZE_SHIFT))
242 +#define free_task_struct(p) \
243 + free_pages((unsigned long) (p), CONFIG_STACK_SIZE_SHIFT)
245 +#define INIT_TASK_SIZE THREAD_SIZE
249 static inline struct task_struct * get_current(void)
251 struct task_struct *current;
252 - __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
253 + __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~(THREAD_SIZE - 1)));
257 #define current get_current()
259 +#endif /* __ASSEMBLY__ */
261 #endif /* !(_I386_CURRENT_H) */
262 Index: linux-2.4.21/include/asm-i386/hw_irq.h
263 ===================================================================
264 --- linux-2.4.21.orig/include/asm-i386/hw_irq.h 2004-04-24 02:39:05.000000000 -0400
265 +++ linux-2.4.21/include/asm-i386/hw_irq.h 2004-04-24 02:42:58.000000000 -0400
267 #include <linux/sched.h>
268 #include <asm/atomic.h>
270 +#include <asm/current.h>
273 * IDT vectors usable for external interrupt sources start
275 #define IRQ_NAME2(nr) nr##_interrupt(void)
276 #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
278 -#define GET_CURRENT \
279 - "movl %esp, %ebx\n\t" \
280 - "andl $-8192, %ebx\n\t"
283 * SMP has a few special interrupts for IPI messages
285 Index: linux-2.4.21/include/asm-i386/processor.h
286 ===================================================================
287 --- linux-2.4.21.orig/include/asm-i386/processor.h 2004-04-24 02:39:21.000000000 -0400
288 +++ linux-2.4.21/include/asm-i386/processor.h 2004-04-24 02:42:58.000000000 -0400
290 #include <asm/types.h>
291 #include <asm/sigcontext.h>
292 #include <asm/cpufeature.h>
293 +#include <asm/current.h>
294 #include <linux/cache.h>
295 #include <linux/config.h>
296 #include <linux/threads.h>
298 #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019])
299 #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022])
301 -#define THREAD_SIZE (2*PAGE_SIZE)
302 -#define alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
303 -#define free_task_struct(p) free_pages((unsigned long) (p), 1)
304 #define get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count)
306 #define init_task (init_task_union.task)
307 Index: linux-2.4.21/include/linux/sched.h
308 ===================================================================
309 --- linux-2.4.21.orig/include/linux/sched.h 2004-04-24 02:39:20.000000000 -0400
310 +++ linux-2.4.21/include/linux/sched.h 2004-04-24 02:42:58.000000000 -0400
312 #define _LINUX_SCHED_H
314 #include <asm/param.h> /* for HZ */
315 +#include <asm/current.h> /* maybe for INIT_TASK_SIZE */
317 extern unsigned long event;
319 Index: linux-2.4.21/include/asm-x86_64/current.h
320 ===================================================================
321 --- linux-2.4.21.orig/include/asm-x86_64/current.h 2002-11-28 18:53:15.000000000 -0500
322 +++ linux-2.4.21/include/asm-x86_64/current.h 2004-04-24 02:42:58.000000000 -0400
327 +#include <asm/page.h>
329 static inline struct task_struct *get_current(void)