From a6accb3e759c2fd32a509b7fd596b060e3d3efe0 Mon Sep 17 00:00:00 2001 From: Ioannis Glaropoulos Date: Mon, 14 Oct 2019 00:20:38 +0200 Subject: [PATCH] arch: arm: swap-helper: simplify several assembly expressions Some assembly simplifications, to make code common for ARMv6 and ARMv7 architecture. We can use ldrb, directly for reading the SVC encoding; this removes the need for ANDing the result with 0xff right below. We remove an immediate value of 0 from an str instruction, as it's redundant. Signed-off-by: Ioannis Glaropoulos --- arch/arm/core/swap_helper.S | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm/core/swap_helper.S b/arch/arm/core/swap_helper.S index 2847afebeb1..2762f26fc72 100644 --- a/arch/arm/core/swap_helper.S +++ b/arch/arm/core/swap_helper.S @@ -429,7 +429,7 @@ SECTION_FUNC(TEXT, z_arm_svc) /* SVC is a two-byte instruction, point to it and read the * SVC number (lower byte of SCV instruction) */ - ldrh r1, [r1, #-2] + ldrb r1, [r1, #-2] /* * grab service call number: @@ -438,7 +438,6 @@ SECTION_FUNC(TEXT, z_arm_svc) * 2: kernel panic or oops (software generated fatal exception) * 3: System call (if user mode supported) */ - ands r1, #0xff #if defined(CONFIG_USERSPACE) mrs r2, CONTROL @@ -504,7 +503,7 @@ _do_syscall: blt valid_syscall_id /* bad syscall id. Set arg1 to bad id and set call_id to SYSCALL_BAD */ - str r6, [r0, #0] + str r6, [r0] ldr r6, =K_SYSCALL_BAD /* Bad syscalls treated as valid syscalls with ID K_SYSCALL_BAD. */