ARM Multiple Load and Store

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
Hello. This is Dr Miller, and this is Episode 11.11 of Assembly.
Today we're gonna talk about multiple load and multiple store.
It's a multiple load and store.
So Arm has the original loading store, so load, register and store register,
and then we have some additional ones. And so we've got the load Multiple in the store, multiple. So L d m in STM.
And then we have a bunch of different specifications here. How you can have conditional execution. We have our base register the right back ability, and then we can give it a list of registers.
Um, and then when we're done, we can have things like increment after increment before deck Ament after indica Ament before. So we'll look at some examples here,
so to load multiple. So it's L d m. So we can say load. Multiple are zero R one to r two.
So this will load
are zero will be appointer and then it will load the data pointing to that by our into our one and then the next piece of data into our to
we can also have store register.
So here we got r two and R five. So we can either use a dash to denote a sequence or weaken list them one at a time, or we can combine the two.
So let's look at an example here.
So here we have an array and it has a bunch of words F f A B B. So on and so forth Cafe cafe.
And so we can see that what we do here is we're going to, um, load this data in. So we first get the address of the array here,
Um, and this is using a different style. So we actually have the array address down here. That's pointed. We could alternatively used LD R R zero
um, equal array to do that, but this is kind of the another way to do it.
And so here we are, loading that array address into our zero, and then we're going to load multiple. So r zero will load it into it are one through our five, and then we're doing some operations on that, and then we're gonna go ahead and store it.
So let's look at what this looks like after we've executed. So we execute this instruction
now are zero has this first word are too has this word. So I are one. Has this word are too Has this word
R three R four and r five So we can see that those all got loaded in from the array that we had to find. And so that load multiple will do that.
And then after we did the exclusive or in the and on our registers, we had modified R one and r two, and we can see that are one. Now, looks like this are two looks like this.
And so when we go and do the writing So the store multiple it'll right all of those values into memories. So I went, I went ahead and,
um, in GB using gaffe. I did examine, slash, fives, letter print me off five bites and then the value pointed to by our zero. So r zero does the writing and we can see that it wrote in the data. So are one got written. Here are two got written. Here are three guys in here.
Come on down the line so we can see that those got written into memory when we executed that s t m command. So it right? All of these to the address pointed to it. That location.
So there additional combinations that we can have. So, for example, we can have store multiple increment after or load multiple increment after,
um and we can put the bang in there to do the right back, and then we can ever register or a list of registers.
So let's look at an example.
So here we have the we're loading the register or zero with message,
and then we go ahead and print off the string, and then we're gonna load multiple increment after with our zero, and then we'll update its address and we'll load those into registers are one through our nine. So we'll load,
um, eight times eight bites into memory.
So let's look at what the registers look like before.
So are zero pointed to our string, and we can see our sequence of characters that are inside of our string.
So those air right there,
we can see that all of these registers don't have anything particularly interesting in them. One points of parameters.
But after we do this load, multiple are zero with right back. So r zero is gonna get updated. And then this whole list of registers
we can see that now are zero points to the end of this string. And so weaken c e how this data is loaded.
So right here, and then you can see test this string output. So these are all hex values. And then
Geffen GTB showed us Oh, that looks like that's pointing to a string. And so it shows us what those strings will look like.
We can see that all of this data got loaded into all of these registers here and then that are zero because we had the right back are zero gets updated to now point to the last bite that it had loaded. So it loaded all these bites up to here and you can see the S E.
And then it points to the next e inside of that string.
So today we talked about some multiple load and multiple store operations
in the future, will give an example using multiple load in multiple store, and we'll see that.
And then here's our quiz. So given a pointer to a ray are zero. How would you load data into registers r one R two r three r five and are seven and then update that pointer
so we could use load multiple increment after our zero. So we gotta right back
are one through our three r five and r seven.
If you have questions, you can email me, Miller, MJ at you and Katie Dottie to you, and you can find me on Twitter at Milhouse 30.
Up Next