We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hi,
I want to ask a question.
How to define a macro function that can be called by C language in armasm?
I know that in GNU can be used in the following way:
.macro push_x1_x12
push x1,x2
push x3,x4
push x5,x6
push x7,x8
push x9,x10
push x11,x12
.endm
ENTRY(test)
.......
push_x1_x12 ......ENDPROC(test)
Now in armasm, I used as follow :
MACRO
push_x1_x12
MEND
But how to expand the macro that can be called by C language??
As described in the suggested by albanrampon to link section 6.4 Inline assembly language syntax with the __asm keyword in C and C++, the correct syntax is:
// define: //------------------------------------- #define push_x1_x12 \ __asm { \ "push x1,x2 \n" \ "push x3,x4 \n" \ "push x5,x6 \n" \ "push x7,x8 \n" \ "push x9,x10 \n" \ "push x11,x12 \n" \ } //call //---------------------------------------- void test_tt(void) { push_x1_x12; }
See lacked the quotes involving the mnemonics and the line break.