mirror of
https://github.com/genodelabs/genode.git
synced 2025-04-08 03:45:24 +00:00
base-hw: get rid of static perf counter object
It is not necessary to have a class, an object, and a generic header for the perfomance counter. The kernel merely enables the counter using cpu registers ('msr' instructions, no MMIO) on arm_v6 and arm_v7 only. Therefore this commit makes the header arm-specific and replaces class and global static object with a function for enabling the counter. Fixes #4217
This commit is contained in:
parent
b817e1977c
commit
5d74509b2d
@ -19,8 +19,7 @@
|
||||
|
||||
void Kernel::Cpu::_arch_init()
|
||||
{
|
||||
/* enable performance counter */
|
||||
perf_counter()->enable();
|
||||
enable_performance_counter();
|
||||
|
||||
/* enable timer interrupt */
|
||||
_pic.unmask(_timer.interrupt_id(), id());
|
||||
|
@ -16,21 +16,7 @@
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
/**
|
||||
* Performance counter
|
||||
*/
|
||||
class Perf_counter
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Enable counting
|
||||
*/
|
||||
void enable();
|
||||
};
|
||||
|
||||
|
||||
extern Perf_counter * perf_counter();
|
||||
void enable_performance_counter();
|
||||
}
|
||||
|
||||
#endif /* _CORE__KERNEL__PERF_COUNTER_H_ */
|
@ -93,7 +93,7 @@ struct Accvalctlr : Register<32>
|
||||
};
|
||||
|
||||
|
||||
void Kernel::Perf_counter::enable()
|
||||
void Kernel::enable_performance_counter()
|
||||
{
|
||||
/* enable counters and disable overflow interrupt. */
|
||||
Pmcr::access_t v = Pmcr::enable_and_reset();
|
||||
@ -105,10 +105,3 @@ void Kernel::Perf_counter::enable()
|
||||
/* enable user-mode access */
|
||||
Accvalctlr::write(Accvalctlr::enable_user_access());
|
||||
}
|
||||
|
||||
|
||||
Kernel::Perf_counter* Kernel::perf_counter()
|
||||
{
|
||||
static Kernel::Perf_counter inst;
|
||||
return &inst;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ struct Pmuseren : Register<32>
|
||||
};
|
||||
|
||||
|
||||
void Kernel::Perf_counter::enable()
|
||||
void Kernel::enable_performance_counter()
|
||||
{
|
||||
/* program PMU and enable all counters */
|
||||
Pmcr::write(Pmcr::enable_and_reset());
|
||||
@ -179,10 +179,3 @@ void Kernel::Perf_counter::enable()
|
||||
Pmuseren::write(Pmuseren::enable());
|
||||
Pmintenclr::write(Pmintenclr::disable_overflow_intr());
|
||||
}
|
||||
|
||||
|
||||
Kernel::Perf_counter* Kernel::perf_counter()
|
||||
{
|
||||
static Kernel::Perf_counter inst;
|
||||
return &inst;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user