Noteworthy without this article is Lockless (http://locklessinc.com/) for the great super-technical write-ups that they do.
Inlining assembly language using the GNU toolset has always escaped me (until now). It’s not so much that I didn’t know how to do it, I just felt it much more comfortable to write my assembly in a separately linked object. This article has put my mind, stomach and C blending assembly fingers at ease.
So, I’m a tragic for assembly language. I’ve finally gotten around to sharpening up my skills to attack Linux with some assembly language and why not upgrade the skills into the 64bit world at the same time.
“Hello world” follows:
section.datahello:db'Hello world!',10; text plus a linefeed charhelloLen:equ$-hello; length of the stringsection.textglobal_start_start:movrax,4; system call for "write" (sys_write)movrbx,1; file descriptor (stdout = 1)movrcx,hello; offset to writemovrdx,helloLen; number of bytes to writeint0x80; syscallmovrax,1; system call for exit (sys_exit)movrbx,0; error code (no error = 0)int0x80; syscall
Here’s a bookmark set (3 links) that have all got me out of trouble from time to time. If times and spaces were a little different around home here, I’d probably have these printed out and pinned to the wall.