Slack Intro Part 2

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *

Already have an account? Sign In »

13 hours 15 minutes
Video Transcription
Additionally, we have the operations like call we can call a function name. So what call does is it pushes the address of the next instruction onto the stack
and then a cop. Easy, I p to that new function, location or address.
And then the reverse of that is the return. The return is going to allow us to exit a function so or return from a function.
So what that does is it pops off the return address from the stack and then moves I p e i p to that new address.
So we end up always having a call to a function, and then inside the function when it's done, will have a return. And so that's how we can write a program with functions. Now you've done this in class. We have called a lot of different functions. So, for example, call read into call print end culprit, NL.
All of those we are calling a function, and then we assume that it's going to resume
from the location that we were at before.
We also have the ability to allocate space using, add and subtract.
So, for example, we can say sub e s p X and that'll subtract X bytes from E S P.
So, typically, when you enter a function, you're going to do a subtract on E S p to allocate some temporary space that we can use for local variables or buffers.
And then at the end of the function, we can add back E S P so well typically add and subtract the same number of bytes.
And so this will unallocated that space. And we'll do that right before we leave a function.
And then if you ever go through and you are reverse engineering some code, you might see that when a function enters, it might do something like Andy S. P. And then you got a bunch of efs and a zero,
and this is because it is trying to make sure that yes, p is on an even boundary. And this is a security protection that some operating systems and some compilers implement to make it harder to attack these type of systems.
Up Next