- 2 days ago
Learn pointers & dereferencing in x86-64 YASM assembly and how to pass them correctly between assembly and C++ in a hybrid program. We build a small working example that sends strings, longs, and doubles both directions using pointers, modifies values across module boundaries, and explains why pointer-to-double still uses general-purpose registers. Includes a quick demo of stack misalignment crash + fix.
Great for assembly beginners moving to real programs, systems programming students, or anyone curious how low-level code talks to C/C++.
00:00 Introduction to Pointers and Dereferencing in x86-64 Assembly
00:28 Pointers explained in C++
01:02 Changing values via pointers in C++
01:43 Pointers in assembly basics
02:09 Defining variables and pointers in YASM data section
03:23 Pointers are always integers even to doubles
04:20 Function arguments are pointers treated as 64-bit integers
05:00 Driver C++ code overview
05:58 Marking extern "C" functions
06:40 Local stack variables and passing pointers
07:51 Stack lifetime warning
08:34 Assembly data section strings and numbers
09:39 Print null-terminated string helper functions
10:38 External symbols and hey_driver_print_this
11:29 Point function prologue and stack alignment
13:04 Extra push for 16-byte alignment
14:20 Printing welcome message from assembly
16:00 Driver sees initial long value
16:58 Printing received string from C++
18:20 Using received char pointer without dereference
20:21 Modifying incoming long via dereference
21:46 Driver sees modified long value 101
22:43 Calling back to C++ to print assembly-owned data
23:48 Passing pointers to assembly string long and double
25:08 Driver prints assembly-owned values and addresses
26:14 Summary of pointer passing between modules
26:36 Stack alignment crash demonstration
27:39 Adding extra push/pop fixes segfault
28:00 Closing remarks and call to subscribe
x86-64 assembly, YASM assembly, assembly pointers, dereferencing assembly, hybrid C++ assembly, assembly C++ interop, x86-64 pointers, assembly memory addresses, low level programming, systems programming, assembly tutorial, x86 assembly tutorial, YASM tutorial, passing pointers assembly, stack alignment assembly, x86-64 calling convention, assembly data section, extern C assembly
=-=-=-=-=-=-=-=-=
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 Blog: https://www.NeuralLantern.com
- Watching the main "pinned" video of this channel for offers and extras
Great for assembly beginners moving to real programs, systems programming students, or anyone curious how low-level code talks to C/C++.
00:00 Introduction to Pointers and Dereferencing in x86-64 Assembly
00:28 Pointers explained in C++
01:02 Changing values via pointers in C++
01:43 Pointers in assembly basics
02:09 Defining variables and pointers in YASM data section
03:23 Pointers are always integers even to doubles
04:20 Function arguments are pointers treated as 64-bit integers
05:00 Driver C++ code overview
05:58 Marking extern "C" functions
06:40 Local stack variables and passing pointers
07:51 Stack lifetime warning
08:34 Assembly data section strings and numbers
09:39 Print null-terminated string helper functions
10:38 External symbols and hey_driver_print_this
11:29 Point function prologue and stack alignment
13:04 Extra push for 16-byte alignment
14:20 Printing welcome message from assembly
16:00 Driver sees initial long value
16:58 Printing received string from C++
18:20 Using received char pointer without dereference
20:21 Modifying incoming long via dereference
21:46 Driver sees modified long value 101
22:43 Calling back to C++ to print assembly-owned data
23:48 Passing pointers to assembly string long and double
25:08 Driver prints assembly-owned values and addresses
26:14 Summary of pointer passing between modules
26:36 Stack alignment crash demonstration
27:39 Adding extra push/pop fixes segfault
28:00 Closing remarks and call to subscribe
x86-64 assembly, YASM assembly, assembly pointers, dereferencing assembly, hybrid C++ assembly, assembly C++ interop, x86-64 pointers, assembly memory addresses, low level programming, systems programming, assembly tutorial, x86 assembly tutorial, YASM tutorial, passing pointers assembly, stack alignment assembly, x86-64 calling convention, assembly data section, extern C assembly
=-=-=-=-=-=-=-=-=
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 Blog: https://www.NeuralLantern.com
- Watching the main "pinned" video of this channel for offers and extras
Category
🤖
TechTranscript
00:00Hey there in this video we're going to talk about pointers and dereferencing in a YASM x8664
00:08assembly program also as a hybrid program so that assembly and C++ can talk to each other
00:15and send each other pointers and send each other data and things like that.
00:25So what am I talking about just as a quick recap for what pointers are I'm going to write
00:32in C++ for a second suppose you have a pointer for an integer we'll call it P suppose you
00:37have an integer by itself we'll call it A let's say that the value of A is 5 and if
00:44you wanted
00:44to say that P points to A you could say P equals the address of A I'll put C++ at
00:51the top here
00:52and so now if I set A to 6 and then I print P a dereference of P this is
01:01not like a full
01:01pointers tutorial but basically by changing A I'm changing what P thinks it sees as a value
01:08assuming I dereference it I could also let me do a print 6 here I could also just change
01:16the value through P I could say dereference P and I could say equals 7 and then if I printed
01:22A again then that would actually print a 7 right so you know you can have regular variables global
01:31variables whatever kind of you know memory stuff on the stack and to get a pointer to it you really
01:36just need to get its memory location in C++ it's kind of easy syntactically you can see what's
01:43happening in assembly you really just need the memory location stored somewhere you could store
01:49that as an integer in memory like you could have a global variable that just simply stored the memory
01:55location of some other variable you could have a 64-bit register store the value of a variable let's say
02:02let's say we have like a I don't know my whatever my number let's say inside of assembly
02:09I'll do ASM here and we say it's a quad word and it starts off as this number or whatever
02:16right so
02:16if you haven't seen my previous videos go see them for the basics of assembly and linking and make
02:22files and all that stuff but you know if you have an assembly program and you have a data section
02:28and you define a global variable like this what you're basically saying is I want to take this
02:31giant number and I want to write it into eight bytes that's the dq it says data quad word I
02:37want
02:37to write that giant number across eight bytes and then I want to get a pointer to it stored in
02:42the
02:42my number symbol so my number is not actually the value it's a pointer to the value so you know
02:48later
02:48if you want to move you know something into a register if you did this that would move the pointer
02:56into RAX but if you did this with deref symbols after it or around it then you would move
03:11maybe I'll put that into RAX you'd move that actual number that we specified into RAX
03:18it's important to understand also that pointers are integers even when we're pointing to doubles
03:25so for example sometimes people make this mistake they'll say you know my double
03:32and they'll say it's a quad word meaning this is going to be a 64-bit double precision floating
03:36point number and they'll do like 44.55 or whatever so that is a double and it is in memory
03:42but um you know what is the symbol of my double remember it's supposed to be just a pointer right
03:50it can't be an actual double because a memory location is not a double a memory location is an
03:56integer so that means if you wanted to move a pointer into a register you would only be able to
04:01move the pointer into a regular general purpose register not a floating point register and you should
04:07use the regular uh movement instructions for just regular uh general purpose registers so keep that
04:12in mind if you see a signature like this like let's say function f and we have uh you know
04:21let's say long
04:22a and long b and actually let's do pointers let's say long pointer a and long pointer b and double
04:31pointer c all three of those arguments are actually 64-bit integers because they're all pointers even
04:38if one of the pointers points to a double a double why did i say dull pointers aren't dull they're
04:43exciting okay so i'm gonna open up some code here real fast so usually i don't explain my uh my
04:52driver
04:52i'm going to explain it to you this time because it's kind of doing a little bit more than my
04:55other
04:55videos um again if you don't have uh the knowledge of how to make a make file see my other
05:03videos
05:03because that's explained there for now i'm just going to assume you've watched my other videos
05:07and what we really need to do is write a driver and an assembly module for a hybrid program again
05:13hybrid programs covered in other videos so the driver is pretty easy i'm just going to copy paste
05:18it honestly here and then just kind of explain it to you the driver is pretty easy we're going to
05:23do
05:23iostream so we can print stuff we're going to mark an external function called point
05:30as extern c so that just disables name mangling which means the c++ module will be able to call
05:37on this function called point and it won't expect that the point function has its name mangled like
05:44c++ does the reason being is that point is actually going to be in the side it's going to be
05:48inside
05:48assembly where its name will not be mangled this disables the ability to overload but that's okay
05:53we don't care now it's going to take two pointers a pointer to a character and a pointer to a
05:59long
06:01since both of those are pointers they're both actually going to be 64-bit integers even the
06:06character pointer and then we have a function that is internal to this module called hey driver print
06:13this remember we're inside of the driver program right now so if you look at the bottom
06:17it's just a function that takes in some pointers and then print some stuff so it's going to print
06:22like it's going to print what the string is it's going to print what the long is my dog's growling
06:27at me i'm going to ignore him because i literally just let him pee and poop at this point now
06:32he's
06:32harassing me for treats he always does this okay so uh the string the long the double this function
06:40expects to receive three pointers to different data types it's just going to print all of them
06:45and the point get it the point of this function is we're going to go inside of the assembly module
06:50and then have the assembly module call on this function so that we can we can prove that we can
06:55have stuff sent from assembly to c++ or c using pointers we can have data sent over so anyway that's
07:04why both of these are in here the point needs to be uh marked as no name mangling because point
07:10is
07:10inside of assembly which will not name mangle and then hey driver print this that needs to have name
07:16mangling disabled also so that the assembly module can call on this other than that we're just basically
07:24inside of a main function here we're saying hello we're saying hey this is the c string we're making a
07:30c string inside of the main function notice how this is a local variable so that c string is going
07:35to show
07:36up on the stack it's going to show up in the area that is owned by main for main stack
07:41area same thing
07:43for my long that's a local variable on the stack um and but then we can actually send pointers to
07:50those
07:50pieces of data to another function in another module you don't have to only transport globals or or step
07:57on the heap you can transport pointers to local variables just make sure that by the time this function
08:02finishes then nowhere else is actually using that data because uh well being on the stack once main
08:10function or or once any function finishes then its portion of the stack will be cleaned up and removed
08:15and it'll be junk data you'll probably get a seg fault so but for now we're not going to use
08:19anything
08:20on the stack we're going to we're not going to use these local variables after the function exits we're
08:24just going to use them quickly on this call to point and then we're going to return to the operating
08:29system and finish the program so that's the driver now the hard part let's do this in assembly
08:36so for starters i'm going to make a data section and just explain it to you very very quickly
08:43again if you don't understand the basics of yasm x86 64 assembly did i mention that that's what this
08:49language is at the beginning of the video i guess i should put that in the description or record
08:54of an announcement that i can tack on at the beginning or something anyway so uh if you don't
09:01understand how to do this see my other videos but basically we're going to make a data section
09:05we're going to define some strings uh here's like an announcement oh we're inside of uh you know the
09:10module now the assembly module and now we're going to print the received string and then we're going to
09:16make a string that is owned by assembly which we can send into c++ when we call the uh the
09:22function
09:22inside of the driver so this string is owned by the assembly module notice how these are null
09:27terminated strings i just have like a comma zero there which means i have some extra functions i'm
09:32going to paste in that we're not really going to talk about because they've been discussed in other
09:35videos just so that we can print null terminated strings then i've got a new line here you know
09:41carriage return line feed and then i've just got some numbers that are owned by the assembly module
09:46then i've got a system write call call code one for the system call writes and file descriptor
09:52standard output uh so i can print just to the terminal again if you don't understand this see
09:58my other videos so now let's start the actual text section so this is where our instructions start
10:06so we got the text section here and uh we're going to use some external symbols don't worry about
10:13these i'm just using my own little library to print and input integers if you have access to this
10:19library use it if you don't if you're watching at home and you don't have this library
10:23then that's fine you can use you know printf or scanf or something like that to get
10:28and print floats from and to the user
10:33but yeah i'm just using that and then i'm marking an external function here called hey driver print this
10:39if you recall the driver module has a function called hey driver print this so
10:43this just allows my assembly code to call on that external function okay now next piece of code
10:50this is going to be actually i'm going to paste the print null terminated string function
10:55and related code because it's just like a big giant mess and we're mostly going to ignore it
11:01so just to show you what i'm doing here i have a function called print null terminated string
11:05so that i can print these strings up here and then i have it rely on a function called string
11:10length
11:11that i have implemented up here and all it does is just calculates the length of the string
11:16and then a crlf function so i can just call that so that's all explained in other videos don't worry
11:21about it for now we're going to
11:27start the actual entry point remember the driver
11:31was uh just going to call point right so now we just have to implement point in the assembly module
11:37so that's going to be like down here our entry point
11:44so the signature for this function is going to be character pointer and then a long pointer
11:48and it doesn't return anything and remember that if we look back at the driver
11:53that should match the signature right it's a character pointer and a long pointer
11:57and of course this is just a comment that reminds me of what to do
12:00in assembly you don't really have a signature you just sort of use registers
12:04but i'm reminding myself that rdi is going to be a character pointer and rsi is going to be a
12:10a long pointer here's a note to myself that i'm going to use r12 and r13 which means uh
12:16the first thing that i should do well actually before i even do that
12:19i should return from this function because it is a function
12:22i marked it as global so that the other module could call it the driver module could call it
12:27again see my other videos for hybrid programs
12:31but so now the you know if if the driver calls this function then now we're inside of point
12:36and there's a return statement so it's a valid function
12:39i should preserve the registers that i'm going to use that are marked as calli saved per the abi
12:44so i'm going to go prolog
12:47and then an epilog and i'm going to say push r12 and push r13
12:53and then i'm going to pop r13 pop r12 they should be in reverse order if you've seen my other
12:59videos
13:00you'll know this
13:02and um the the thing about this particular program is we're going to run into stack alignment issues
13:09so uh if you don't know about stack alignment and how it can crash your program without you
13:13realizing what's wrong see my other videos but for now we'll assume you know that
13:17and uh i i already know from running this program in advance that it's going to be out of alignment
13:22by eight bytes so i'm just going to push an extra register onto the stack and that's going to put
13:28it
13:28back into alignment so i know it looks weird but this is going to work let me get rid of
13:35this here
13:38okay so and then maybe if i can remember at the end of the video i can just remove that
13:42extra push
13:43pop pair and you'll see the program starts crashing but at home you can do it just just to double
13:49check
13:49so the first thing i really want to do is uh after i you know push and pop is save
13:55our incoming arguments
13:56remember uh the first integer argument and the second integer argument they come in as rdi and rsi
14:02in assembly per the abi if both of these things are pointers it doesn't matter what the data type is
14:09it could be pointing to anything including a double and these would still be considered integer
14:13arguments because well rdi and rsi are just going to be loaded up with memory locations which which
14:20are integers so i'm going to save our arguments to r12 and r13 now justifying our push and pop pair
14:26then i'm going to print a little welcome message so i'm going to print a little welcome message
14:32again you don't need to know about this function but it's explained in other videos that i've already
14:36published we're going to print our hello beginning message
14:47i'm getting nervous he needs to take a second poop sometimes it's poopoo number two time for him
14:53and he's not really just lying about a treat but he did go pee and poop already
15:02okay he just left and walked away okay if he comes back i'm letting him out this time
15:06i'll pause the video if he does it again
15:10okay i'm pausing the video
15:12no pee lied he went outside lifted up his little leg
15:15and a couple of drops of pee came out now he's staring at me like he deserves a treat
15:20sorry buddy i wish i could eat constantly all day long too
15:23but life isn't always fair anyway let's see am i even lined up on the camera anymore i don't even
15:29know so uh we're looking at this code here it's going to print a welcome message let's see if that
15:34actually works so i'm going to do make run again make files are uh whoops what did i do
15:41loader.asm what did i do what did i do
15:54what's the name of my source code file it's point i guess i'll just change it and then it'll probably
16:01work because it's still an assembly module hopefully that didn't mess it up too bad by copy pasting the
16:07wrong source code okay what is going on here floater dot oh i need to uh i need to change
16:17that hang on
16:17let me fix this i don't know if i'm going to edit this out it's fun to watch me struggle
16:21sometimes
16:22there we go point all right let's give it another try
16:29oh no star dot so no such file a directory dang it
16:34okay uh now this seems to work i may or may not have edited that out
16:37i copy pasted the wrong source code into my make file so i had to manually adjust it
16:41then i forgot to copy paste my library file into the build directory so i had to go find that
16:48um the driver sees my long as whatever what's going on
16:58print an alternate string begin oh the driver is printing a bunch of stuff okay
17:04i started to think why does it look like the program has a lot of stuff going on oh that's
17:08the driver okay so the driver says it sees it's long as 100 and then now we're inside of the
17:14point
17:14module so that's the only thing we've done in assembly so far then the driver has regained control
17:20um maybe i should add a couple of uh new lines in there so i don't get confused again
17:25we will do a c out and l and we'll do two of those
17:34run the program again and then i won't get confused about the messages okay so now we're inside of the
17:39point module and nothing is happening so points let me get rid of the make file here and um
17:46we're just printing a welcome message nothing else so now let's uh print the received string
17:51so what am i talking about so we're going to print a prefix basically saying hey we uh received the
17:59following string right so if you look at the symbol message received string it's uh just going to say
18:05now printing the received string and then it'll print it so what are we actually printing we're printing
18:10r12 what is r12 r12 is a character pointer to the print me string uh and so basically this this
18:21function print null terminated string it takes a character pointer so we're giving it a character
18:26pointer that we received when point was called by the driver notice how it gave a pointer to the c
18:35string you know all arrays uh are basically pointers they're just different syntactically
18:41sometimes so if i declare an array of some length and i give the symbol somewhere that symbol is really
18:47a character pointer so um by calling point with my c string i'm calling point inside of the assembly
18:55module with this character pointer so that means even though this c string is owned by the driver by the
19:03c plus plus module the assembly module has access to the string um so that means we should be able
19:10to print it right now already so just the rest of it is just like giving a pointer and notice
19:15how i'm
19:15not dereferencing r12 if i did dereferencing around r12 then uh we would be looking to that address
19:23and seeing what's there which wouldn't work for printing a null terminated string so let's just run it
19:28again this i don't know if you can hear him this dude is growling at me still because he
19:32wants another treat he just got denied he's trying to do it again i let him outside people
19:39he's been outside like three times already and he just went out like two minutes ago
19:45okay i love him so much it hurts my heart and he knows eventually he's going to break me because
19:49because it hurts my heart or i'm like too distracted it's like you know pulling the crank
19:54on a slot machine in vegas you know eventually something comes out that's what he does to me
19:59i've accidentally trained him so uh now printing the received string and notice how it prints
20:07hello this is a c string owned by me so our assembly module is able to print a c string
20:14that was created locally by a c plus plus module so we're handing around pointers
20:20nice can you hear him he's getting louder um so now let's modify the incoming long
20:28can you shush your freaking pants please
20:32shush your pants
20:35you know the sad thing also is he's so old that he's deaf now so
20:38he used to know what shush your pants meant it meant i'm not listening to you and you might as
20:44well
20:44stop because i'm not going to do anything based on your harassment but now he can't hear me say
20:49shush your pants so he just harasses me all day and all night okay um so i'm going to copy
20:56paste a
20:56little bit more code in here we're going to modify the incoming long so remember again that the point
21:03function it received a pointer to a long we're calling the long change me on the inside of this
21:10but it's coming in as r13 and if you notice what i'm doing here is i'm just saying let's increase
21:17the long so i'm going to dereference r13 because r13 is a pointer so i'm saying let's go
21:21to the memory and change the long that is inside of memory and we have to specify that it is
21:28a q word
21:29so that we uh you know we don't confuse the system the system might think are you modifying a
21:34q word or like a double word or like a word like how big is your data all we know
21:38is it's an
21:39integer because it's the increase instruction so i'm saying we got a q word you know a 64-bit
21:44integer sitting at that memory location i want you to dereference it and increase it and going back
21:49to the driver uh we're providing a pointer to our long so the long starts off as 100
21:55and uh we're just giving a pointer to it the next thing that we can do is we can uh
22:01ask the driver to
22:03print our own stuff actually you know what let's run the program right now just to show that the
22:08driver can see the change in the long so i'm going to run it again notice how first when the
22:14driver
22:14says hello it sees its own long as 100 then we're inside the assembly module we print the driver
22:21string and then we uh increase the driver's long and then we return to the caller which is the driver
22:27notice how at the very end of the program the driver sees its long as being 101 so we were
22:33able
22:33to modify data that was owned by a different module just by passing pointers and dereferencing them
22:39okay cool so now the next thing that we should do is uh let's ask the driver to print our
22:44own stuff
22:45that we own because remember if you go to the very top you know we own some stuff we own
22:49some
22:50we own a long we own a float right so we want to be able to do something with that
22:56so i'm going to copy paste this ask the driver to print our own stuff so i'm going to
23:03move three items inside of arguments for a function call and then i'm going to make a function call
23:08calling the function hey driver print this again hey driver print this is actually owned by the c plus
23:14plus module and the signature is just three pointers a pointer to a c string a pointer to
23:21a long and a pointer to a double remember even pointers to doubles are actually integers
23:25so they use the general purpose register so that's the three arguments right there rdi rsi and rdx
23:33m and then we're giving the first pointer is going to be the c string so message string inside asm
23:38so
23:39you can see that's this right here and then the next pointer is the long long inside asm where is
23:47that where's that long inside asm and the third is the float where did i just go i'm getting confused
23:54because my dog is harassing me right now so bad notice how i'm not dereferencing so like if when
24:00we were increasing the incoming long before r13 was a pointer so we dereferenced while we increased
24:06so that we would increase the actual value and not the pointer and not the pointer's memory location
24:11but here we're not dereferencing because we want to give the c plus plus module the actual pointers
24:18to our data we don't want to give it the data itself we want to give pointers to the data
24:22so we're not
24:23derefering with the brackets so then we call it and when we get back in here it should just be
24:29able to
24:29print everything so i'm going to run it one more time we're going to make it and run it and
24:38uh so now
24:40uh let's see so here we're inside of our assembly module and then here the assembly module has just
24:46called on hey driver print this remember the c plus plus module doesn't actually call this function
24:51the assembly module calls it so we're like going back and forth we're kind of crisscrossing
24:56so now the drivers uh print this function says we got the following string notice how that's the
25:02string that is owned by assembly so you know we define that inside of our data section in the
25:07assembly module and then it prints the long it prints it as hex and it just sort of prints the
25:13value then it prints it as hex again and then prints at the value i think actually not hex i
25:17think
25:17this prints the memory location let's double check real fast yeah so remember um in c plus plus i know
25:23this is not like a c plus plus video but um if the long is a pointer then if we
25:27just print it without
25:28dereferencing it we should see a memory location so it's telling us uh that the long's memory location
25:34is this and the doubles memory location is that and if you stare at those two numbers long enough
25:40and you understand hex which you can see my other videos for you'll see that those memory locations are
25:45right next to each other because that's the way we define them inside of assembly so
25:50we now have the ability to have data that is owned by assembly and give it to c plus plus
25:56or c
25:57using pointers no problem at all and then the printing driver thing exits and then the actual driver
26:04regain regain control and it just says that it sees it's long as 101 so uh yeah that's that's pretty
26:12much
26:12all i wanted to show you for this now you hopefully are an expert at passing data back and forth
26:18between
26:18various modules using pointers we're not using references because references are like a little bit
26:24a little bit less compatible pointers are just really easy they totally work in assembly no problem
26:31one more thing i just wanted to show you real fast before we go even though there's another video you
26:36should check out for stack alignment i just want you to see what happens if i remove this extra push
26:41pop pair
26:45so now my stack is about eight bytes uh uh off of its previous alignment because you know we're not
26:53pushing an extra eight byte value and somewhere inside of the uh let's see print null terminated string
26:58and then the hey driver print this oh and then we go into the driver and then the driver is
27:03going to
27:03call like a bunch of c stuff the program should probably crash because anytime you use a gcc function or
27:11gcc library or something like that the stack has to be aligned to 16 bytes so if it's off by
27:16eight
27:17then it'll crash and how did i know that i needed this well i just ran it first and it
27:21crashed
27:22and then i added the extra push pop pair and it didn't crash and i realized it was definitely stack
27:28alignment so let me uh run it one more time we should get a seg phone yeah we get a
27:34seg phone stack
27:35alignment oh no with no description of what's going on if you were in gcc you could i mean sorry
27:42if you
27:43were in gdb you could probably figure that out eventually but why not just give it a try add
27:47another push pop pair run the program again with no other modifications now it totally works
27:54okay well uh i think that's uh that's all i have for this video thank you so much for watching
27:59i hope you
28:00uh learned a little bit of stuff and you had a little bit of fun i will see you in
28:05the next video
28:08hey everybody thanks for watching this video again from the bottom of my heart i really appreciate it
28:12i do hope you did learn something and have some fun if you could do me a please a small
28:18little favor
28:18could you please subscribe and follow this channel or these videos or whatever it is you do on the current
28:24social media website that you're looking at right now it would really mean the world to me and it'll
28:29help make more videos and grow this community so we'll be able to do more videos longer videos
28:34better videos or just i'll be able to keep making videos in general so please do do me a kindness
28:41and uh and subscribe you know sometimes i'm sleeping in the middle of the night and i just wake up
28:45because
28:45i know somebody subscribed or followed it just wakes me up and i get filled with joy that's exactly what
28:50happens every single time so you could do it as a nice favor to me or you could you could
28:55troll me if you
28:55want to just wake me up in the middle of the night just subscribe and then i'll just wake up
28:59i promise
28:59that's what will happen also uh if you look at the middle of the screen right now you should see
29:04a qr
29:05code which you can scan in order to go to the website which i think is also named somewhere at
29:09the bottom
29:10of this video and it'll take you to my main website where you can just kind of like see all
29:15the videos i
29:15published and the services and tutorials and things that i offer and all that good stuff and uh
29:20uh if you have a suggestion for uh uh clarifications or errata or just future videos that you want to
29:29see please leave a comment or if you just want to say hey what's up what's going on you know
29:33just send
29:33me a comment whatever i also wake up for those in the middle of the night i get i wake
29:37up in a cold
29:38sweat and i'm like it would really it really mean the world to me i would really appreciate it so
29:44again thank you so much for watching this video and um enjoy the cool music as as i fade into
29:51the
29:51darkness which is coming for us all
30:25so
30:35so
30:37so
30:37so
Comments