[PATCH 05/18] arm/arm64: processor.[ch] cleanups

Andrew Jones
2015-02-01T18:35:02Z

Add 'const' to a few global arrays that are constant. Also,
no need for default_vector_handler to be static. unittests
may want to reset vector handlers to it.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
lib/arm/processor.c | 2 +-
lib/arm64/asm/processor.h | 2 ++
lib/arm64/processor.c | 8 ++++----
3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/lib/arm/processor.c b/lib/arm/processor.c
index f8bd94cbb8bc6..5ad999c6b378b 100644
--- a/lib/arm/processor.c
+++ b/lib/arm/processor.c
@@ -20,7 +20,7 @@ static const char *processor_modes[] = {
"UK12_32", "UK13_32", "UK14_32", "SYS_32"
};

-static char *vector_names[] = {
+static const char *vector_names[] = {
"rst", "und", "svc", "pabt", "dabt", "addrexcptn", "irq", "fiq"
};

diff --git a/lib/arm64/asm/processor.h b/lib/arm64/asm/processor.h
index f73ffb5e4bc95..a33f70afb3a3e 100644
--- a/lib/arm64/asm/processor.h
+++ b/lib/arm64/asm/processor.h
@@ -47,6 +47,8 @@ typedef void (*exception_fn)(struct pt_regs *regs, unsigned int esr);
extern void install_vector_handler(enum vector v, vector_fn fn);
extern void install_exception_handler(enum vector v, unsigned int ec,
exception_fn fn);
+extern void default_vector_handler(enum vector v, struct pt_regs *regs,
+ unsigned int esr);

extern void show_regs(struct pt_regs *regs);
extern void *get_sp(void);
diff --git a/lib/arm64/processor.c b/lib/arm64/processor.c
index 7dc0b2e026134..efc78353d7ec0 100644
--- a/lib/arm64/processor.c
+++ b/lib/arm64/processor.c
@@ -10,7 +10,7 @@
#include <asm/processor.h>
#include <asm/esr.h>

-static char *vector_names[] = {
+static const char *vector_names[] = {
"el1t_sync",
"el1t_irq",
"el1t_fiq",
@@ -29,7 +29,7 @@ static char *vector_names[] = {
"el0_error_32",
};

-static char *ec_names[EC_MAX] = {
+static const char *ec_names[EC_MAX] = {
[ESR_EL1_EC_UNKNOWN] = "UNKNOWN",
[ESR_EL1_EC_WFI] = "WFI",
[ESR_EL1_EC_CP15_32] = "CP15_32",
@@ -142,8 +142,8 @@ void install_exception_handler(enum vector v, unsigned int ec, exception_fn fn)
exception_handlers[v][ec] = fn;
}

-static void default_vector_handler(enum vector v, struct pt_regs *regs,
- unsigned int esr)
+void default_vector_handler(enum vector v, struct pt_regs *regs,
+ unsigned int esr)
{
unsigned int ec = esr >> ESR_EL1_EC_SHIFT;

--
1.9.3