10.07.2015 Views

PDF version - ARM Information Center

PDF version - ARM Information Center

PDF version - ARM Information Center

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

프로세서 예외 처리9. 사용자 모드 LR과 스택 조정 값을 복원합니다.10. 필요한 경우 스택을 다시 조정합니다.11. IRQ 모드로 전환합니다.12. 다른 레지스터와 IRQ 모드 SPSR을 복원합니다.13. IRQ에서 복귀합니다.예제 6-2 및 6-14페이지의 예제 6-3에서는 시스템 모드에서 이 작업을 수행하는방법을 보여 줍니다.예제 6-2 <strong>ARM</strong>v4/v5TE용 재진입 인터럽트 처리기PRESERVE8AREA INTERRUPT, CODE, READONLYIMPORT C_irq_handlerIMPORT identify_and_clear_sourceIRQ_HandlerSUB lr, lr, #4 ; construct the return addressPUSH {lr} ; and push the adjusted lr_IRQMRS lr, SPSR ; copy spsr_IRQ to lrPUSH {R0-R4,R12,lr} ; save AAPCS regs and spsr_IRQBL identify_and_clear_sourceMSR CPSR_c, #0x9F ; switch to SYS mode, IRQ is; still disabled. USR mode; registers are now current.AND R1, sp, #4 ; test alignment of the stackSUB sp, sp, R1 ; remove any misalignment (0 or 4)PUSH {R1,lr} ; store the adjustment and lr_USRMSR CPSR_c, #0x1F ; enable IRQBL C_irq_handlerMSR CPSR_c, #0x9F ; disable IRQ, remain in SYS modePOP {R1,lr} ; restore stack adjustment and lr_USRADD sp, sp, R1 ; add the stack adjustment (0 or 4)MSR CPSR_c, #0x92 ; switch to IRQ mode and keep IRQ; disabled. FIQ is still enabled.POP {R0-R4,R12,lr} ; restore registers andMSR SPSR_cxsf, lr ; spsr_IRQLDM sp!, {pc}^ ; return from IRQ.END<strong>ARM</strong> DUI 0203IK Copyright © 2002-2008 <strong>ARM</strong> Limited. All rights reserved. 6-13Unrestricted AccessNon-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!