ARM GCC inline assembly
Introduction
Just now I want to print the ARM CP15 registers' value in a C function, I know I need the inline assembly technology. After read some codes in linux kernel and searched the internet, I have got some simple idea.
Examples
Read ARM ID code:
u32 val;Write TTB:
__asm__ __volatile__ ("mrc p15, 0, %0, c0, c0, 0" : "=r" (val));
printk("ARM ID code: 0x%x\n", val);
u32 valFor more information, see:
/*... */
__asm__ __volatile__ ("mcr p15, 0, %0, c2, c0, 0" : : "r" (val));
http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home