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

how can I return a value within embedded assembler?

Note: This was originally posted on 8th May 2009 at http://forums.arm.com

Hi,

does anybody know how I can write an embedded ASM function that returns the actual PSR value? I prefered to go on like this:

int getCpsr( void )
{
  int currentCPSR;
  MRS currentCPSR, CPSR
  return currentCPSR;
}

how can I return a value within embedded assembler?
Parents
  • Note: This was originally posted on 8th May 2009 at http://forums.arm.com

    Thanks,

    but this is also ARM machine language instruction. I cannot use this inline assembler
    __asm".....


    In this context, AFAIK, it is not inline assembler.  This is just telling the compiler to treat _cpsr as the if it were the APSR register in Cortex-M3 and it will generate the appropriate instructions for you when you use the _cpsr variable.
Reply
  • Note: This was originally posted on 8th May 2009 at http://forums.arm.com

    Thanks,

    but this is also ARM machine language instruction. I cannot use this inline assembler
    __asm".....


    In this context, AFAIK, it is not inline assembler.  This is just telling the compiler to treat _cpsr as the if it were the APSR register in Cortex-M3 and it will generate the appropriate instructions for you when you use the _cpsr variable.
Children
No data