x86-64 Assembly: Local Variables, Stack Frames & Alignment Explained
Great for anyone studying systems programming, computer architecture, or just trying to figure out why their assembly program randomly crashes on a library call.
Like + subscribe if you want more clear, practical assembly tutorials!
00:00 Introduction to Local Variables on the Stack
00:28 C++ Example of Function and Local Variables
01:06 Incoming Arguments in RDI vs Stack Variables
03:24 Pointers as Local Variables on Stack
04:34 Why the Stack ? Recursion and Multiple Calls
05:18 Visualizing Multiple Stack Frames
09:24 How Function Returns Adjust RSP
10:35 Stack Grows Downward in Memory
11:33 Program Setup ? Hybrid C++/Assembly
12:46 Assembly Module Overview
14:00 Function Prologue ? Register Push & Alignment
15:30 Allocating Stack Space for Local Array
17:45 Initializing Array in Loop
20:10 Printing Loop with printf
49:48 First Run ? Segfault Observed
51:00 16-Byte Stack Alignment Requirement
51:55 Fix 1 ? Extra Push/Pop in Prologue/Epilogue
53:15 Fix 2 ? Push/Pop Around Each printf Call
55:04 Testing Different Array Sizes
56:52 Debugging Alignment Behavior
58:54 Summary ? Creating Any Local Data on Stack
59:59 Closing Remarks & Subscribe Call
x86-64 assembly, x86 assembly tutorial, local variables stack, stack frame assembly, yasm tutorial, nasm tutorial, stack alignment, 16 byte alignment, printf crash assembly, assembly stack allocation, sub rsp assembly, rbp rbp stack, assembly array on stack, low level programming, systems programming, computer architecture, reverse engineering, assembly language, x64 assembly, calling convention
=-=-=-=-=-=-=-=-=
Thanks for watching!
Find us on other social media here:
- https://www.NeuralLantern.com/social
- Twitter / X: https://x.com/NeuralLantern
- Rumble: https://rumble.com/c/c-3696939
- BitChute: https://www.bitchute.com/channel/pg1Pvv5dN4Gt
- Daily Motion: https://www.dailymotion.com/neurallantern
- Minds: https://www.minds.com/neurallantern/
- Odysee: https://odysee.com/@NeuralLantern:5
Please show your support!
- Buy me a coffee: https://ko-fi.com/neurallantern
- Subscribe + Sharing on Social Media
- Leave a comment or suggestion
- Subscribe to the Blog: https://www.NeuralLantern.com
- Watch the main "pinned" video of this channel for offers and extras
Related videos
The Call Stack Explained: Call Frames, Return A...
Neural Lantern
x86-64 Assembly Segfault on printf? Fix Stack A...
Neural Lantern
x86-64 Assembly While Loops Explained Step by S...
Neural Lantern
x86-64 Assembly: Integer Data Movement, Pointer...
Neural Lantern
Mixed Function Arguments in x86-64 Assembly - I...
Neural Lantern
x86-64 Assembly For Loops Explained - YASM Tuto...
Neural Lantern
Yasm x86-64 Assembly: Instruction Formats, Oper...
Neural Lantern
x86-64 Assembly Pointers & Dereferencing Explai...
Neural Lantern
x86-64 Assembly Jump Instructions Explained: Un...
Neural Lantern
Thermodynamique 1,cours05, variables intensives...
netprof
Thermodynamique 1, cours 05, variables intensiv...
netprof
011 Variables
Thái Anh