This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARM assembly

Former Member
Former Member

I have to write an assembly code in arm (cortex A-8) ,which assigns a value passed by the user(pass by value)  to a particular general purpose register(for  example r0).

my function looks like this

int assign_to_reg(int x)

{

     MOVE_TO_R0(x);

     return 0;

}

 

And the MACRO looks like this,

 

#define MOVE_TO_R0(val)           \
       __asm__ __volatile__    \
       (                       \
         "mov r0, %0"       \
         :                     \
:"r0" (val)           \
);

 

This assembly code is not assigning value to r0 .can anyone please  help me on this