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());

Thanks.

- Jiaxun
The University of Edinburgh is a charitable body, registered in Scotland, with 
registration number SC005336. Is e buidheann carthannais a th' ann an Oilthigh 
Dhùn Èideann, clàraichte an Alba, àireamh clàraidh SC005336.

Reply via email to