PDF version - ARM Information Center
PDF version - ARM Information Center
PDF version - ARM Information Center
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
C, C++ 및 어셈블리 언어 조합ADD R0, R0, R0, LSL #1 ; multiply by 3LDMFD sp!,{pc}END또는 예제 4-21에 나와 있는 대로 임베디드 어셈블리를 사용하여 4-17페이지의예제 4-18과 4-17페이지의 예제 4-20을 구현할 수 있습니다. 이 예제에서 __cpp 키워드는 함수를 참조하는 데 사용됩니다. 따라서 함수의 변환된 이름을 몰라도 됩니다.예제 4-21 임베디드 어셈블리에서 함수 구현struct T {T (int i) : t (i) { }int t;int f (int i) ;};int T::f (int i) { return i + t; }// Definition of asm function called from C++__asm int asm_func (T*) {STMFD sp!, {lr}MOV R1, #2;BL __cpp (T::f) ;ADD R0, R0, R0, LSL #1 ; multiply by 3LDMFD sp!, {pc}}int f () {T t (5) ; // create an object of type Treturn asm_func (&t) ;}4-18 Copyright © 2002-2008 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0203IKNon-ConfidentialUnrestricted Access