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.

C, C++ 및 어셈블리 언어 조합C++에서 어셈블리 언어 호출예제 4-10과 예제 4-11에서는 C++에서 어셈블리 언어를 호출하는 방법을 보여 줍니다.예제 4-10 C++에서 어셈블리 언어 호출struct S { // has no base classes// or virtual functionsS (int s) : i (s) { }int i;};extern "C" void asmfunc (S *) ; // declare the Asm function// to be calledint f () {S s (2) ;// initialize 's'asmfunc (&s) ;// call 'asmfunc' so it// can change 's'return s.i * 3;}예제 4-11 어셈블리 언어 함수 정의PRESERVE8AREA Asm, CODEEXPORT asmfuncasmfuncLDR R1, [R0]ADD R1, R1, #5STR R1, [R0]BX lrEND; the definition of the Asm; function to be called from C++<strong>ARM</strong> DUI 0203IK Copyright © 2002-2008 <strong>ARM</strong> Limited. All rights reserved. 4-13Unrestricted AccessNon-Confidential

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

Saved successfully!

Ooh no, something went wrong!