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

What is different of the function call and return manner between  ARM Linux kernel and ARM applications?

Note: This was originally posted on 29th August 2012 at http://forums.arm.com

Hi,

When I disassamble the ARM Linux kernel for ARMv7(tegra 2),I found that a lot of function return using ldm command,just like   ldm sp,  {fp, sp, pc},but in the applications ( SPECCPU2006 for arm),the function return mostly using bx or b.Why that happened? Is the kernel Makefile used some gcc arguments that can lead the compiler to optimize the kernel?
Parents
  • Note: This was originally posted on 29th August 2012 at http://forums.arm.com

    I think it may just be the functions you looked at.

    There are several ways to return from a function in ARM/Thumb.  The most common (at least in my experience) are "BX lr" and "LDM sp!, {...., sp}".  Although the second one often gets written as "PUSH {....., pc}" depends on which tools you are using.  I suspect if you kept looking long enough you would find examples of each in both the kernel and the app.

    The "B ..." is a little more interesting.  I suspect that this is a compiler optimization called "tail calling" - again there is no reason why you this couldn't be present in both the kernel and the app.  http://en.wikipedia.org/wiki/Tail_call
Reply
  • Note: This was originally posted on 29th August 2012 at http://forums.arm.com

    I think it may just be the functions you looked at.

    There are several ways to return from a function in ARM/Thumb.  The most common (at least in my experience) are "BX lr" and "LDM sp!, {...., sp}".  Although the second one often gets written as "PUSH {....., pc}" depends on which tools you are using.  I suspect if you kept looking long enough you would find examples of each in both the kernel and the app.

    The "B ..." is a little more interesting.  I suspect that this is a compiler optimization called "tail calling" - again there is no reason why you this couldn't be present in both the kernel and the app.  http://en.wikipedia.org/wiki/Tail_call
Children
No data