lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 13 Jul 2010 13:49:54 +0200
From:	Clemens Ladisch <clemens@...isch.de>
To:	Samuel Xu <samuel.xu.tech@...il.com>
CC:	linux-kernel@...r.kernel.org
Subject: Re: Question on HPET timer reading from device driver?

Samuel Xu wrote:
> While I failed to find a way to get time stamp value of HPET in Linux
> kenerl (I am doing a driver and want to know elapsed cycle from driver
> code).

The HPET is x86-specific any might not be available on every machine.

> I tried hpet_readl() from my driver code, while hit compiling error.

This function is intended for internal use by the kernel and not for
drivers, so it is not exported for modules.

You can hack your own accessor function by calling ioremap() on the HPET
address (0xfed00000 or 0xfefff000 or whatever) and reading from that
memory.

A more portable way to get a time stamp is getrawmonotonic().

> I also read the Linux Documentation of HPET, which contain a user mode
> demo app to generate a periodic timer via HPET, while missing the time
> stamp reading.

There is no ioctl for this; call mmap() on /dev/hpet and then read the
main counter value from offset 0xf0 of that memory.

A more portable way to get a time stamp is to use clock_gettime() with
CLOCK_MONOTONIC_RAW.


Regards,
Clemens
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ