You're in
Iker Hurtado's pro blog
Developer | Entrepreneur | Investor
Software engineer (entrepreneur and investor at times). These days doing performant frontend and graphics on the web platform at Barcelona Supercomputing Center

The Hw/Sw Interface. Section 4: x86 Assembly

30 Nov 2015   |   iker hurtado  
Share on Twitter Share on Google+ Share on Facebook
These are my notes on the section 4 of the course (Coursera): The Hardware/Software Interface (by Gaetano Borriello, Luis Ceze - University of Washington)

Move instructions and operands

The first lecture of this section is basic to work with and understand the assembly programming. I copy some key slides:

Code example

The final part of the lecture is devoted to explaining an code example. I liked to figure out the match between variables and operations in C and data store and instructions in assembly.

The starting status:

The final status:

x86 vs x86-64

In the second lecture, Luis Ceze deals with the differences between x86 and x86-64 architectures related to move instructions and operands.

Returning to the example, now in 64-bit mode, the function call doesn't require references to the stack, the integer arguments are passed in registers.

Memory addressing modes

This lecture is about the different modes of memory addressing. The addressing system is very flexible and convenient for some operations such as work with memory addresses, arrays and other struts. I've figured out the benefits of some operations in higher-level languages like C.

Some key slides:

Very interesting the last slide. The lea- instructions can be used to compute some arithmetic expressions. The compiler usually use it.

Conditionals and flow control

The more relevant slides of this topic are the ones related to condition codes setting (the rest of theses lectures is pretty evident to me):