ikerhurtado.com
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 5: Procedures and Stacks

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

The first lecture is a basic approach to the memory layout of a program and the way the stack works:

Procedure Call

Some basic slides on the procedure call protocol:

It's useful to understand the source of some limitations of the data return system in C/C++ functions: it has to do with the CPU register size.

How the IA32/Linux procedure system works

The next three lectures explain in detail how the IA32/Linux procedure system works using the stack. I extract the key slides:

Very interesting the example explaining the passing to the callee function of a pointer to a local variable (of the caller function).

That variable must be stored on stack (not only keep in a register) because of the need to create pointer to it. I think this is decided at compile time.

Finally, I link the two lectures where the procedure call system is explained in detail:

Linux Stack Frames - Video lecture - YouTube

Register Saving Conventions and Local Variables - Video lecture - YouTube

x86-64 Procedures and Stacks

In the x86-64 architecture, the procedure call system is quite different. I extract some overview slides:

I link the lecture for more detail: x86-64 Procedures and Stacks - Video lecture - YouTube.

POST A COMMENT: