diff options
author | Tom Hughes <tomhughes@chromium.org> | 2021-10-08 00:09:53 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-12 23:47:41 +0000 |
commit | e5f8a7323b80c999a862b0b73da58fb72e8980eb (patch) | |
tree | a4a7e4f9b04c6adcfaa65c6c124b1c4c918b3b39 /core/cortex-m0 | |
parent | 1cdedb45fd67ec24df9ac8190ed5f202e35db5e8 (diff) | |
download | chrome-ec-e5f8a7323b80c999a862b0b73da58fb72e8980eb.tar.gz |
core/cortex-m0: Use symbolic name instead of r0
With gcc, the generated assembly for exception_panic after this change
removes a "adds r0, r0, #0" instruction and a nop.
00000000 <exception_panic>:
0: 4b08 ldr r3, [pc, #32] ; (24 <exception_panic+0x24>)
2: 4809 ldr r0, [pc, #36] ; (28 <exception_panic+0x28>)
4: 469c mov ip, r3
; No more "adds r0, r0, #0" here
6: f3ef 8109 mrs r1, PSP
a: f3ef 8205 mrs r2, IPSR
e: 466b mov r3, sp
10: c0fe stmia r0!, {r1, r2, r3, r4, r5, r6, r7}
12: 4641 mov r1, r8
14: 464a mov r2, r9
16: 4653 mov r3, sl
18: 465c mov r4, fp
1a: 4675 mov r5, lr
1c: c03e stmia r0!, {r1, r2, r3, r4, r5}
1e: 46e5 mov sp, ip
20: f7ff fffe bl 0 <exception_panic>
; No more nop here
24: 20003f70 .word 0x20003f70
28: 20003f74 .word 0x20003f74
BRANCH=none
BUG=b:172020503
TEST=CC=clang make BOARD=c2d2
TEST=make buildall
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I5282369fd97a21b5927175adecff2ba74c4f8fc3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3213608
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'core/cortex-m0')
-rw-r--r-- | core/cortex-m0/panic.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/core/cortex-m0/panic.c b/core/cortex-m0/panic.c index b0fa1f4e1d..34519c73d4 100644 --- a/core/cortex-m0/panic.c +++ b/core/cortex-m0/panic.c @@ -146,17 +146,16 @@ void exception_panic(void) { /* Save registers and branch directly to panic handler */ asm volatile( - "mov r0, %[pregs]\n" "mrs r1, psp\n" "mrs r2, ipsr\n" "mov r3, sp\n" - "stmia r0!, {r1-r7}\n" + "stmia %[pregs]!, {r1-r7}\n" "mov r1, r8\n" "mov r2, r9\n" "mov r3, r10\n" "mov r4, r11\n" "mov r5, lr\n" - "stmia r0!, {r1-r5}\n" + "stmia %[pregs]!, {r1-r5}\n" "mov sp, %[pstack]\n" "bl report_panic\n" : : [pregs] "r" (pdata_ptr->cm.regs), |