Performance Monitor Unit(PMU) of 64-bit ARMv8-A in Linux


I tried the below codes in Linux machine. The codes are successfully build in my workspace(using bat files) and also binaries are created.But I have some errors like “Illegal instruction” When I loaded these binaries in my processor (S32V234 vision). My Hardware could not able to support these codes.Could you please tell me the solution for this.

/*Enable user-mode access to counters. */
asm volatile(“msr pmuserenr_el0, %0” : : “r”((u64)ARMV8_PMUSERENR_EN_EL0|ARMV8_PMUSERENR_ER|ARMV8_PMUSERENR_CR));

/* Performance Monitors Count Enable Set register bit 30:0 disable, 31 enable. Can also enable other event counters here. */
asm volatile(“msr pmcntenset_el0, %0” : : “r” (ARMV8_PMCNTENSET_EL0_ENABLE));

/* Enable counters */
u64 val=0;
asm volatile(“mrs %0, pmcr_el0” : “=r” (val));
asm volatile(“msr pmcr_el0, %0” : : “r” (val|ARMV8_PMCR_E));