2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 21:38:16 +00:00

compel: fpu -- Add compel_fpu_feature_size

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Cyrill Gorcunov 2018-07-19 15:47:36 +03:00 committed by Andrei Vagin
parent 5014812df9
commit d25af82cc0
6 changed files with 50 additions and 0 deletions

View File

@ -37,6 +37,15 @@ bool compel_fpu_has_feature(unsigned int feature)
return compel_test_fpu_cap(&rt_info, feature);
}
uint32_t compel_fpu_feature_size(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) {

View File

@ -37,6 +37,15 @@ bool compel_fpu_has_feature(unsigned int feature)
return compel_test_fpu_cap(&rt_info, feature);
}
uint32_t compel_fpu_feature_size(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) {

View File

@ -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_size(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) {

View File

@ -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_size(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) {

View File

@ -454,6 +454,18 @@ bool compel_fpu_has_feature(unsigned int feature)
return compel_test_fpu_cap(&rt_info, feature);
}
uint32_t compel_fpu_feature_size(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_sizes[feature];
return 0;
}
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {

View File

@ -2,12 +2,14 @@
#define UAPI_COMPEL_CPU_H__
#include <stdbool.h>
#include <stdint.h>
#include <compel/asm/cpu.h>
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 void compel_cpu_clear_feature(unsigned int feature);
extern void compel_cpu_copy_cpuinfo(compel_cpuinfo_t *c);