mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
readme: document rdtsc
This commit is contained in:
@@ -1,11 +1,5 @@
|
||||
/*
|
||||
ARM only.
|
||||
|
||||
TODO not working.
|
||||
|
||||
* https://stackoverflow.com/questions/40454157/is-there-an-equivalent-instruction-to-rdtsc-in-arm
|
||||
* https://stackoverflow.com/questions/31620375/arm-cortex-a7-returning-pmccntr-0-in-kernel-mode-and-illegal-instruction-in-u/31649809#31649809
|
||||
* https://blog.regehr.org/archives/794
|
||||
*/
|
||||
|
||||
#include <linux/debugfs.h>
|
||||
@@ -17,7 +11,6 @@ TODO not working.
|
||||
#include <linux/uaccess.h> /* copy_from_user, copy_to_user */
|
||||
#include <uapi/linux/stat.h> /* S_IRUSR */
|
||||
|
||||
|
||||
static struct dentry *debugfs_file;
|
||||
|
||||
static int show(struct seq_file *m, void *v)
|
||||
|
||||
@@ -16,11 +16,10 @@ Only works in x86_64.
|
||||
int main(void) {
|
||||
uintmax_t val;
|
||||
#if defined(__i386__) || defined(__x86_64__)
|
||||
/* https://stackoverflow.com/questions/9887839/clock-cycle-count-wth-gcc/9887979 */
|
||||
val = __rdtsc();
|
||||
#else
|
||||
val = 0;
|
||||
#endif
|
||||
printf("%jx\n", val);
|
||||
printf("%ju\n", val);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user