Dungy
Dungy

Reputation: 1

ARM assembly array in a structure

So I need to write a function with 3 parameters, all of the parameters are structs, the main file is written in C and the function in ARM assembly. So I wanted to ask how to manipulate the data in those structs? Because all the data is stored individually in every register.

e.g. -

Struct contains an int and an array
Struct { int a, int b[] }

function(struct a, struct b, struct c)

So the data in assembly is stored like R0=struct a. int a, R1=struct a. int b[0]

I tried pushing everything on stack, but I get the same thing. So how to manipulate the arrays in all the structs?

Upvotes: 0

Views: 309

Answers (1)

Mark Lakata
Mark Lakata

Reputation: 20903

Write what you want to do in C, then compile it and look at the disassembly. GUI compilers will have options to enable saving the intermediate assembly. Other command line compilers should have the same, or you can run objdump -d *.obj to disassemble the object file.

Every platform and ABI is slightly different, and you are better off letting the compiler give you an example.

Upvotes: 1

Related Questions