mirror of
https://github.com/Atmosphere-NX/Atmosphere-libs.git
synced 2025-06-30 23:12:13 +02:00
vers: use svcCallSecMon instead of spl
This commit is contained in:
parent
37c41f6324
commit
31c1dc1a82
@ -61,6 +61,25 @@ static inline void CopyFromIram(void *dst_addr, uintptr_t iram_addr, size_t size
|
||||
svcCallSecureMonitor(&args);
|
||||
}
|
||||
|
||||
static inline Result SmcGetConfig(SplConfigItem config_item, u64 *out_config) {
|
||||
SecmonArgs args = {0};
|
||||
args.X[0] = 0xC3000002; /* smcGetConfig */
|
||||
args.X[1] = (u64)config_item; /* config item */
|
||||
|
||||
Result rc = svcCallSecureMonitor(&args);
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
if (args.X[0] == 0) {
|
||||
if (out_config) {
|
||||
*out_config = args.X[1];
|
||||
}
|
||||
} else {
|
||||
/* SPL result n = SMC result n */
|
||||
rc = MAKERESULT(26, args.X[0]);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static inline bool IsApplicationTid(u64 title_id) {
|
||||
constexpr u64 application_tid_min = 0x0100000000010000ul;
|
||||
constexpr u64 application_tid_max = 0x01FFFFFFFFFFFFFFul;
|
||||
|
@ -18,13 +18,9 @@
|
||||
#include <switch.h>
|
||||
|
||||
static inline void GetAtmosphereApiVersion(u32 *major, u32 *minor, u32 *micro, u32 *target_fw, u32 *mkey_rev) {
|
||||
if (R_FAILED(splInitialize())) {
|
||||
fatalSimple(0xCAFE << 4 | 0xD);
|
||||
}
|
||||
|
||||
/* Check for exosphere API compatibility. */
|
||||
u64 exosphere_cfg;
|
||||
if (R_FAILED(splGetConfig((SplConfigItem)65000, &exosphere_cfg))) {
|
||||
if (R_FAILED(SmcGetConfig((SplConfigItem)65000, &exosphere_cfg))) {
|
||||
fatalSimple(0xCAFE << 4 | 0xE);
|
||||
}
|
||||
|
||||
@ -47,8 +43,6 @@ static inline void GetAtmosphereApiVersion(u32 *major, u32 *minor, u32 *micro, u
|
||||
if (major) {
|
||||
*major = (u32)((exosphere_cfg >> 0x20) & 0xFF);
|
||||
}
|
||||
|
||||
splExit();
|
||||
}
|
||||
|
||||
static inline u32 MakeAtmosphereVersion(u32 major, u32 minor, u32 micro) {
|
||||
|
Loading…
Reference in New Issue
Block a user