此内容来自第三方平台 (Dailymotion)。如果此视频侵犯了您的版权,请使用 立即删除 工具。
x86-64 Assembly: Local Variables, Stack Frames & Alignment Explained
描述
Quick but deep look at local variables on the stack in x86-64 assembly (YASM). We cover allocation with sub rsp, accessing via offsets, why the stack must be 16-byte aligned when calling libc functions like printf, and two practical ways to fix alignment crashes. Includes live segfault debugging and a full working example with a local array.
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
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
相关视频
The Call Stack Explained: Call Frames, Return Addresses, Local Variables
Neural Lantern
x86-64 Assembly Segfault on printf? Fix Stack Alignment (Yasm + GCC Demo)
Neural Lantern
3 - 1 - Functions Variables and the Call Stack (506)
aesthetix7
LINEAR EQUATIONS IN TWO VARIABLES NCERT CBSE CLASS 9 EX 4.2 Q3 EXPLAINED
Yogesh TechNews.
LINEAR EQUATIONS IN TWO VARIABLES NCERT CBSE CLASS 9 EX 4.2 Q2 EXPLAINED
Yogesh TechNews.
LINEAR EQUATIONS IN TWO VARIABLES NCERT CBSE CLASS 9 EX 4.2 Q1 EXPLAINED
Yogesh TechNews.
来自同一上传者
AVL Trees: Adding Linear Data and Performing Rotations
2 次观看
AVL Tree Rotations Practice: Balancing a Huge Linear Tree Step by Step
1 次观看
How to Perform AVL Tree Rotations - Step By Step Example
6 次观看
AVL Tree Rotations Tutorial: Fixing Imbalance After Adding a Node
5 次观看
AVL Tree Rotation Types Explained for Self-Balancing Binary Search Trees
4 次观看
AVL Tree Tutorial: Balance Factors and Why They Fix Slow BSTs
4 次观看