ARM counter registers and get_cyclecount()

Mark Robert Vaughan Murray markm at FreeBSD.org
Sun Oct 20 16:13:35 UTC 2013


Hi folks

I asked a similar question to this a month or so ago, then got involved in other work, so apologies for the repetition!

The random(4) device benefits from having a decent hardware get_cyclecount() implementation. In i386 and arm, we have a stopgap version that uses binuptime(), which is slow and prone to quantisation error.

I've hacked up a minimalist hardware version for ARMv6/RPI (which is the only ARM I have access to, and I'm keen to use it for other things as well), and I'm looking for improvement advice and/or commit blessing.

Things it could conceivably do better:

1) The counter is 32 bits only. At clocks of hundreds-of-megahertz, this will overflow in some 10's of seconds to maybe a minute, so it would be nice (but to essential) to trap the overflow with an interrupt and increment an upper-half counter, making a 64-bit counter.

2) Set up the debug/profile/counter registers as some kind of device (suggestion from a couple of months back that I have no more information on)?

3) Support more ARM arches in a more general way? I have very little ARM hardware (only other is a BeagleBoard-xM) to test/develop this on.

Anyone interested in helping me or taking this over? :-)

M
-- 
Mark R V Murray
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arm.diff
Type: application/octet-stream
Size: 1471 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20131020/286fbb44/attachment.obj>
-------------- next part --------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 353 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20131020/286fbb44/attachment.sig>


More information about the freebsd-arm mailing list