W4_L2: Execution flow and stack

Опубликовано: 28 Июль 2026
на канале: IIT Madras - BS in Electronic Systems
661
11

Welcome to Week 4 Lecture 2 of the course "Computer Organization" by Prof. Janakiraman Viraraghavan
Full Course: https://study.iitm.ac.in/es/course_pa...

Video Overview
This lecture walks through the execution flow of a C to assembly example to explain how function calls set up and tear down stack frames. Using concrete example addresses 0xC100 and 0xC2000 the video shows what call does pushes the return address why the callee must save a new frame pointer mov ebp esp and allocate local space sub esp 0x40 and how parameters live at ebp plus 4 and ebp plus 8 while locals live at ebp minus 4 and so on. It demonstrates the correct sequence for computing z equals x plus y storing the result restoring the stack add esp 0x40 and executing ret and highlights the fatal stack corruption bug that occurs if pushes are not undone or if esp is left in the wrong place before ret. Clear diagrams and step by step comments show why the stack segment is ideal for function scope and why following the call return protocol and ebp eax conventions is essential for correct execution.

About IIT Madras' online Bachelor of Science programme
IIT Madras offers four-year BS programmes that aim to provide quality education to all, irrespective of age, educational background, or location. The BS programme has multiple levels, which provide flexibility to students to exit at any of these levels. Depending on the courses completed and credits earned, the learner can receive a Foundation Certificate from IITM CODE (Centre for Outreach and Digital Education), Diploma(s) from IIT Madras, or BSc/BS Degrees from IIT Madras.
For more details, Visit: https://www.iitm.ac.in/academics/stud...

#ComputerOrganization #StackFrame #ExecutionFlow #Assembly #CProgramming #FunctionCalls #EBP #ESP #IITMadras