
X86-64 machine level programming [pdf] (2005) - adamnemecek
http://ecee.colorado.edu/ecen4553/fall12/asm64-handout.pdf
======
csl
Having taken up x86 assembly coding again after many, many years (last time
was on a 486, really), I find 64-bit assembly _much_ easier to get started
with compared to 32-bit: Simpler calling convention (on UNIX, at least), no
segments, more registers, etc. If anyone is starting out, this is a pretty
good time to do so.

~~~
sdegutis
Learning x86 (Intel) assembly is definitely something I've been interested in,
as someone who inexplicably enjoys writing C code. But PDFs like this one are
all I can really find, which are a bit daunting and intimidating.

~~~
kabdib
It's not that bad. I usually start small:

\- Write a program that just returns, or halts;

\- Write a program that prints something or blinks an LED;

\- Print numbers 1-10;

\- Handle some input, using function calls.

\- Write some data structure (binary tree or hash table). Or maybe get an MMU
working, and handle a system trap.

... working your way up to writing a context switch handler, for a coroutine
or threading system, of course :-)

... at that point, you're off to the races. Mostly I try to get the toolchain
a debugger working reliably in the first step, and everything just builds on
that.

------
josteink
Man. First with x64 assembly did Intel catch up with where Motorola was over 2
decades ago with their 68k series.

Lack of registers (and a logical organisation of those) and the boilerplate
load/unload pain that caused when trying to write any non-trivial code was why
I just stopped doing assembly when I moved to the Intel platform.

Such a shame they didn't address this earlier.

~~~
groovy2shoes
The "x64" instruction set was produced by AMD, not Intel. This is why you
frequently see the architecture referred to as "amd64".

------
server_bot
This 2005 PDF is supplemental material for an old edition of "Computer
Systems: A Programmer's Perspective” by Randal E. Bryant and David R.
O'Hallaron. The 2015 edition of the book includes an updated version of this
x86-64 content in Chapter 3, replacing the IA32 content and no longer a just a
supplement. I strongly recommend owning a copy of this book if you have any
interest in systems programming or just want to be exploit hardware
characteristics for better performance in your userspace applications.

I took the class this book is written for, taught by the authors. They don’t
place emphasis on being able to write assembly, since this is not a useful
skill for the majority of programmers. Instead, the goal of this material is
to get you to understand assembly and compilation well enough to 1) reverse
engineer it if you need to for debugging or security reasons, and 2) be able
to write compiler-friendly code, meaning code that can be safely translated
into efficient assembly instructions (compilers are conservative, they only
optimize when it's certain there's no repercussions).

------
Artlav
That started out fairly nice, but then they used AT&T assembly syntax, which
made it worthless.

But opinions aside, it does look like a nice reference and exercise piece.

~~~
chrisseaton
> they used AT&T assembly syntax, which made it worthless

This is so silly. The two assembly syntaxes are equivalent and include just as
much information. It doesn't make much to mentally flick between the two.

~~~
adamnemecek
While they are the same, Intel is much easier to read.

~~~
aerioux
this is an older version -- the actual book this is excerpted from uses Intel
mostly now (the canonical CSPP book) and also has many revisions to
'modernize' it, such as reducing the x86 sections in favor of x64

