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 <Ioannis.Glaropoulos@nordicsemi.no>
This commit is contained in:
Ioannis Glaropoulos 2019-10-14 00:20:38 +02:00 committed by Andrew Boie
commit a6accb3e75

View file

@ -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. */