summaryrefslogtreecommitdiff
path: root/arch/arm
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-01-27 01:09:21 -0800
committerPixel <pixel@nobis-crew.org>2011-01-27 01:09:21 -0800
commitbcb852cbc842433576945044590b8716932acbd4 (patch)
tree5843e100015010b03b5fe5b4641b19bf0323d86c /arch/arm
parente1122d5200cec30e239b18278e2bb5c7ec97a72b (diff)
Blah. I can't code with stack anymore it seems. Fixing the crash handler so that SP, and R4-R11 are properly displayed.
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/lpc17xx/handlers.c9
-rw-r--r--arch/arm/lpc17xx/startup.s1
2 files changed, 5 insertions, 5 deletions
diff --git a/arch/arm/lpc17xx/handlers.c b/arch/arm/lpc17xx/handlers.c
index 59a297b..faee7f9 100644
--- a/arch/arm/lpc17xx/handlers.c
+++ b/arch/arm/lpc17xx/handlers.c
@@ -6,18 +6,17 @@ enum FaultType {
};
struct fault_data_t {
- uint32_t r0, r1, r2, r3, r12, lr, pc, xPSR, r4, r5, r6, r7, r8, r9, r10, r11;
+ uint32_t r4, r5, r6, r7, r8, r9, r10, r11, r0, r1, r2, r3, r12, lr, pc, xPSR;
};
static void print_fault_data(struct fault_data_t * fault_data) {
// These ones are saved naturally by the CPU
DBGOUT("pc: %p\r\n", fault_data->pc);
- DBGOUT("sp = %p - lr = %p - r12 = %p -xPSR = %p\r\n", fault_data, fault_data->lr, fault_data->r12, fault_data->xPSR);
+ DBGOUT("sp = %p - lr = %p - r12 = %p -xPSR = %p\r\n", fault_data + 1, fault_data->lr, fault_data->r12, fault_data->xPSR);
DBGOUT("r0 = %p - r1 = %p - r2 = %p - r3 = %p\r\n", fault_data->r0, fault_data->r1, fault_data->r2, fault_data->r3);
- // These ones are saved by the ASM handler; not sure if they are proper
+ // These ones are saved by the ASM handler; hence the reason they are before in memory.
DBGOUT("r4 = %p - r5 = %p - r6 = %p - r7 = %p\r\n", fault_data->r4, fault_data->r5, fault_data->r6, fault_data->r7);
- // Huh ? This read crashes the CPU... (cf previous comment)
-// DBGOUT("r8 = %p - r9 = %p - r10 = %p - r11 = %p\r\n", fault_data->r8, fault_data->r9, fault_data->r10, fault_data->r11);
+ DBGOUT("r8 = %p - r9 = %p - r10 = %p - r11 = %p\r\n", fault_data->r8, fault_data->r9, fault_data->r10, fault_data->r11);
}
void general_C_handler(enum FaultType fault, struct fault_data_t * fault_data) {
diff --git a/arch/arm/lpc17xx/startup.s b/arch/arm/lpc17xx/startup.s
index 7537531..e7c5311 100644
--- a/arch/arm/lpc17xx/startup.s
+++ b/arch/arm/lpc17xx/startup.s
@@ -146,6 +146,7 @@ UsageFault_Handler:
.type general_handler, %function
general_handler:
MOV R1, SP
+ SUB R1, #32
PUSH {R4-R11}
B general_C_handler