Skip to content

Commit

Permalink
core: arm: add helper for reading isar5
Browse files Browse the repository at this point in the history
Add helper function for reading ID_ISAR register on both
aarch32/aarch64.

Signed-off-by: Igor Opaniuk <igor.opaniuk@foundries.io>
  • Loading branch information
igoropaniuk committed Jan 27, 2024
1 parent d197643 commit e69a4b5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/arch/arm/include/arm32.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,14 @@ static __always_inline __noprof uint32_t read_r7(void)
return val;
}

static __always_inline __noprof uint32_t read_isar5(void)
{
uint32_t isar_reg;

asm volatile("mrc p15, 0, %0, c0, c2, 5" : "=r"(isar_reg));
return isar_reg;
}

#endif /*__ASSEMBLER__*/

#endif /*__ARM32_H*/
8 changes: 8 additions & 0 deletions core/arch/arm/include/arm64.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,14 @@ static inline __noprof void tlbi_vale1is(uint64_t va)
asm volatile ("tlbi vale1is, %0" : : "r" (va));
}

static inline __noprof uint32_t read_isar5(void)
{
uint64_t isar_reg;

asm volatile("mrs %0, ID_ISAR5_EL1" : "=r"(isar_reg));
return (uint32_t)isar_reg;
}

static inline void write_64bit_pair(uint64_t dst, uint64_t hi, uint64_t lo)
{
/* 128bits should be written to hardware at one time */
Expand Down

0 comments on commit e69a4b5

Please sign in to comment.