arm: Move excnames[] array into arm_log_exceptions()

The excnames[] array is defined in internals.h because we used
to use it from two different source files for handling logging
of AArch32 and AArch64 exception entry. Refactoring means that
it's now used only in arm_log_exception() in helper.c, so move
the array into that function.

Backports commit 2c4a7cc5afb1bfc1728a39abd951ddd7714c476e from qemu
This commit is contained in:
Peter Maydell 2018-03-02 14:39:35 -05:00 committed by Lioncash
parent 1af1944903
commit 1cf80d7536
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
3 changed files with 22 additions and 26 deletions

View file

@ -62,7 +62,7 @@
#define EXCP_SEMIHOST 16 /* semihosting call */
#define EXCP_NOCP 17 /* v7M NOCP UsageFault */
#define EXCP_INVSTATE 18 /* v7M INVSTATE UsageFault */
/* NB: new EXCP_ defines should be added to the excnames[] array too */
/* NB: add new EXCP_ defines to the array in arm_log_exception() too */
#define ARMV7M_EXCP_RESET 1
#define ARMV7M_EXCP_NMI 2

View file

@ -5384,6 +5384,27 @@ static void arm_log_exception(int idx)
{
if (qemu_loglevel_mask(CPU_LOG_INT)) {
const char *exc = NULL;
static const char * const excnames[] = {
NULL,
"Undefined Instruction",
"SVC",
"Prefetch Abort",
"Data Abort",
"IRQ",
"FIQ",
"Breakpoint",
"QEMU v7M exception exit",
"QEMU intercept of kernel commpage",
NULL,
"Hypervisor Call",
"Hypervisor Trap",
"Secure Monitor Call",
"Virtual IRQ",
"Virtual FIQ",
"Semihosting call",
"v7M NOCP UsageFault",
"v7M INVSTATE UsageFault",
};
if (idx >= 0 && idx < ARRAY_SIZE(excnames)) {
exc = excnames[idx];

View file

@ -51,31 +51,6 @@ static inline bool excp_is_internal(int excp)
|| excp == EXCP_SEMIHOST;
}
/* Exception names for debug logging; note that not all of these
* precisely correspond to architectural exceptions.
*/
static const char * const excnames[] = {
NULL,
"Undefined Instruction",
"SVC",
"Prefetch Abort",
"Data Abort",
"IRQ",
"FIQ",
"Breakpoint",
"QEMU v7M exception exit",
"QEMU intercept of kernel commpage",
NULL,
"Hypervisor Call",
"Hypervisor Trap",
"Secure Monitor Call",
"Virtual IRQ",
"Virtual FIQ",
"Semihosting call",
"v7M NOCP UsageFault",
"v7M INVSTATE UsageFault",
};
/* Scale factor for generic timers, ie number of ns per tick.
* This gives a 62.5MHz timer.
*/