ARM Load and Store Multiple Examples
Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or
Already have an account? Sign In »

Video Transcription
00:02
Hello. This is Dr Miller, And this is Episode 11.12 of Assembly.
00:08
So today we're going to give an arm load and store with multiple operations.
00:15
So are our example.
00:16
So using the load multiple on the store, multiple. It's best to use an array. And so what we're gonna do is we're going to use strings, so strings, air naturally arrays.
00:25
And so we're gonna copy a string from one buffer to another use L D. M and S T m.
00:31
And then we're going to load some parts of a string into memory and then do a swap on those.
00:39
So let's get our terminal open. I've already created our project.
00:44
All right, so we're gonna wanna have at least one string
00:47
messes.
00:59
Okay?
01:00
I won't put a new line in there,
01:03
and then we'll have our next message
01:10
on this Allocate. Ah, 100 bytes for that one.
01:15
All right,
01:18
so we'll go ahead and save our registers,
01:23
Mainly link register.
01:25
Restore it.
01:27
You know that. There.
01:30
All right. So what we want to do is we want to,
01:33
um usar load and store in order to copy the string. And my string just happens to be
01:40
just enough bites that we can do the copy Very simply. So
01:46
we will do. Load register are zero
01:52
message mood register R. One R five
01:59
message one. So now we've got our pointers set up.
02:01
And so if we want to load the whole thing, we can say load, multiple
02:07
are zero
02:09
and we can store that in registers R one to R four.
02:16
And now, since it's stored in our one through our four, we can go ahead and save it into the other race. So STM
02:24
or five
02:30
R one to R for
02:32
So we will load the data into these registers and then store it back into these registers.
02:42
So that should copy our string for us.
02:45
And then what we'd like to do is we want to do a swap on some of these, and so we'll go ahead and do load register
02:52
40
02:53
message
02:55
and then load multiple
03:01
O. R. Zero and we'll add a right back there
03:06
because we're gonna load it into R one and R two. So that update the point of the fact that we just loaded,
03:13
um to full registers worth
03:15
of data,
03:17
so that would be eight bites.
03:20
So add that to our pointer
03:23
and then we can say load. Multiple are zero
03:27
are three
03:30
R three and R for
03:34
it's our pointer got updated and we can update this point or two if we want.
03:38
But our pointer got updated from this operation and it also will get updated from this one.
03:45
And so then we can
03:50
load in and we're gonna basically swap these around.
03:53
So we load our base address back,
04:00
and then we're gonna write thes bites back in the opposite order so we'll do
04:06
as tm So we're gonna right into our zero with the right back.
04:13
All right? Are three
04:15
and our for
04:18
and then we'll write R one and R two
04:25
again, we're updating the pointer to the fact that we just wrote a bites.
04:30
Okay, so that should swap
04:34
a B c d e f with G h i J k l
04:40
in memory, and then we'll go ahead and print off our strings.
04:53
So ladies in,
04:59
It's a message one,
05:09
and they should be done
05:16
so we can see that we reverse the first
05:19
eight characters with the 2nd 8 characters.
05:25
And then we were able to copy all of the data from this into a another array and then print it off.
05:31
And so we successfully copied the dating successfully, were able to print it off,
05:36
and I copied more than just that, but it copied data for us.
05:42
All right,
05:45
So today's lecture we used L d m and S t m in orderto load multiple into multiple registers.
05:51
If you have questions, you can email me, Miller MJ at you and Kate I e to you, and you can find me on Twitter at Milhouse 30.
Up Next
Similar Content