September 2017
Beginner to intermediate
290 pages
6h 58m
English
The macro engine of the GNU Assembler is quite similar to that of Microsoft's MASM, yet there are a few syntactic differences (not taking into account the overall syntax difference) that we have to pay attention to. Let us take the output_message procedure from the Linux test program in Chapter 2, Setting Up a Development Environment, and replace the call to printf() with a simple macro for demonstration purposes.
.macro print message ; .macro macro_name parameter pushl \message ; Put the parameter on stack ; parameters are prefixed with '\' call printf ; Call printf() library function add $4, %esp ; Restore stack after cdecl function call.endmoutput_message: pushl %ebp movl %esp, %ebp print 8(%ebp) ; This line would expand ...
Read now
Unlock full access