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

@@ -15,14 +15,14 @@
*/
#include <stratosphere.hpp>
namespace sts::sf::hipc {
namespace ams::sf::hipc {
namespace {
NX_INLINE Result ReceiveImpl(Handle session_handle, void *message_buf, size_t message_buf_size) {
s32 unused_index;
if (message_buf == armGetTls()) {
/* Consider: STS_ASSERT(message_buf_size == TlsMessageBufferSize); */
/* Consider: AMS_ASSERT(message_buf_size == TlsMessageBufferSize); */
return svcReplyAndReceive(&unused_index, &session_handle, 1, INVALID_HANDLE, U64_MAX);
} else {
return svcReplyAndReceiveWithUserBuffer(&unused_index, message_buf, message_buf_size, &session_handle, 1, INVALID_HANDLE, U64_MAX);
@@ -32,7 +32,7 @@ namespace sts::sf::hipc {
NX_INLINE Result ReplyImpl(Handle session_handle, void *message_buf, size_t message_buf_size) {
s32 unused_index;
if (message_buf == armGetTls()) {
/* Consider: STS_ASSERT(message_buf_size == TlsMessageBufferSize); */
/* Consider: AMS_ASSERT(message_buf_size == TlsMessageBufferSize); */
return svcReplyAndReceive(&unused_index, &session_handle, 0, session_handle, 0);
} else {
return svcReplyAndReceiveWithUserBuffer(&unused_index, message_buf, message_buf_size, &session_handle, 0, session_handle, 0);
@@ -73,7 +73,7 @@ namespace sts::sf::hipc {
R_CONVERT(svc::ResultSessionClosed, ResultSuccess())
} R_END_TRY_CATCH;
/* ReplyImpl should *always* return an error. */
STS_ASSERT(false);
AMS_ASSERT(false);
}
Result CreateSession(Handle *out_server_handle, Handle *out_client_handle) {

View File

@@ -15,7 +15,7 @@
*/
#include <stratosphere.hpp>
namespace sts::sf::hipc {
namespace ams::sf::hipc {
namespace impl {
@@ -71,7 +71,7 @@ namespace sts::sf::hipc {
if (this->is_mitm_session) {
/* If we're a mitm session, we need to convert the remote session to domain. */
STS_ASSERT(session->forward_service->own_handle);
AMS_ASSERT(session->forward_service->own_handle);
R_TRY(serviceConvertToDomain(session->forward_service.get()));
/* The object ID reservation cannot fail here, as that would cause desynchronization from target domain. */
@@ -94,8 +94,8 @@ namespace sts::sf::hipc {
})));
}
STS_ASSERT(object_id != cmif::InvalidDomainObjectId);
STS_ASSERT(static_cast<bool>(new_holder));
AMS_ASSERT(object_id != cmif::InvalidDomainObjectId);
AMS_ASSERT(static_cast<bool>(new_holder));
/* We succeeded! */
domain_guard.Cancel();

View File

@@ -15,7 +15,7 @@
*/
#include <stratosphere.hpp>
namespace sts::sf::hipc {
namespace ams::sf::hipc {
ServerManagerBase::ServerBase::~ServerBase() { /* Pure virtual destructor, to prevent linker errors. */ }
@@ -65,14 +65,14 @@ namespace sts::sf::hipc {
void ServerManagerBase::AddUserWaitableHolder(os::WaitableHolder *waitable) {
const auto user_data_tag = static_cast<UserDataTag>(waitable->GetUserData());
STS_ASSERT(user_data_tag != UserDataTag::Server);
STS_ASSERT(user_data_tag != UserDataTag::MitmServer);
STS_ASSERT(user_data_tag != UserDataTag::Session);
AMS_ASSERT(user_data_tag != UserDataTag::Server);
AMS_ASSERT(user_data_tag != UserDataTag::MitmServer);
AMS_ASSERT(user_data_tag != UserDataTag::Session);
this->RegisterToWaitList(waitable);
}
Result ServerManagerBase::ProcessForServer(os::WaitableHolder *holder) {
STS_ASSERT(static_cast<UserDataTag>(holder->GetUserData()) == UserDataTag::Server);
AMS_ASSERT(static_cast<UserDataTag>(holder->GetUserData()) == UserDataTag::Server);
ServerBase *server = static_cast<ServerBase *>(holder);
ON_SCOPE_EXIT { this->RegisterToWaitList(server); };
@@ -83,14 +83,14 @@ namespace sts::sf::hipc {
server->CreateSessionObjectHolder(&obj, &fsrv);
/* Not a mitm server, so we must have no forward service. */
STS_ASSERT(fsrv == nullptr);
AMS_ASSERT(fsrv == nullptr);
/* Try to accept. */
return this->AcceptSession(server->port_handle, std::move(obj));
}
Result ServerManagerBase::ProcessForMitmServer(os::WaitableHolder *holder) {
STS_ASSERT(static_cast<UserDataTag>(holder->GetUserData()) == UserDataTag::MitmServer);
AMS_ASSERT(static_cast<UserDataTag>(holder->GetUserData()) == UserDataTag::MitmServer);
ServerBase *server = static_cast<ServerBase *>(holder);
ON_SCOPE_EXIT { this->RegisterToWaitList(server); };
@@ -101,20 +101,20 @@ namespace sts::sf::hipc {
server->CreateSessionObjectHolder(&obj, &fsrv);
/* Mitm server, so we must have forward service. */
STS_ASSERT(fsrv != nullptr);
AMS_ASSERT(fsrv != nullptr);
/* Try to accept. */
return this->AcceptMitmSession(server->port_handle, std::move(obj), std::move(fsrv));
}
Result ServerManagerBase::ProcessForSession(os::WaitableHolder *holder) {
STS_ASSERT(static_cast<UserDataTag>(holder->GetUserData()) == UserDataTag::Session);
AMS_ASSERT(static_cast<UserDataTag>(holder->GetUserData()) == UserDataTag::Session);
ServerSession *session = static_cast<ServerSession *>(holder);
cmif::PointerAndSize tls_message(armGetTls(), hipc::TlsMessageBufferSize);
const cmif::PointerAndSize &saved_message = session->saved_message;
STS_ASSERT(tls_message.GetSize() == saved_message.GetSize());
AMS_ASSERT(tls_message.GetSize() == saved_message.GetSize());
if (!session->has_received) {
R_TRY(this->ReceiveRequest(session, tls_message));
session->has_received = true;
@@ -180,7 +180,7 @@ namespace sts::sf::hipc {
this->ProcessDeferredSessions();
return ResultSuccess();
break;
STS_UNREACHABLE_DEFAULT_CASE();
AMS_UNREACHABLE_DEFAULT_CASE();
}
}

View File

@@ -15,7 +15,7 @@
*/
#include <stratosphere.hpp>
namespace sts::sf::hipc {
namespace ams::sf::hipc {
namespace {
@@ -40,10 +40,10 @@ namespace sts::sf::hipc {
}
Result ServerSession::ForwardRequest(const cmif::ServiceDispatchContext &ctx) const {
STS_ASSERT(this->IsMitmSession());
AMS_ASSERT(this->IsMitmSession());
/* TODO: Support non-TLS messages? */
STS_ASSERT(this->saved_message.GetPointer() != nullptr);
STS_ASSERT(this->saved_message.GetSize() == TlsMessageBufferSize);
AMS_ASSERT(this->saved_message.GetPointer() != nullptr);
AMS_ASSERT(this->saved_message.GetSize() == TlsMessageBufferSize);
/* Copy saved TLS in. */
std::memcpy(armGetTls(), this->saved_message.GetPointer(), this->saved_message.GetSize());
@@ -115,7 +115,7 @@ namespace sts::sf::hipc {
session_memory->pointer_buffer = this->GetSessionPointerBuffer(session_memory);
session_memory->saved_message = this->GetSessionSavedMessageBuffer(session_memory);
/* Validate session pointer buffer. */
STS_ASSERT(session_memory->pointer_buffer.GetSize() >= session_memory->forward_service->pointer_buffer_size);
AMS_ASSERT(session_memory->pointer_buffer.GetSize() >= session_memory->forward_service->pointer_buffer_size);
session_memory->pointer_buffer = cmif::PointerAndSize(session_memory->pointer_buffer.GetAddress(), session_memory->forward_service->pointer_buffer_size);
/* Register to wait list. */
this->RegisterSessionToWaitList(session_memory);
@@ -188,7 +188,7 @@ namespace sts::sf::hipc {
return ResultSuccess();
case hipc::ReceiveResult::NeedsRetry:
continue;
STS_UNREACHABLE_DEFAULT_CASE();
AMS_UNREACHABLE_DEFAULT_CASE();
}
}
}