提交 50913336 编写于 作者: V Victor Kamensky 提交者: Russell King

ARM: 7895/1: signal: fix armv7-m build issue in sigreturn_codes.S

After "ARM: signal: sigreturn_codes should be endian neutral to
work in BE8" commit, thumb only platforms, like armv7m, fails to
compile sigreturn_codes.S. The reason is that for such arch
values '.arm' directive and arm opcodes are not allowed.

Fix conditionally enables arm opcodes only if no CONFIG_CPU_THUMBONLY
defined and it uses .org instructions to keep sigreturn_codes
layout.
Suggested-by: NDave Martin <Dave.Martin@arm.com>
Signed-off-by: NVictor Kamensky <victor.kamensky@linaro.org>
Tested-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: NDave Martin <Dave.Martin@arm.com>
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 67130c54
...@@ -30,6 +30,27 @@ ...@@ -30,6 +30,27 @@
* snippets. * snippets.
*/ */
/*
* In CPU_THUMBONLY case kernel arm opcodes are not allowed.
* Note in this case codes skips those instructions but it uses .org
* directive to keep correct layout of sigreturn_codes array.
*/
#ifndef CONFIG_CPU_THUMBONLY
#define ARM_OK(code...) code
#else
#define ARM_OK(code...)
#endif
.macro arm_slot n
.org sigreturn_codes + 12 * (\n)
ARM_OK( .arm )
.endm
.macro thumb_slot n
.org sigreturn_codes + 12 * (\n) + 8
.thumb
.endm
#if __LINUX_ARM_ARCH__ <= 4 #if __LINUX_ARM_ARCH__ <= 4
/* /*
* Note we manually set minimally required arch that supports * Note we manually set minimally required arch that supports
...@@ -45,26 +66,27 @@ ...@@ -45,26 +66,27 @@
.global sigreturn_codes .global sigreturn_codes
.type sigreturn_codes, #object .type sigreturn_codes, #object
.arm .align
sigreturn_codes: sigreturn_codes:
/* ARM sigreturn syscall code snippet */ /* ARM sigreturn syscall code snippet */
mov r7, #(__NR_sigreturn - __NR_SYSCALL_BASE) arm_slot 0
swi #(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE) ARM_OK( mov r7, #(__NR_sigreturn - __NR_SYSCALL_BASE) )
ARM_OK( swi #(__NR_sigreturn)|(__NR_OABI_SYSCALL_BASE) )
/* Thumb sigreturn syscall code snippet */ /* Thumb sigreturn syscall code snippet */
.thumb thumb_slot 0
movs r7, #(__NR_sigreturn - __NR_SYSCALL_BASE) movs r7, #(__NR_sigreturn - __NR_SYSCALL_BASE)
swi #0 swi #0
/* ARM sigreturn_rt syscall code snippet */ /* ARM sigreturn_rt syscall code snippet */
.arm arm_slot 1
mov r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE) ARM_OK( mov r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE) )
swi #(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE) ARM_OK( swi #(__NR_rt_sigreturn)|(__NR_OABI_SYSCALL_BASE) )
/* Thumb sigreturn_rt syscall code snippet */ /* Thumb sigreturn_rt syscall code snippet */
.thumb thumb_slot 1
movs r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE) movs r7, #(__NR_rt_sigreturn - __NR_SYSCALL_BASE)
swi #0 swi #0
...@@ -74,7 +96,7 @@ sigreturn_codes: ...@@ -74,7 +96,7 @@ sigreturn_codes:
* it is thumb case or not, so we need additional * it is thumb case or not, so we need additional
* word after real last entry. * word after real last entry.
*/ */
.arm arm_slot 2
.space 4 .space 4
.size sigreturn_codes, . - sigreturn_codes .size sigreturn_codes, . - sigreturn_codes
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册