From: Marc Fiuczynski Date: Thu, 16 Dec 2004 08:59:09 +0000 (+0000) Subject: Moved code around to fix bug related to ".previous" section definition. X-Git-Tag: before-shares_write_debug-merge~23 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=af2e2b2b94335ea396de327b74cca00ff37d4e26;p=linux-2.6.git Moved code around to fix bug related to ".previous" section definition. --- diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S index 5906954c8..4ca841e0a 100644 --- a/arch/i386/kernel/entry.S +++ b/arch/i386/kernel/entry.S @@ -734,62 +734,9 @@ ENTRY(spurious_interrupt_bug) pushl $do_spurious_interrupt_bug jmp error_code -#ifdef CONFIG_X86_STACK_CHECK -ENTRY(mcount) - push %eax - movl $(THREAD_SIZE - 1),%eax - andl %esp,%eax - cmpl $STACK_WARN,%eax /* esp reaches into STACK_WARN space */ - jle 1f -2: - popl %eax - ret -1: - lock; btsl $0,stack_overflowed - jc 2b - - # switch to overflow stack - movl %esp,%eax - movl $(stack_overflow_stack + THREAD_SIZE - 4),%esp - - pushf - cli - pushl %eax - - # push eip then esp of error for stack_overflow_panic - pushl 4(%eax) - pushl %eax - - # update the task pointer and cpu in the overflow stack's thread_info. - GET_THREAD_INFO_WITH_ESP(%eax) - movl TI_task(%eax),%ebx - movl %ebx,stack_overflow_stack+TI_task - movl TI_cpu(%eax),%ebx - movl %ebx,stack_overflow_stack+TI_cpu - - call stack_overflow - - # pop off call arguments - addl $8,%esp - - popl %eax - popf - movl %eax,%esp - popl %eax - movl $0,stack_overflowed - ret -#warning stack check enabled -#endif - .previous .data -#ifdef CONFIG_X86_STACK_CHECK - .globl stack_overflowed -stack_overflowed: - .long 0 -#endif - ENTRY(sys_call_table) .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */ .long sys_exit @@ -1087,3 +1034,57 @@ ENTRY(sys_call_table) .long sys_ioprio_get /* 285 */ syscall_table_size=(.-sys_call_table) + +#ifdef CONFIG_X86_STACK_CHECK +.data +.globl stack_overflowed +stack_overflowed: + .long 0 +.text + +ENTRY(mcount) + push %eax + movl $(THREAD_SIZE - 1),%eax + andl %esp,%eax + cmpl $STACK_WARN,%eax /* more than half the stack is used*/ + jle 1f +2: + popl %eax + ret +1: + lock; btsl $0,stack_overflowed + jc 2b + + # switch to overflow stack + movl %esp,%eax + movl $(stack_overflow_stack + THREAD_SIZE - 4),%esp + + pushf + cli + pushl %eax + + # push eip then esp of error for stack_overflow_panic + pushl 4(%eax) + pushl %eax + + # update the task pointer and cpu in the overflow stack's thread_info. + GET_THREAD_INFO_WITH_ESP(%eax) + movl TI_task(%eax),%ebx + movl %ebx,stack_overflow_stack+TI_task + movl TI_cpu(%eax),%ebx + movl %ebx,stack_overflow_stack+TI_cpu + + call stack_overflow + + # pop off call arguments + addl $8,%esp + + popl %eax + popf + movl %eax,%esp + popl %eax + movl $0,stack_overflowed + ret + +#warning stack check enabled +#endif