Skip to content

Commit

Permalink
Merge pull request #18028 from aabadie/pr/cpu/uncrustify_arm7_vectors
Browse files Browse the repository at this point in the history
cpu/arm7_common: uncrustify vectors.c
  • Loading branch information
aabadie authored Apr 28, 2022
2 parents 7731e6a + bca6f44 commit 80815ed
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions cpu/arm7_common/vectors.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,77 +34,80 @@ void isr_fio(void)
{
LOG_ERROR("Kernel Panic,\nEarly FIQ call\n");

while (1) {};
while (1) {}
}

void isr_swi(void)
{
LOG_ERROR("Kernel Panic,\nEarly SWI call\n");

while (1) {};
while (1) {}
}

void abtorigin(const char *vector, unsigned long *lnk_ptr1)
{
register unsigned long *lnk_ptr2;
register unsigned long *sp;
register unsigned int cpsr, spsr;
register unsigned int cpsr, spsr;

__asm__ __volatile__("mrs %0, cpsr" : "=r"(cpsr)); // copy current mode
__asm__ __volatile__("mrs %0, spsr" : "=r"(spsr)); // copy dabt generating mode
__asm__ __volatile__("msr cpsr_c, %0" :: "r"(spsr)); // switch to dabt generating mode
__asm__ __volatile__("mov %0, lr" : "=r"(lnk_ptr2)); // copy lr
__asm__ __volatile__("mov %0, sp" : "=r"(sp)); // copy sp
__asm__ __volatile__("msr cpsr_c, %0" :: "r"(cpsr)); // switch back to abt mode
__asm__ __volatile__ ("mrs %0, cpsr" : "=r" (cpsr)); // copy current mode
__asm__ __volatile__ ("mrs %0, spsr" : "=r" (spsr)); // copy dabt generating mode
__asm__ __volatile__ ("msr cpsr_c, %0" : : "r" (spsr)); // switch to dabt generating mode
__asm__ __volatile__ ("mov %0, lr" : "=r" (lnk_ptr2)); // copy lr
__asm__ __volatile__ ("mov %0, sp" : "=r" (sp)); // copy sp
__asm__ __volatile__ ("msr cpsr_c, %0" : : "r" (cpsr)); // switch back to abt mode

LOG_ERROR("#!%s abort at %p (0x%08lX) originating from %p (0x%08lX) in mode 0x%X\n",
vector, (void *)lnk_ptr1, *(lnk_ptr1), (void *)lnk_ptr2, *(lnk_ptr2), spsr
);
vector, (void *)lnk_ptr1, *(lnk_ptr1), (void *)lnk_ptr2, *(lnk_ptr2), spsr
);

while (1) {};
while (1) {}
}

void isr_undef(void)
{
/* cppcheck-suppress variableScope
* (reason: used within __asm__ which cppcheck doesn't pick up) */
register unsigned long *lnk_ptr;
__asm__ __volatile__("sub %0, lr, #8" : "=r"(lnk_ptr)); // get aborting instruction

__asm__ __volatile__ ("sub %0, lr, #8" : "=r" (lnk_ptr)); // get aborting instruction

if (arm_abortflag == 0) {
arm_abortflag = 1; // remember state (if printing should fail again)
abtorigin("undef", lnk_ptr);
}

while (1) {};
while (1) {}
}

void isr_pabt(void)
{
/* cppcheck-suppress variableScope
* (reason: used within __asm__ which cppcheck doesn't pick up) */
register unsigned long *lnk_ptr;
__asm__ __volatile__("sub %0, lr, #8" : "=r"(lnk_ptr)); // get aborting instruction

__asm__ __volatile__ ("sub %0, lr, #8" : "=r" (lnk_ptr)); // get aborting instruction

if (arm_abortflag == 0) {
arm_abortflag = 1; // remember state (if printing should fail again)
abtorigin("pabt", lnk_ptr);
}

while (1) {};
while (1) {}
}

void isr_dabt(void)
{
/* cppcheck-suppress variableScope
* (reason: used within __asm__ which cppcheck doesn't pick up) */
register unsigned long *lnk_ptr;
__asm__ __volatile__("sub %0, lr, #8" : "=r"(lnk_ptr)); // get aborting instruction

__asm__ __volatile__ ("sub %0, lr, #8" : "=r" (lnk_ptr)); // get aborting instruction

if (arm_abortflag == 0) {
arm_abortflag = 1; // remember state (if printing should fail again)
abtorigin("data", lnk_ptr);
}

while (1) {};
while (1) {}
}

0 comments on commit 80815ed

Please sign in to comment.