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

purpose of RSDIS in ACTLR ?

Hello,

What is the purpose of the RSDIS (Return Stack DISable) bit in ACTLR ?

What would be the consequence on code execution if set DISable ?

Is the software able to write this bit ?

Thanks for help

Parents
  • Hi Sylvain,

    What is the purpose of the RSDIS (Return Stack DISable) bit in ACTLR ?

    RSDIS enables (RSDIS=0) or disables (RSDIS=1) the return address stack used in procedure call/return program flow prediction.

    What would be the consequence on code execution if set DISable ?

    In Cortex-R4/R5, if program flow prediction is not entirely disabled (by also setting the branch prediction policy to always not-taken), the remaining branch prediction schemes are still in effect.

    For programs that can exploit the procedure call/return program flow prediction, the enhancement in execution speed if the return address stack is ENABLED can be estimated through some data provided in Cortex-R4/R5 TRMs. Here are some excerpts from Cortex-R5 TRM Rev. r1p2 (ARM DDI 0460D) section B.9 Branches:

    Table B-10.png

    From page B-15, Table B-10 shows that for the two BX instruction formats, execution is 9x faster if return stack prediction is CORRECT.

    Table B-13.png

    From page B-17, Table B-13 shows LDR to PC instructions, execution can be up to 9x faster if return stack prediction is CORRECT.

    Table B-18.png

    From page B-21, Table B-18 shows LDMIAs with PC in register list, there are additional 8 cycles if return stack prediction is INCORRECT.

    In most cases, I think a disabled return address stack is equivalent to incorrect return stack prediction in terms of the number of cycles needed in executing the type of instructions cited in the tables.

    Is the software able to write this bit ?

    Generally, ACTLR (where RSDIS is contained) is a Read/Write register but accessible in privileged mode only.

    For Cortex-A5, there are also additional caveats:

    In Non-secure state,

      • if NSACR.NS_SMP=0, ACTLR is Read-Only.
      • if NSACR.NS_SMP=1, RSDIS is among the bits of ACTLR which are Write Ignore.

    Attempts to write to ACTLR in secure privileged modes when CP15SDISABLE is HIGH result in an Undefined instruction exception.

    Regards,

    Goodwin

Reply
  • Hi Sylvain,

    What is the purpose of the RSDIS (Return Stack DISable) bit in ACTLR ?

    RSDIS enables (RSDIS=0) or disables (RSDIS=1) the return address stack used in procedure call/return program flow prediction.

    What would be the consequence on code execution if set DISable ?

    In Cortex-R4/R5, if program flow prediction is not entirely disabled (by also setting the branch prediction policy to always not-taken), the remaining branch prediction schemes are still in effect.

    For programs that can exploit the procedure call/return program flow prediction, the enhancement in execution speed if the return address stack is ENABLED can be estimated through some data provided in Cortex-R4/R5 TRMs. Here are some excerpts from Cortex-R5 TRM Rev. r1p2 (ARM DDI 0460D) section B.9 Branches:

    Table B-10.png

    From page B-15, Table B-10 shows that for the two BX instruction formats, execution is 9x faster if return stack prediction is CORRECT.

    Table B-13.png

    From page B-17, Table B-13 shows LDR to PC instructions, execution can be up to 9x faster if return stack prediction is CORRECT.

    Table B-18.png

    From page B-21, Table B-18 shows LDMIAs with PC in register list, there are additional 8 cycles if return stack prediction is INCORRECT.

    In most cases, I think a disabled return address stack is equivalent to incorrect return stack prediction in terms of the number of cycles needed in executing the type of instructions cited in the tables.

    Is the software able to write this bit ?

    Generally, ACTLR (where RSDIS is contained) is a Read/Write register but accessible in privileged mode only.

    For Cortex-A5, there are also additional caveats:

    In Non-secure state,

      • if NSACR.NS_SMP=0, ACTLR is Read-Only.
      • if NSACR.NS_SMP=1, RSDIS is among the bits of ACTLR which are Write Ignore.

    Attempts to write to ACTLR in secure privileged modes when CP15SDISABLE is HIGH result in an Undefined instruction exception.

    Regards,

    Goodwin

Children