kern: invert meaning of KTargetSystem/KSystemControl bools

This commit is contained in:
Michael Scire 2025-04-30 18:23:16 -07:00 committed by SciresM
parent d147f6f93b
commit 66fcf33a2c
4 changed files with 41 additions and 41 deletions

View file

@ -25,35 +25,35 @@ namespace ams::kern {
friend class KSystemControl;
private:
struct KTargetSystemData {
bool is_debug_mode;
bool enable_debug_logging;
bool enable_user_exception_handlers;
bool enable_debug_memory_fill;
bool enable_user_pmu_access;
bool enable_kernel_debugging;
bool enable_dynamic_resource_limits;
bool is_not_debug_mode;
bool disable_debug_logging;
bool disable_user_exception_handlers;
bool disable_debug_memory_fill;
bool disable_user_pmu_access;
bool disable_kernel_debugging;
bool disable_dynamic_resource_limits;
};
private:
static inline constinit bool s_is_initialized = false;
static inline constinit bool s_is_uninitialized = true;
static inline constinit const volatile KTargetSystemData s_data = {
.is_debug_mode = true,
.enable_debug_logging = true,
.enable_user_exception_handlers = true,
.enable_debug_memory_fill = true,
.enable_user_pmu_access = true,
.enable_kernel_debugging = true,
.enable_dynamic_resource_limits = false,
.is_not_debug_mode = false,
.disable_debug_logging = false,
.disable_user_exception_handlers = false,
.disable_debug_memory_fill = false,
.disable_user_pmu_access = false,
.disable_kernel_debugging = false,
.disable_dynamic_resource_limits = true,
};
private:
static ALWAYS_INLINE void SetInitialized() { s_is_initialized = true; }
static ALWAYS_INLINE void SetInitialized() { s_is_uninitialized = false; }
public:
static ALWAYS_INLINE bool IsDebugMode() { return s_is_initialized && s_data.is_debug_mode; }
static ALWAYS_INLINE bool IsDebugLoggingEnabled() { return s_is_initialized && s_data.enable_debug_logging; }
static ALWAYS_INLINE bool IsUserExceptionHandlersEnabled() { return s_is_initialized && s_data.enable_user_exception_handlers; }
static ALWAYS_INLINE bool IsDebugMemoryFillEnabled() { return s_is_initialized && s_data.enable_debug_memory_fill; }
static ALWAYS_INLINE bool IsUserPmuAccessEnabled() { return s_is_initialized && s_data.enable_user_pmu_access; }
static ALWAYS_INLINE bool IsKernelDebuggingEnabled() { return s_is_initialized && s_data.enable_kernel_debugging; }
static ALWAYS_INLINE bool IsDynamicResourceLimitsEnabled() { return s_is_initialized && s_data.enable_dynamic_resource_limits; }
static ALWAYS_INLINE bool IsDebugMode() { return !(s_is_uninitialized | s_data.is_not_debug_mode); }
static ALWAYS_INLINE bool IsDebugLoggingEnabled() { return !(s_is_uninitialized | s_data.disable_debug_logging); }
static ALWAYS_INLINE bool IsUserExceptionHandlersEnabled() { return !(s_is_uninitialized | s_data.disable_user_exception_handlers); }
static ALWAYS_INLINE bool IsDebugMemoryFillEnabled() { return !(s_is_uninitialized | s_data.disable_debug_memory_fill); }
static ALWAYS_INLINE bool IsUserPmuAccessEnabled() { return !(s_is_uninitialized | s_data.disable_user_pmu_access); }
static ALWAYS_INLINE bool IsKernelDebuggingEnabled() { return !(s_is_uninitialized | s_data.disable_kernel_debugging); }
static ALWAYS_INLINE bool IsDynamicResourceLimitsEnabled() { return !(s_is_uninitialized | s_data.disable_dynamic_resource_limits); }
};
}