mirror of
https://github.com/cyring/CoreFreq.git
synced 2025-07-23 20:20:40 +02:00
[riscv64] Attempt to enable the Cycle and Instruction counters
This commit is contained in:
@@ -1693,13 +1693,34 @@ static void Controller_Exit(void)
|
|||||||
|
|
||||||
static void Generic_Core_Counters_Set(union SAVE_AREA_CORE *Save, CORE_RO *Core)
|
static void Generic_Core_Counters_Set(union SAVE_AREA_CORE *Save, CORE_RO *Core)
|
||||||
{
|
{
|
||||||
/*TODO*/
|
register unsigned long long ctr_reg;
|
||||||
|
__asm__ volatile
|
||||||
|
(
|
||||||
|
"csrr %0, scounteren"
|
||||||
|
: "=r" (Save->SCOUNTEREN)
|
||||||
|
:
|
||||||
|
: "cc", "memory"
|
||||||
|
);
|
||||||
|
ctr_reg = Save->SCOUNTEREN | 0b101;
|
||||||
|
__asm__ volatile
|
||||||
|
(
|
||||||
|
"csrw scounteren, %0"
|
||||||
|
:
|
||||||
|
: "r" (ctr_reg)
|
||||||
|
: "cc", "memory"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Generic_Core_Counters_Clear(union SAVE_AREA_CORE *Save,
|
static void Generic_Core_Counters_Clear(union SAVE_AREA_CORE *Save,
|
||||||
CORE_RO *Core)
|
CORE_RO *Core)
|
||||||
{
|
{
|
||||||
/*TODO*/
|
__asm__ volatile
|
||||||
|
(
|
||||||
|
"csrw scounteren, %0"
|
||||||
|
:
|
||||||
|
: "r" (Save->SCOUNTEREN)
|
||||||
|
: "cc", "memory"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define Counters_Generic(Core, T) \
|
#define Counters_Generic(Core, T) \
|
||||||
|
@@ -155,6 +155,7 @@ typedef struct
|
|||||||
union SAVE_AREA_CORE {
|
union SAVE_AREA_CORE {
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
unsigned long long SCOUNTEREN;
|
||||||
};
|
};
|
||||||
} SaveArea;
|
} SaveArea;
|
||||||
#ifdef CONFIG_CPU_FREQ
|
#ifdef CONFIG_CPU_FREQ
|
||||||
|
Reference in New Issue
Block a user