Commit dd4c0c6b authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Andrei Vagin

compel: fpu -- Add compel_fpu_feature_offset helper

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
Reviewed-by: 's avatarDmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent d25af82c
......@@ -46,6 +46,15 @@ uint32_t compel_fpu_feature_size(unsigned int feature)
return 0;
}
uint32_t compel_fpu_feature_offset(unsigned int feature)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
return 0;
}
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
......
......@@ -46,6 +46,15 @@ uint32_t compel_fpu_feature_size(unsigned int feature)
return 0;
}
uint32_t compel_fpu_feature_offset(unsigned int feature)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
return 0;
}
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
......
......@@ -60,6 +60,15 @@ uint32_t compel_fpu_feature_size(unsigned int feature)
return 0;
}
uint32_t compel_fpu_feature_offset(unsigned int feature)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
return 0;
}
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
......
......@@ -51,6 +51,15 @@ bool compel_fpu_has_feature(unsigned int feature)
return compel_test_fpu_cap(&rt_info, feature);
}
uint32_t compel_fpu_feature_offset(unsigned int feature)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
return 0;
}
uint32_t compel_fpu_feature_size(unsigned int feature)
{
if (!rt_info_done) {
......
......@@ -466,6 +466,18 @@ uint32_t compel_fpu_feature_size(unsigned int feature)
return 0;
}
uint32_t compel_fpu_feature_offset(unsigned int feature)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
if (feature >= FIRST_EXTENDED_XFEATURE &&
feature < XFEATURE_MAX)
return rt_info.xstate_offsets[feature];
return 0;
}
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
......
......@@ -10,6 +10,7 @@ extern int compel_cpuid(compel_cpuinfo_t *info);
extern bool compel_cpu_has_feature(unsigned int feature);
extern bool compel_fpu_has_feature(unsigned int feature);
extern uint32_t compel_fpu_feature_size(unsigned int feature);
extern uint32_t compel_fpu_feature_offset(unsigned int feature);
extern void compel_cpu_clear_feature(unsigned int feature);
extern void compel_cpu_copy_cpuinfo(compel_cpuinfo_t *c);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment