code as following:
\#define CS 0x18
asm ("pushl CS"
);
or something as an input argument:
asm("pushl %0 \n\t"
:"m"(CS) \
)
can the macro CS be used in the above inline asm code?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
CS can be used in the second example, not the first.
Macros are substituted before the compiler/assembler work, so they work regardless of C or assembly.
But macros are not expanded in strings, so the first example won’t work.
If you want to make the first example work, use stringization:
This expands
STR(CS)to"0x18"and concatenates it with"pushl ".