10.07.2015 Views

PDF version - ARM Information Center

PDF version - ARM Information Center

PDF version - ARM Information Center

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

프로세서 예외 처리; highest priority active interrupt.MOV R12, #IntBase ; Get the interrupt controller's; base address.LDR R12, [R12, #IntLevel] ; Get the interrupt level (0 to 31) .; Now read-modify-write the CPSR; to enable interrupts.MRS lr, APSR ; Read the status register.BIC lr, lr, #0x80 ; Clear the I bit; (use 0x40 for the F bit) .MSR CPSR_c, lr ; Write it back to re-enable; interrupts andLDR pc, [pc, R12, LSL #2] ; jump to the correct handler.; PC base address points to this; instruction + 8NOP; pad so the PC indexes this table.; Table of handler start addressesDCD Priority0HandlerDCD Priority1HandlerDCD Priority2Handler; ...Priority0HandlerPUSH {R0-R11} ; Save other working registers.; Insert handler code here.; ...POP {R0-R11} ; Restore working registers (not R12) .; Now read-modify-write the CPSR; to disable interrupts.MRS R12, APSR ; Read the status register.ORR R12, R12, #0x80 ; Set the I bit; (use 0x40 for the F bit) .MSR CPSR_c, R12 ; Write it back to disable interrupts.; Now that interrupt disabled, can safely; restore SPSR then return.POP {r12,lr} ; Restore R12 and get SPSR.MSR SPSR_cxsf, lr ; Restore status register from R14.LDM sp!, {pc}^ ; Return from handler.Priority1Handler; ...컨텍스트 전환6-19페이지의 예제 6-7에서는 사용자 모드 프로세스에서 컨텍스트 전환을 수행합니다. 이 코드는 실행할 수 있는 프로세스의 PCB (프로세스 제어 블록) 에 대한포인터 목록을 기반으로 합니다.6-19페이지의 그림 6-2에서는 이 예제에 필요한 PCB의 레이아웃을 보여 줍니다.6-18 Copyright © 2002-2008 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0203IKNon-ConfidentialUnrestricted Access

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

Saved successfully!

Ooh no, something went wrong!