]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
riscv: Adjust the _exit_trap() position to come before handle_trap()
authorBin Meng <bmeng.cn@gmail.com>
Wed, 12 Dec 2018 14:12:44 +0000 (06:12 -0800)
committerAndes <uboot@andestech.com>
Tue, 18 Dec 2018 01:56:27 +0000 (09:56 +0800)
With this change, we can avoid a forward declaration.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Lukas Auer <lukas.auer@aisec.fraunhofer.de>
Reviewed-by: Anup Patel <anup@brainfault.org>
arch/riscv/lib/interrupts.c

index 3aff00697732fe5a1950d53d9a9c42f3be4ae722..e185933b01ef04cde12988058d137dda9bd363cd 100644 (file)
 #include <asm/system.h>
 #include <asm/encoding.h>
 
-static void _exit_trap(ulong code, ulong epc, struct pt_regs *regs);
+static void _exit_trap(ulong code, ulong epc, struct pt_regs *regs)
+{
+       static const char * const exception_code[] = {
+               "Instruction address misaligned",
+               "Instruction access fault",
+               "Illegal instruction",
+               "Breakpoint",
+               "Load address misaligned",
+               "Load access fault",
+               "Store/AMO address misaligned",
+               "Store/AMO access fault",
+               "Environment call from U-mode",
+               "Environment call from S-mode",
+               "Reserved",
+               "Environment call from M-mode",
+               "Instruction page fault",
+               "Load page fault",
+               "Reserved",
+               "Store/AMO page fault",
+       };
+
+       if (code < ARRAY_SIZE(exception_code)) {
+               printf("exception code: %ld , %s , epc %lx , ra %lx\n",
+                      code, exception_code[code], epc, regs->ra);
+       } else {
+               printf("Reserved\n");
+       }
+
+       hang();
+}
 
 int interrupt_init(void)
 {
@@ -72,34 +101,3 @@ __attribute__((weak)) void external_interrupt(struct pt_regs *regs)
 __attribute__((weak)) void timer_interrupt(struct pt_regs *regs)
 {
 }
-
-static void _exit_trap(ulong code, ulong epc, struct pt_regs *regs)
-{
-       static const char * const exception_code[] = {
-               "Instruction address misaligned",
-               "Instruction access fault",
-               "Illegal instruction",
-               "Breakpoint",
-               "Load address misaligned",
-               "Load access fault",
-               "Store/AMO address misaligned",
-               "Store/AMO access fault",
-               "Environment call from U-mode",
-               "Environment call from S-mode",
-               "Reserved",
-               "Environment call from M-mode",
-               "Instruction page fault",
-               "Load page fault",
-               "Reserved",
-               "Store/AMO page fault",
-       };
-
-       if (code < ARRAY_SIZE(exception_code)) {
-               printf("exception code: %ld , %s , epc %lx , ra %lx\n",
-                      code, exception_code[code], epc, regs->ra);
-       } else {
-               printf("Reserved\n");
-       }
-
-       hang();
-}