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

XN bit support on ARMv7 Cortex A15

Parents
  • Note: This was originally posted on 10th January 2013 at http://forums.arm.com

    To verify the XN bit support on Cortex A15. I executed the attached c test code.
         
    I followed below steps to test XN bit support.

    1. I compiled attached test program i.e exectest with "-z execstack"option (gcc -z execstack -o exectest exectest.c -lpthread)

    2. I removed XN bit related code in ./arch/arm/mm/mmu.c and burned kernel on target.
         Filename : arch/arm/mm/mmu.cLine:  346  
            if(cpu_is_xsc3() || (cpu_arch >= CPU_ARCH_ARMv6 && (cr & CR_XP))){
            if (!cpu_is_xsc3()) {

      #if 0

                         /*  Mark device regions on ARMv6+ asexecute-never

                 * to prevent speculativeinstruction fetches. */

                  mem_types[MT_DEVICE].prot_sect |= PMD_SECT_XN;

                  mem_types[MT_DEVICE_NONSHARED].prot_sect |= PMD_SECT_XN;

                  mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_XN;

                  mem_types[MT_DEVICE_WC].prot_sect |= PMD_SECT_XN;

      #endif

                 }

          if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) {

    3. Executed test program on target.

    4.    I found some times successful execution with correct output and sometimes page fault.

      As per my understanding this test program should always execute correctly and give correct output.

      If I skip step 2 (means not commenting the XN bit related code) then also I have got the same behavior.

    Please let me know how to verify XN bit support.




    Thanks & Regards,
Reply
  • Note: This was originally posted on 10th January 2013 at http://forums.arm.com

    To verify the XN bit support on Cortex A15. I executed the attached c test code.
         
    I followed below steps to test XN bit support.

    1. I compiled attached test program i.e exectest with "-z execstack"option (gcc -z execstack -o exectest exectest.c -lpthread)

    2. I removed XN bit related code in ./arch/arm/mm/mmu.c and burned kernel on target.
         Filename : arch/arm/mm/mmu.cLine:  346  
            if(cpu_is_xsc3() || (cpu_arch >= CPU_ARCH_ARMv6 && (cr & CR_XP))){
            if (!cpu_is_xsc3()) {

      #if 0

                         /*  Mark device regions on ARMv6+ asexecute-never

                 * to prevent speculativeinstruction fetches. */

                  mem_types[MT_DEVICE].prot_sect |= PMD_SECT_XN;

                  mem_types[MT_DEVICE_NONSHARED].prot_sect |= PMD_SECT_XN;

                  mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_XN;

                  mem_types[MT_DEVICE_WC].prot_sect |= PMD_SECT_XN;

      #endif

                 }

          if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) {

    3. Executed test program on target.

    4.    I found some times successful execution with correct output and sometimes page fault.

      As per my understanding this test program should always execute correctly and give correct output.

      If I skip step 2 (means not commenting the XN bit related code) then also I have got the same behavior.

    Please let me know how to verify XN bit support.




    Thanks & Regards,
Children
No data