[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: MIPS-specific porting issue



On Sat, Dec 04, 2021 at 12:07:29AM +0000, YANG Jiaxun wrote:
> Hi Stéphane.
> 
> MIPS do have a way to access count register from user space.
> Unfortunately there is no GCC intrinsic function for it, you may try following inline assembly.
> 
> static inline unsigned long get_count() {
>     unsigned long count;
>     asm volatile ("rdhwr %[rt], $2" : [rt] "=d" (count));
>     return count;
> }
> 
> return Val_long (get_count());

To be more precise - Not all CPUs have this (Older MIPS I for example
dont) but there is kernel emulation / instruction trapping for it.

And - I dont think Debian supports MIPS I targets anymore.

Flo
-- 
Florian Lohoff                                                     f@zz.de
  Any sufficiently advanced technology is indistinguishable from magic.

Attachment: signature.asc
Description: PGP signature


Reply to: