mirror of
https://github.com/justinian/jsix.git
synced 2025-12-09 16:04:32 -08:00
[libcpu] Add CPU_FEATURE_WRN
The new CPU_FEATURE_WRN macro in the cpu features list will cause the kernel to emit a warning but not panic if the feature is missing.
This commit is contained in:
@@ -83,6 +83,7 @@ check_cpu_supported()
|
|||||||
bool supported = true;
|
bool supported = true;
|
||||||
|
|
||||||
#define CPU_FEATURE_OPT(...)
|
#define CPU_FEATURE_OPT(...)
|
||||||
|
#define CPU_FEATURE_WRN(...)
|
||||||
#define CPU_FEATURE_REQ(name, ...) \
|
#define CPU_FEATURE_REQ(name, ...) \
|
||||||
if (!features[cpu::feature::name]) { \
|
if (!features[cpu::feature::name]) { \
|
||||||
status::fail(L"CPU required feature " L ## #name, uefi::status::unsupported); \
|
status::fail(L"CPU required feature " L ## #name, uefi::status::unsupported); \
|
||||||
|
|||||||
@@ -54,6 +54,10 @@ cpu_validate(cpu_data *c)
|
|||||||
#define CPU_FEATURE_OPT(name, ...) \
|
#define CPU_FEATURE_OPT(name, ...) \
|
||||||
log::verbose(logs::boot, " Flag %11s: %s", #name, features[cpu::feature::name] ? "yes" : "no");
|
log::verbose(logs::boot, " Flag %11s: %s", #name, features[cpu::feature::name] ? "yes" : "no");
|
||||||
|
|
||||||
|
#define CPU_FEATURE_WRN(name, feat_leaf, feat_sub, regname, bit) \
|
||||||
|
log::verbose(logs::boot, " Flag %11s: %s", #name, features[cpu::feature::name] ? "yes" : "no"); \
|
||||||
|
if (!features[cpu::feature::name]) log::warn(logs::boot, "Missing cpu feature %s but continuing", #name);
|
||||||
|
|
||||||
#define CPU_FEATURE_REQ(name, feat_leaf, feat_sub, regname, bit) \
|
#define CPU_FEATURE_REQ(name, feat_leaf, feat_sub, regname, bit) \
|
||||||
log::verbose(logs::boot, " Flag %11s: %s", #name, features[cpu::feature::name] ? "yes" : "no"); \
|
log::verbose(logs::boot, " Flag %11s: %s", #name, features[cpu::feature::name] ? "yes" : "no"); \
|
||||||
kassert(features[cpu::feature::name], "Missing required CPU feature " #name );
|
kassert(features[cpu::feature::name], "Missing required CPU feature " #name );
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ namespace cpu {
|
|||||||
enum class feature {
|
enum class feature {
|
||||||
#define CPU_FEATURE_REQ(name, ...) name,
|
#define CPU_FEATURE_REQ(name, ...) name,
|
||||||
#define CPU_FEATURE_OPT(name, ...) name,
|
#define CPU_FEATURE_OPT(name, ...) name,
|
||||||
|
#define CPU_FEATURE_WRN(name, ...) name,
|
||||||
#include "cpu/features.inc"
|
#include "cpu/features.inc"
|
||||||
|
#undef CPU_FEATURE_WRN
|
||||||
#undef CPU_FEATURE_OPT
|
#undef CPU_FEATURE_OPT
|
||||||
#undef CPU_FEATURE_REQ
|
#undef CPU_FEATURE_REQ
|
||||||
max
|
max
|
||||||
|
|||||||
@@ -33,6 +33,6 @@ CPU_FEATURE_OPT(rdtscp, 0x80000001, 0, edx, 27)
|
|||||||
CPU_FEATURE_REQ(syscall, 0x80000001, 0, edx, 11)
|
CPU_FEATURE_REQ(syscall, 0x80000001, 0, edx, 11)
|
||||||
CPU_FEATURE_REQ(pdpe1gb, 0x80000001, 0, edx, 26)
|
CPU_FEATURE_REQ(pdpe1gb, 0x80000001, 0, edx, 26)
|
||||||
|
|
||||||
CPU_FEATURE_OPT(invtsc, 0x80000007, 0, edx, 8)
|
CPU_FEATURE_WRN(invtsc, 0x80000007, 0, edx, 8)
|
||||||
|
|
||||||
// vim: et
|
// vim: et
|
||||||
|
|||||||
@@ -49,12 +49,16 @@ cpu_id::features() const
|
|||||||
if (r.regname & (1ull << bit)) \
|
if (r.regname & (1ull << bit)) \
|
||||||
feats.set(feature::name);
|
feats.set(feature::name);
|
||||||
|
|
||||||
|
#define CPU_FEATURE_WRN(name, feat_leaf, feat_sub, regname, bit) \
|
||||||
|
CPU_FEATURE_OPT(name, feat_leaf, feat_sub, regname, bit);
|
||||||
|
|
||||||
#define CPU_FEATURE_REQ(name, feat_leaf, feat_sub, regname, bit) \
|
#define CPU_FEATURE_REQ(name, feat_leaf, feat_sub, regname, bit) \
|
||||||
CPU_FEATURE_OPT(name, feat_leaf, feat_sub, regname, bit);
|
CPU_FEATURE_OPT(name, feat_leaf, feat_sub, regname, bit);
|
||||||
|
|
||||||
#include "cpu/features.inc"
|
#include "cpu/features.inc"
|
||||||
#undef CPU_FEATURE_OPT
|
#undef CPU_FEATURE_OPT
|
||||||
#undef CPU_FEATURE_REQ
|
#undef CPU_FEATURE_REQ
|
||||||
|
#undef CPU_FEATURE_WRN
|
||||||
|
|
||||||
return feats;
|
return feats;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user