Skip to content

Commit

Permalink
x86/entry/32: Move non entry code into .text section
Browse files Browse the repository at this point in the history
All ASM code which is not part of the entry functionality can move out into
the .text section. No reason to keep it in the non-instrumentable entry
section.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200505134340.320164650@linutronix.de
  • Loading branch information
Thomas Gleixner committed Jun 11, 2020
1 parent b9f6976 commit 8c0fa8a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions arch/x86/entry/entry_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@
* %eax: prev task
* %edx: next task
*/
.pushsection .text, "ax"
SYM_CODE_START(__switch_to_asm)
/*
* Save callee-saved registers
Expand Down Expand Up @@ -776,6 +777,7 @@ SYM_CODE_START(__switch_to_asm)

jmp __switch_to
SYM_CODE_END(__switch_to_asm)
.popsection

/*
* The unwinder expects the last frame on the stack to always be at the same
Expand All @@ -784,6 +786,7 @@ SYM_CODE_END(__switch_to_asm)
* asmlinkage function so its argument has to be pushed on the stack. This
* wrapper creates a proper "end of stack" frame header before the call.
*/
.pushsection .text, "ax"
SYM_FUNC_START(schedule_tail_wrapper)
FRAME_BEGIN

Expand All @@ -794,13 +797,16 @@ SYM_FUNC_START(schedule_tail_wrapper)
FRAME_END
ret
SYM_FUNC_END(schedule_tail_wrapper)
.popsection

/*
* A newly forked process directly context switches into this address.
*
* eax: prev task we switched from
* ebx: kernel thread func (NULL for user thread)
* edi: kernel thread arg
*/
.pushsection .text, "ax"
SYM_CODE_START(ret_from_fork)
call schedule_tail_wrapper

Expand All @@ -825,6 +831,7 @@ SYM_CODE_START(ret_from_fork)
movl $0, PT_EAX(%esp)
jmp 2b
SYM_CODE_END(ret_from_fork)
.popsection

/*
* Return to user mode is not as complex as all this looks,
Expand Down Expand Up @@ -1691,6 +1698,7 @@ SYM_CODE_START(general_protection)
jmp common_exception
SYM_CODE_END(general_protection)

.pushsection .text, "ax"
SYM_CODE_START(rewind_stack_do_exit)
/* Prevent any naive code from trying to unwind to our caller. */
xorl %ebp, %ebp
Expand All @@ -1701,3 +1709,4 @@ SYM_CODE_START(rewind_stack_do_exit)
call do_exit
1: jmp 1b
SYM_CODE_END(rewind_stack_do_exit)
.popsection

0 comments on commit 8c0fa8a

Please sign in to comment.