diff options
author | Tom Hughes <tomhughes@chromium.org> | 2021-09-28 23:55:52 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-09-30 19:42:27 +0000 |
commit | 31baa7449eacf1285219b29bf81a7cbe8239e10d (patch) | |
tree | a2d61c68bc68d0414aa9733029269ac680c9353d /core | |
parent | b1a26856d1b615368bc3e1db6ed96098bd514482 (diff) | |
download | chrome-ec-31baa7449eacf1285219b29bf81a7cbe8239e10d.tar.gz |
core/minute-ia: Fix inline asm
clang produces the following warning:
core/minute-ia/panic.c:119:19: error: variable 'eax' is uninitialized when used
here [-Werror,-Wuninitialized]
pdata->x86.eax = eax;
^~~
core/minute-ia/panic.c:109:23: note: initialize the variable 'eax' to silence
this warning
register uint32_t eax asm("eax");
When specifying registers for local variables they need to be specified as
constraints on an asm block:
https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html#Local-Register-Variables
In this case we simply use an empty asm block since we're just trying to
extract the values of the registers.
As indicated by the TEST line, the output is identical before and after
this change.
BRANCH=none
BUG=b:172020503
TEST=make CC=clang V=1 BOARD=arcada_ish
TEST=./util/compare_build.sh -b all -j 70
=> MATCH
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I6fbd7061d9af734f02ec3dbb1329cdffac5e2a7d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3193276
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/minute-ia/panic.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/minute-ia/panic.c b/core/minute-ia/panic.c index acaee72496..b4299d9e17 100644 --- a/core/minute-ia/panic.c +++ b/core/minute-ia/panic.c @@ -105,6 +105,7 @@ void exception_panic( * already. */ static int panic_once; + struct panic_data *pdata; register uint32_t eax asm("eax"); register uint32_t ebx asm("ebx"); @@ -112,8 +113,10 @@ void exception_panic( register uint32_t edx asm("edx"); register uint32_t esi asm("esi"); register uint32_t edi asm("edi"); + asm("" + : "=r"(eax), "=r"(ebx), "=r"(ecx), "=r"(edx), "=r"(esi), "=r"(edi)); - struct panic_data * const pdata = get_panic_data_write(); + pdata = get_panic_data_write(); /* Save registers to global panic structure */ pdata->x86.eax = eax; |