Re: MIPS-specific porting issue

YANG Jiaxun <[email protected]>
Newsgroups gmane.linux.debian.ports.mips
Message-ID <AM7PR05MB667849E87A8F7BED1F451845D36B9@AM7PR05MB6678.eurprd05.prod.outlook.com>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.