2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

compel: cpu -- Add ability to clear features

Will need them to mask some of the features from
command line options.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
Cyrill Gorcunov
2018-06-14 20:27:27 +03:00
committed by Andrei Vagin
parent f25f91e5e8
commit 18be1a83a9
6 changed files with 92 additions and 0 deletions

View File

@@ -26,3 +26,21 @@ bool compel_cpu_has_feature(unsigned int feature)
}
return compel_test_cpu_cap(&rt_info, feature);
}
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
return compel_clear_cpu_cap(&rt_info, feature);
}
void compel_cpu_copy_cpuinfo(compel_cpuinfo_t *c)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
memcpy(c, &rt_info, sizeof(rt_info));
}

View File

@@ -26,3 +26,21 @@ bool compel_cpu_has_feature(unsigned int feature)
}
return compel_test_cpu_cap(&rt_info, feature);
}
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
return compel_clear_cpu_cap(&rt_info, feature);
}
void compel_cpu_copy_cpuinfo(compel_cpuinfo_t *c)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
memcpy(c, &rt_info, sizeof(rt_info));
}

View File

@@ -40,3 +40,21 @@ bool compel_cpu_has_feature(unsigned int feature)
}
return compel_test_cpu_cap(&rt_info, feature);
}
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
return compel_clear_cpu_cap(&rt_info, feature);
}
void compel_cpu_copy_cpuinfo(compel_cpuinfo_t *c)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
memcpy(c, &rt_info, sizeof(rt_info));
}

View File

@@ -40,3 +40,21 @@ bool cpu_has_feature(unsigned int feature)
}
return compel_test_cpu_cap(&rt_info, feature);
}
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
return compel_clear_cpu_cap(&rt_info, feature);
}
void compel_cpu_copy_cpuinfo(compel_cpuinfo_t *c)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
memcpy(c, &rt_info, sizeof(rt_info));
}

View File

@@ -233,3 +233,21 @@ bool compel_cpu_has_feature(unsigned int feature)
}
return compel_test_cpu_cap(&rt_info, feature);
}
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
return compel_clear_cpu_cap(&rt_info, feature);
}
void compel_cpu_copy_cpuinfo(compel_cpuinfo_t *c)
{
if (!rt_info_done) {
compel_cpuid(&rt_info);
rt_info_done = true;
}
memcpy(c, &rt_info, sizeof(rt_info));
}

View File

@@ -7,5 +7,7 @@
extern int compel_cpuid(compel_cpuinfo_t *info);
extern bool compel_cpu_has_feature(unsigned int feature);
extern void compel_cpu_clear_feature(unsigned int feature);
extern void compel_cpu_copy_cpuinfo(compel_cpuinfo_t *c);
#endif /* UAPI_COMPEL_CPU_H__ */