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.

프로세서 예외 처리예제 6-9 최상위 수준 SVC 처리기PRESERVE8AREA TopLevelSVC, CODE, READONLY ; Name this block of code.EXPORT SVC_HandlerSVC_HandlerPUSH {R0-R12,lr} ; Store registers.LDR R0,[lr,#-4] ; Calculate address of SVC instruction; and load it into R0.BIC R0,R0,#0xFF000000 ; Mask off top 8 bits of instruction; to give SVC number.;; Use value in R0 to determine which SVC routine to execute.;LDM sp!, {R0-R12,pc}^ ; Restore registers and return.END어셈블리 언어의 SVC 처리기요청된 SVC 번호에 대한 처리기를 호출하는 가장 간단한 방법은 점프 테이블을사용하는 것입니다. R0에 SVC 번호가 들어 있으면 예제 6-10의 코드를 예제 6-9에제공된 최상위 수준 처리기의 BIC 명령어 다음에 삽입할 수 있습니다.예제 6-10 SVC 분기 테이블AREA SVC_Area, CODE, READONLYPRESERVE8IMPORT SVCOutOfRangeIMPORT MaxSVCCMP R0,#MaxSVC ; Range checkLDRLS pc, [pc,R0,LSL #2]B SVCOutOfRangeSVCJumpTableDCD SVCnum0DCD SVCnum1; DCD for each of other SVC routinesSVCnum0; SVC number 0 codeB EndofSVCSVCnum1; SVC number 1 codeB EndofSVC; Rest of SVC handling codeEndofSVC; Return execution to top level6-22 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!