diff options
author | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2007-03-13 05:06:37 -0400 |
---|---|---|
committer | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2007-04-27 07:44:13 -0400 |
commit | 92b728c147adb8c690b520304f4c9ee3eee43c21 (patch) | |
tree | f8b3e2f27f536b44694dadcf976e291aff7abeb7 | |
parent | 623b0355d5b1f9c6d05005b649a2f3a7b9fd7816 (diff) |
[AVR32] Fix NMI handler
Fix a problem with the NMI handler entry code related to the NMI handler
sharing some code with the exception handlers. This is not a good idea
because the RSR and RAR registers are not the same, and the NMI handler
runs with interrupts masked the whole time so there's no need to check
for pending work.
Open-code the low-level NMI handling logic instead so that the pt_regs
layout is actually correct when the higher-level handler is called.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
-rw-r--r-- | arch/avr32/kernel/entry-avr32b.S | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/arch/avr32/kernel/entry-avr32b.S b/arch/avr32/kernel/entry-avr32b.S index 5f5f7e42f51b..484e08310f15 100644 --- a/arch/avr32/kernel/entry-avr32b.S +++ b/arch/avr32/kernel/entry-avr32b.S | |||
@@ -340,12 +340,34 @@ do_bus_error_read: | |||
340 | do_nmi_ll: | 340 | do_nmi_ll: |
341 | sub sp, 4 | 341 | sub sp, 4 |
342 | stmts --sp, r0-lr | 342 | stmts --sp, r0-lr |
343 | /* FIXME: Make sure RAR_NMI and RSR_NMI are pushed instead of *_EX */ | 343 | mfsr r9, SYSREG_RSR_NMI |
344 | rcall save_full_context_ex | 344 | mfsr r8, SYSREG_RAR_NMI |
345 | bfextu r0, r9, MODE_SHIFT, 3 | ||
346 | brne 2f | ||
347 | |||
348 | 1: pushm r8, r9 /* PC and SR */ | ||
345 | mfsr r12, SYSREG_ECR | 349 | mfsr r12, SYSREG_ECR |
346 | mov r11, sp | 350 | mov r11, sp |
347 | rcall do_nmi | 351 | rcall do_nmi |
348 | rjmp bad_return | 352 | popm r8-r9 |
353 | mtsr SYSREG_RAR_NMI, r8 | ||
354 | tst r0, r0 | ||
355 | mtsr SYSREG_RSR_NMI, r9 | ||
356 | brne 3f | ||
357 | |||
358 | ldmts sp++, r0-lr | ||
359 | sub sp, -4 /* skip r12_orig */ | ||
360 | rete | ||
361 | |||
362 | 2: sub r10, sp, -(FRAME_SIZE_FULL - REG_LR) | ||
363 | stdsp sp[4], r10 /* replace saved SP */ | ||
364 | rjmp 1b | ||
365 | |||
366 | 3: popm lr | ||
367 | sub sp, -4 /* skip sp */ | ||
368 | popm r0-r12 | ||
369 | sub sp, -4 /* skip r12_orig */ | ||
370 | rete | ||
349 | 371 | ||
350 | handle_address_fault: | 372 | handle_address_fault: |
351 | sub sp, 4 | 373 | sub sp, 4 |