/****************************************************************************** * * sys_read_ccnt.c * * Implements a system call to retrieve the current * cycle count on an ARM Cortex-A53 in AARCH32 mode. * * Takes a pointer to an unsigned long long as an argument. * Writes the cycle count value to the pointer's location. * * Written October 9, 2020 by Marion Sudvarg * ******************************************************************************/ #include #include #include #include #include //Define a system call implementation that takes one argument SYSCALL_DEFINE1( read_ccnt, unsigned long long *, cc ){ //Enable cycle counter, if not yet enabled pmccntr_enable_once(1, 0); //Retrieve the cycle count *cc = pmccntr_get(); return 0; } //End of file