Sunday 9 March 2014

Assembler in aarch64

So it seems like the only actual code required to change is rather small. Thanks to Nick for giving me a hint in the right direction there. Would likely have rewritten the entire header file had he not. Forest for the trees. Leave the output/input/clobbering alone.

So yeah the first bit includes: __asm__ __volatile__ ("incl %0" - In essence, increment  "at->x" by one, discard the value currently in m, and replace it with the incremented value, and the cc just shows that the value is going to be clobbered/changed by the end of the function.
Increment register 0
In aarch64, this should simply be an 'ADD %0' or possibly 'inc %0'

The second line, as shown here:
decrement register 0, set byte e to one, otherwise zero
This one is a little more complex, but not too much really. It should be 'SUB %0,' since it's decrementing the at->x value, but I'm still looking for the an aarch64 variation on 'sete %1'. Shouldn't take too long really.
Inline assembly is a pain the in the butt to find specific answers for some time.

No comments:

Post a Comment