Skip to content

Commit 5029e44

Browse files
committed
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 <[email protected]>
1 parent 6b8ed7e commit 5029e44

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

arch/arm/core/swap_helper.S

+2-3
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ SECTION_FUNC(TEXT, z_arm_svc)
429429
/* SVC is a two-byte instruction, point to it and read the
430430
* SVC number (lower byte of SCV instruction)
431431
*/
432-
ldrh r1, [r1, #-2]
432+
ldrb r1, [r1, #-2]
433433

434434
/*
435435
* grab service call number:
@@ -438,7 +438,6 @@ SECTION_FUNC(TEXT, z_arm_svc)
438438
* 2: kernel panic or oops (software generated fatal exception)
439439
* 3: System call (if user mode supported)
440440
*/
441-
ands r1, #0xff
442441
#if defined(CONFIG_USERSPACE)
443442
mrs r2, CONTROL
444443

@@ -504,7 +503,7 @@ _do_syscall:
504503
blt valid_syscall_id
505504

506505
/* bad syscall id. Set arg1 to bad id and set call_id to SYSCALL_BAD */
507-
str r6, [r0, #0]
506+
str r6, [r0]
508507
ldr r6, =K_SYSCALL_BAD
509508

510509
/* Bad syscalls treated as valid syscalls with ID K_SYSCALL_BAD. */

0 commit comments

Comments
 (0)