namespace sts -> namespace ams

namespace sts::ams -> ams::exosphere, ams::.

This is to facilitate future use of ams:: namespace code in
mesosphere, as we'll want to include ams::util, ams::result, ams::svc...
This commit is contained in:
Michael Scire
2019-10-24 02:30:10 -07:00
committed by SciresM
parent 4059dc6187
commit 8cb77ac136
397 changed files with 968 additions and 926 deletions

View File

@@ -17,7 +17,7 @@
#include <stratosphere.hpp>
#include "ams_bpc.h"
namespace sts::ams {
namespace ams {
namespace {
@@ -34,7 +34,7 @@ namespace sts::ams {
}
extern ncm::TitleId StratosphereTitleId;
extern ncm::TitleId CurrentTitleId;
void WEAK ExceptionHandler(FatalErrorContext *ctx) {
R_ASSERT(amsBpcInitialize());
@@ -49,7 +49,7 @@ namespace sts::ams {
{
ams_ctx.magic = FatalErrorContext::Magic;
ams_ctx.error_desc = ctx->error_desc;
ams_ctx.title_id = static_cast<u64>(StratosphereTitleId);
ams_ctx.title_id = static_cast<u64>(CurrentTitleId);
for (size_t i = 0; i < FatalErrorContext::NumGprs; i++) {
ams_ctx.gprs[i] = ctx->cpu_gprs[i].x;
}
@@ -122,7 +122,7 @@ namespace sts::ams {
}
/* Just call the user exception handler. */
::sts::ams::ExceptionHandler(&ams_ctx);
::ams::ExceptionHandler(&ams_ctx);
}
inline NORETURN void AbortImpl() {
@@ -160,7 +160,7 @@ extern "C" {
/* Custom abort handler, so that std::abort will trigger these. */
void abort() {
sts::ams::AbortImpl();
ams::AbortImpl();
}
void *__cxa_allocate_ecxeption(size_t thrown_size) {

View File

@@ -18,12 +18,12 @@
#include <stratosphere/spl.hpp>
#include <stratosphere/spl/smc/spl_smc.hpp>
namespace sts::ams {
namespace ams::exosphere {
ApiInfo GetApiInfo() {
u64 exosphere_cfg;
if (spl::smc::GetConfig(&exosphere_cfg, 1, SplConfigItem_ExosphereApiVersion) != spl::smc::Result::Success) {
R_ASSERT(ResultExosphereNotPresent());
R_ASSERT(ResultNotPresent());
}
return ApiInfo{

View File

@@ -1,141 +0,0 @@
/*
* Copyright (c) 2018-2019 Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
namespace sts::hos {
namespace {
hos::Version g_hos_version;
bool g_has_cached;
os::Mutex g_mutex;
void CacheValues() {
if (__atomic_load_n(&g_has_cached, __ATOMIC_SEQ_CST)) {
return;
}
std::scoped_lock lk(g_mutex);
if (g_has_cached) {
return;
}
switch (ams::GetApiInfo().GetTargetFirmware()) {
case ams::TargetFirmware_100:
g_hos_version = hos::Version_100;
break;
case ams::TargetFirmware_200:
g_hos_version = hos::Version_200;
break;
case ams::TargetFirmware_300:
g_hos_version = hos::Version_300;
break;
case ams::TargetFirmware_400:
g_hos_version = hos::Version_400;
break;
case ams::TargetFirmware_500:
g_hos_version = hos::Version_500;
break;
case ams::TargetFirmware_600:
case ams::TargetFirmware_620:
g_hos_version = hos::Version_600;
break;
case ams::TargetFirmware_700:
g_hos_version = hos::Version_700;
break;
case ams::TargetFirmware_800:
g_hos_version = hos::Version_800;
break;
case ams::TargetFirmware_810:
g_hos_version = hos::Version_810;
break;
case ams::TargetFirmware_900:
g_hos_version = hos::Version_900;
break;
STS_UNREACHABLE_DEFAULT_CASE();
}
__atomic_store_n(&g_has_cached, true, __ATOMIC_SEQ_CST);
}
}
::sts::hos::Version GetVersion() {
CacheValues();
return g_hos_version;
}
void SetVersionForLibnx() {
u32 major = 0, minor = 0, micro = 0;
switch (hos::GetVersion()) {
case hos::Version_100:
major = 1;
minor = 0;
micro = 0;
break;
case hos::Version_200:
major = 2;
minor = 0;
micro = 0;
break;
case hos::Version_300:
major = 3;
minor = 0;
micro = 0;
break;
case hos::Version_400:
major = 4;
minor = 0;
micro = 0;
break;
case hos::Version_500:
major = 5;
minor = 0;
micro = 0;
break;
case hos::Version_600:
major = 6;
minor = 0;
micro = 0;
break;
case hos::Version_700:
major = 7;
minor = 0;
micro = 0;
break;
case hos::Version_800:
major = 8;
minor = 0;
micro = 0;
break;
case hos::Version_810:
major = 8;
minor = 1;
micro = 0;
break;
case hos::Version_900:
major = 9;
minor = 0;
micro = 0;
break;
STS_UNREACHABLE_DEFAULT_CASE();
}
hosversionSet(MAKEHOSVERSION(major, minor, micro));
}
}