strat: build sysmodules with -Wextra/-Werror

This commit is contained in:
Michael Scire 2021-10-06 23:22:54 -07:00
parent e8f1efd01b
commit 6a53726833
61 changed files with 433 additions and 217 deletions

View file

@ -16,7 +16,7 @@ include $(DEVKITPRO)/libnx/switch_rules
# options for code generation
#---------------------------------------------------------------------------------
export DEFINES = $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_STRATOSPHERE -D_GNU_SOURCE
export SETTINGS = $(ATMOSPHERE_SETTINGS) -O2
export SETTINGS = $(ATMOSPHERE_SETTINGS) -O2 -Wextra -Werror -Wno-missing-field-initializers
export CFLAGS = $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
export CXXFLAGS = $(CFLAGS) $(ATMOSPHERE_CXXFLAGS)
export ASFLAGS = $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES)

View file

@ -132,7 +132,7 @@ namespace ams::fs::impl {
/* Access log invocation lambdas. */
#define AMS_FS_IMPL_ACCESS_LOG_IMPL(__EXPR__, __HANDLE__, __ENABLED__, __NAME__, ...) \
[&](const char *name) { \
[&](const char *name) -> Result { \
if (!(__ENABLED__)) { \
return (__EXPR__); \
} else { \
@ -145,7 +145,7 @@ namespace ams::fs::impl {
}(__NAME__)
#define AMS_FS_IMPL_ACCESS_LOG_WITH_PRIORITY_IMPL(__EXPR__, __PRIORITY__, __HANDLE__, __ENABLED__, __NAME__, ...) \
[&](const char *name) { \
[&](const char *name) -> Result { \
if (!(__ENABLED__)) { \
return (__EXPR__); \
} else { \
@ -158,7 +158,7 @@ namespace ams::fs::impl {
}(__NAME__)
#define AMS_FS_IMPL_ACCESS_LOG_EXPLICIT_IMPL(__RESULT__, __START__, __END__, __HANDLE__, __ENABLED__, __NAME__, ...) \
[&](const char *name) { \
[&](const char *name) -> Result { \
if (!(__ENABLED__)) { \
return __RESULT__; \
} else { \
@ -169,7 +169,7 @@ namespace ams::fs::impl {
}(__NAME__)
#define AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED_IMPL(__EXPR__, __ENABLED__, __NAME__, ...) \
[&](const char *name) { \
[&](const char *name) -> Result { \
if (!(__ENABLED__)) { \
return (__EXPR__); \
} else { \

View file

@ -244,22 +244,22 @@ namespace ams::fs {
namespace {
Result CommitImpl(const char *path, const char *func_name) {
impl::FileSystemAccessor *accessor;
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::Find(std::addressof(accessor), path), AMS_FS_IMPL_ACCESS_LOG_FORMAT_PATH, path));
Result CommitImpl(const char *mount_name, const char *func_name) {
impl::FileSystemAccessor *accessor{};
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_UNLESS_R_SUCCEEDED(impl::Find(std::addressof(accessor), mount_name), AMS_FS_IMPL_ACCESS_LOG_FORMAT_MOUNT, mount_name));
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM_WITH_NAME(accessor->Commit(), nullptr, accessor, func_name, AMS_FS_IMPL_ACCESS_LOG_FORMAT_MOUNT, path));
AMS_FS_R_TRY(AMS_FS_IMPL_ACCESS_LOG_FILESYSTEM_WITH_NAME(accessor->Commit(), nullptr, accessor, func_name, AMS_FS_IMPL_ACCESS_LOG_FORMAT_MOUNT, mount_name));
return ResultSuccess();
}
}
Result Commit(const char *path) {
return CommitImpl(path, AMS_CURRENT_FUNCTION_NAME);
Result Commit(const char *mount_name) {
return CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME);
}
Result CommitSaveData(const char *path) {
return CommitImpl(path, AMS_CURRENT_FUNCTION_NAME);
Result CommitSaveData(const char *mount_name) {
return CommitImpl(mount_name, AMS_CURRENT_FUNCTION_NAME);
}
}

View file

@ -31,7 +31,7 @@ namespace ams::fs::impl {
}
Result Find(FileSystemAccessor **out, const char *name) {
return g_mount_table.Find(out, name);
return g_mount_table.Find(out, name);
}
void Unregister(const char *name) {

View file

@ -31,7 +31,7 @@ namespace ams::htc::server {
Result HtcServiceObject::GetEnvironmentVariable(sf::Out<s32> out_size, const sf::OutBuffer &out, const sf::InBuffer &name) {
/* Get the variable. */
size_t var_size;
size_t var_size = std::numeric_limits<size_t>::max();
R_TRY(m_misc_impl.GetEnvironmentVariable(std::addressof(var_size), reinterpret_cast<char *>(out.GetPointer()), out.GetSize(), reinterpret_cast<const char *>(name.GetPointer()), name.GetSize()));
/* Check the output size. */
@ -44,7 +44,7 @@ namespace ams::htc::server {
Result HtcServiceObject::GetEnvironmentVariableLength(sf::Out<s32> out_size, const sf::InBuffer &name) {
/* Get the variable. */
size_t var_size;
size_t var_size = std::numeric_limits<size_t>::max();
R_TRY(m_misc_impl.GetEnvironmentVariableLength(std::addressof(var_size), reinterpret_cast<const char *>(name.GetPointer()), name.GetSize()));
/* Check the output size. */

View file

@ -94,8 +94,20 @@ namespace ams::htc::server::rpc {
Result ReceiveBody(char *dst, size_t size);
Result SendRequest(const char *src, size_t size);
private:
template<typename T, size_t... Ix> requires IsRpcTask<T>
ALWAYS_INLINE Result BeginImpl(std::index_sequence<Ix...>, u32 *out_task_id, RpcTaskArgumentType<T, Ix>... args) {
s32 GetTaskHandle(u32 task_id);
public:
void Wait(u32 task_id) {
os::WaitEvent(m_task_table.Get<Task>(task_id)->GetEvent());
}
os::NativeHandle DetachReadableHandle(u32 task_id) {
return os::DetachReadableHandleOfSystemEvent(m_task_table.Get<Task>(task_id)->GetSystemEvent());
}
void CancelBySocket(s32 handle);
template<typename T, typename... Args> requires (IsRpcTask<T> && sizeof...(Args) == std::tuple_size<RpcTaskArgumentsType<T>>::value)
Result Begin(u32 *out_task_id, Args &&... args) {
/* Lock ourselves. */
std::scoped_lock lk(m_mutex);
@ -117,7 +129,7 @@ namespace ams::htc::server::rpc {
};
/* Set the task arguments. */
R_TRY(task->SetArguments(args...));
R_TRY(task->SetArguments(std::forward<Args>(args)...));
/* Clear the task's events. */
os::ClearEvent(std::addressof(m_receive_buffer_available_events[task_id]));
@ -138,8 +150,8 @@ namespace ams::htc::server::rpc {
return ResultSuccess();
}
template<typename T, size_t... Ix> requires IsRpcTask<T>
ALWAYS_INLINE Result GetResultImpl(std::index_sequence<Ix...>, u32 task_id, RpcTaskResultType<T, Ix>... args) {
template<typename T, typename... Args> requires (IsRpcTask<T> && sizeof...(Args) == std::tuple_size<RpcTaskResultsType<T>>::value)
Result GetResult(u32 task_id, Args &&... args) {
/* Lock ourselves. */
std::scoped_lock lk(m_mutex);
@ -151,13 +163,13 @@ namespace ams::htc::server::rpc {
R_UNLESS(task->GetTaskState() == RpcTaskState::Completed, htc::ResultTaskNotCompleted());
/* Get the task's result. */
R_TRY(task->GetResult(args...));
R_TRY(task->GetResult(std::forward<Args>(args)...));
return ResultSuccess();
}
template<typename T, size_t... Ix> requires IsRpcTask<T>
ALWAYS_INLINE Result EndImpl(std::index_sequence<Ix...>, u32 task_id, RpcTaskResultType<T, Ix>... args) {
template<typename T, typename... Args> requires (IsRpcTask<T> && sizeof...(Args) == std::tuple_size<RpcTaskResultsType<T>>::value)
Result End(u32 task_id, Args &&... args) {
/* Lock ourselves. */
std::scoped_lock lk(m_mutex);
@ -188,38 +200,11 @@ namespace ams::htc::server::rpc {
}
/* Get the task's result. */
R_TRY(task->GetResult(args...));
R_TRY(task->GetResult(std::forward<Args>(args)...));
return ResultSuccess();
}
s32 GetTaskHandle(u32 task_id);
public:
void Wait(u32 task_id) {
os::WaitEvent(m_task_table.Get<Task>(task_id)->GetEvent());
}
os::NativeHandle DetachReadableHandle(u32 task_id) {
return os::DetachReadableHandleOfSystemEvent(m_task_table.Get<Task>(task_id)->GetSystemEvent());
}
void CancelBySocket(s32 handle);
template<typename T, typename... Args> requires (IsRpcTask<T> && sizeof...(Args) == std::tuple_size<RpcTaskArgumentsType<T>>::value)
Result Begin(u32 *out_task_id, Args &&... args) {
return this->BeginImpl<T>(std::make_index_sequence<std::tuple_size<RpcTaskArgumentsType<T>>::value>(), out_task_id, std::forward<Args>(args)...);
}
template<typename T, typename... Args> requires (IsRpcTask<T> && sizeof...(Args) == std::tuple_size<RpcTaskResultsType<T>>::value)
Result GetResult(u32 task_id, Args &&... args) {
return this->GetResultImpl<T>(std::make_index_sequence<std::tuple_size<RpcTaskResultsType<T>>::value>(), task_id, std::forward<Args>(args)...);
}
template<typename T, typename... Args> requires (IsRpcTask<T> && sizeof...(Args) == std::tuple_size<RpcTaskResultsType<T>>::value)
Result End(u32 task_id, Args &&... args) {
return this->EndImpl<T>(std::make_index_sequence<std::tuple_size<RpcTaskResultsType<T>>::value>(), task_id, std::forward<Args>(args)...);
}
template<typename T> requires IsRpcTask<T>
Result VerifyTaskIdWithHandle(u32 task_id, s32 handle) {
/* Lock ourselves. */

View file

@ -159,20 +159,22 @@ namespace ams::htcs::impl {
Result HtcsManagerImpl::StartSelect(u32 *out_task_id, os::NativeHandle *out_handle, Span<const int> read_handles, Span<const int> write_handles, Span<const int> exception_handles, s64 tv_sec, s64 tv_usec) {
/* Start the select. */
u32 task_id;
os::NativeHandle handle;
os::NativeHandle handle = os::InvalidNativeHandle;
const Result result = m_service.SelectStart(std::addressof(task_id), std::addressof(handle), read_handles, write_handles, exception_handles, tv_sec, tv_usec);
/* Ensure our state ends up clean. */
if (htcs::ResultCancelled::Includes(result)) {
os::SystemEventType event;
os::AttachReadableHandleToSystemEvent(std::addressof(event), handle, true, os::EventClearMode_ManualClear);
s32 err;
bool empty;
m_service.SelectEnd(std::addressof(err), std::addressof(empty), Span<int>{}, Span<int>{}, Span<int>{}, task_id);
os::DestroySystemEvent(std::addressof(event));
} else {
if (handle != os::InvalidNativeHandle) {
os::SystemEventType event;
os::AttachReadableHandleToSystemEvent(std::addressof(event), handle, true, os::EventClearMode_ManualClear);
os::DestroySystemEvent(std::addressof(event));
}
} else if (R_SUCCEEDED(result)) {
*out_task_id = task_id;
*out_handle = handle;
}

View file

@ -275,6 +275,7 @@ namespace ams::htcs::impl {
Result HtcsService::SendSmallResults(s32 *out_err, s64 *out_size, u32 task_id, s32 desc) {
AMS_UNUSED(desc);
/* Finish the task. */
htcs::SocketError err;
R_TRY(m_rpc_client->End<rpc::SendSmallTask>(task_id, std::addressof(err), out_size));
@ -387,13 +388,13 @@ namespace ams::htcs::impl {
u32 task_id;
R_TRY(m_rpc_client->Begin<rpc::SelectTask>(std::addressof(task_id), read_handles, write_handles, exception_handles, tv_sec, tv_usec));
/* Check that the task isn't cancelled. */
R_UNLESS(!m_rpc_client->IsCancelled<rpc::SelectTask>(task_id), htcs::ResultCancelled());
/* Detach the task. */
*out_task_id = task_id;
*out_handle = m_rpc_client->DetachReadableHandle(task_id);
/* Check that the task isn't cancelled. */
R_UNLESS(!m_rpc_client->IsCancelled<rpc::SelectTask>(task_id), htcs::ResultCancelled());
return ResultSuccess();
}

View file

@ -131,7 +131,7 @@ namespace ams::htcs::server {
auto *manager = impl::HtcsManagerHolder::GetHtcsManager();
/* Get the accept results. */
s32 desc;
s32 desc = -1;
manager->AcceptResults(out_err.GetPointer(), std::addressof(desc), out_address.GetPointer(), task_id, m_desc);
/* If an error occurred, we're done. */

View file

@ -36,10 +36,12 @@ namespace ams::i2c {
auto &header1 = cmd_list[this->current_index++];
/* Set the header. */
header0 = {};
header0.Set<impl::CommonCommandFormat::CommandId>(impl::CommandId_Receive);
header0.Set<impl::ReceiveCommandFormat::StopCondition>((option & TransactionOption_StopCondition) != 0);
header0.Set<impl::ReceiveCommandFormat::StartCondition>((option & TransactionOption_StartCondition) != 0);
header1 = {};
header1.Set<impl::ReceiveCommandFormat::Size>(size);
return ResultSuccess();
@ -58,10 +60,12 @@ namespace ams::i2c {
auto &header1 = cmd_list[this->current_index++];
/* Set the header. */
header0 = {};
header0.Set<impl::CommonCommandFormat::CommandId>(impl::CommandId_Send);
header0.Set<impl::SendCommandFormat::StopCondition>((option & TransactionOption_StopCondition) != 0);
header0.Set<impl::SendCommandFormat::StartCondition>((option & TransactionOption_StartCondition) != 0);
header1 = {};
header1.Set<impl::SendCommandFormat::Size>(size);
/* Copy the data we're sending. */
@ -84,9 +88,11 @@ namespace ams::i2c {
auto &header1 = cmd_list[this->current_index++];
/* Set the header. */
header0 = {};
header0.Set<impl::CommonCommandFormat::CommandId>(impl::CommandId_Extension);
header0.Set<impl::CommonCommandFormat::SubCommandId>(impl::SubCommandId_Sleep);
header1 = {};
header1.Set<impl::SleepCommandFormat::MicroSeconds>(us);
return ResultSuccess();

View file

@ -52,7 +52,7 @@ namespace ams::mem::impl::heap {
this->use_virtual_memory = false;
} else {
/* We were not provided with a region to use as backing. */
void *mem;
void *mem = nullptr;
if (auto err = AllocateVirtualMemory(std::addressof(mem), size); err != 0) {
return err;
}

View file

@ -85,33 +85,37 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *operator new(size_t size) {
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
@ -131,6 +135,8 @@ namespace ams::lm::srv {
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Check thread priority. */
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(LogManager, MainThread));

View file

@ -69,6 +69,8 @@ namespace ams::tio {
}
void DeallocateForFs(void *p, size_t size) {
AMS_UNUSED(size);
return lmem::FreeToExpHeap(g_fs_heap_handle, p);
}
@ -117,38 +119,44 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *operator new(size_t size) {
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Set thread name. */
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(TioServer, Main));
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(TioServer, Main));

View file

@ -145,7 +145,7 @@ namespace ams::mitm {
}
/* Initialization implementation */
void InitializeThreadFunc(void *arg) {
void InitializeThreadFunc(void *) {
/* Wait for the SD card to be ready. */
cfg::WaitSdCardInitialized();

View file

@ -104,18 +104,23 @@ void __appExit(void) {
}
void *__libnx_alloc(size_t size) {
AMS_UNUSED(size);
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
AMS_UNUSED(alignment, size);
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
AMS_UNUSED(mem);
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv) {
AMS_UNUSED(argc, argv);
/* Register "ams" port, use up its session. */
{
svc::Handle ams_port;

View file

@ -34,7 +34,7 @@ namespace ams::mitm::bpc_ams {
}
void MitmModule::ThreadFunction(void *arg) {
void MitmModule::ThreadFunction(void *) {
/* Create bpc:ams. */
{
os::NativeHandle bpcams_h;

View file

@ -56,7 +56,7 @@ namespace ams::mitm::bpc {
}
void MitmModule::ThreadFunction(void *arg) {
void MitmModule::ThreadFunction(void *) {
/* Wait until initialization is complete. */
mitm::WaitInitialized();

View file

@ -64,7 +64,7 @@ namespace ams::mitm::socket::resolver {
os::ThreadType g_extra_threads[NumExtraThreads];
void LoopServerThread(void *arg) {
void LoopServerThread(void *) {
/* Loop forever, servicing our services. */
g_server_manager.LoopProcess();
}
@ -114,7 +114,7 @@ namespace ams::mitm::socket::resolver {
}
void MitmModule::ThreadFunction(void *arg) {
void MitmModule::ThreadFunction(void *) {
/* Wait until initialization is complete. */
mitm::WaitInitialized();

View file

@ -40,6 +40,8 @@ namespace ams::mitm::socket::resolver {
}
ssize_t SerializeRedirectedAddrInfo(u8 * const dst, size_t dst_size, const char *hostname, ams::socket::InAddrT redirect_addr, u16 redirect_port, const struct addrinfo *hint) {
AMS_UNUSED(hostname);
struct addrinfo ai = {
.ai_flags = 0,
.ai_family = AF_UNSPEC,
@ -85,6 +87,8 @@ namespace ams::mitm::socket::resolver {
}
Result ResolverImpl::GetHostByNameRequest(u32 cancel_handle, const sf::ClientProcessId &client_pid, bool use_nsd_resolve, const sf::InBuffer &name, sf::Out<u32> out_host_error, sf::Out<u32> out_errno, const sf::OutBuffer &out_hostent, sf::Out<u32> out_size) {
AMS_UNUSED(cancel_handle, client_pid, use_nsd_resolve);
const char *hostname = reinterpret_cast<const char *>(name.GetPointer());
LogDebug("[%016lx]: GetHostByNameRequest(%s)\n", this->client_info.program_id.value, hostname);
@ -105,6 +109,8 @@ namespace ams::mitm::socket::resolver {
}
Result ResolverImpl::GetAddrInfoRequest(u32 cancel_handle, const sf::ClientProcessId &client_pid, bool use_nsd_resolve, const sf::InBuffer &node, const sf::InBuffer &srv, const sf::InBuffer &serialized_hint, const sf::OutBuffer &out_addrinfo, sf::Out<u32> out_errno, sf::Out<s32> out_retval, sf::Out<u32> out_size) {
AMS_UNUSED(cancel_handle, client_pid, use_nsd_resolve);
const char *hostname = reinterpret_cast<const char *>(node.GetPointer());
LogDebug("[%016lx]: GetAddrInfoRequest(%s, %s)\n", this->client_info.program_id.value, reinterpret_cast<const char *>(node.GetPointer()), reinterpret_cast<const char *>(srv.GetPointer()));
@ -142,6 +148,8 @@ namespace ams::mitm::socket::resolver {
}
Result ResolverImpl::GetHostByNameRequestWithOptions(const sf::ClientProcessId &client_pid, const sf::InAutoSelectBuffer &name, const sf::OutAutoSelectBuffer &out_hostent, sf::Out<u32> out_size, u32 options_version, const sf::InAutoSelectBuffer &options, u32 num_options, sf::Out<s32> out_host_error, sf::Out<s32> out_errno) {
AMS_UNUSED(client_pid, options_version, options, num_options);
const char *hostname = reinterpret_cast<const char *>(name.GetPointer());
LogDebug("[%016lx]: GetHostByNameRequestWithOptions(%s)\n", this->client_info.program_id.value, hostname);
@ -162,6 +170,8 @@ namespace ams::mitm::socket::resolver {
}
Result ResolverImpl::GetAddrInfoRequestWithOptions(const sf::ClientProcessId &client_pid, const sf::InBuffer &node, const sf::InBuffer &srv, const sf::InBuffer &serialized_hint, const sf::OutAutoSelectBuffer &out_addrinfo, sf::Out<u32> out_size, sf::Out<s32> out_retval, u32 options_version, const sf::InAutoSelectBuffer &options, u32 num_options, sf::Out<s32> out_host_error, sf::Out<s32> out_errno) {
AMS_UNUSED(client_pid, options_version, options, num_options);
const char *hostname = reinterpret_cast<const char *>(node.GetPointer());
LogDebug("[%016lx]: GetAddrInfoRequestWithOptions(%s, %s)\n", this->client_info.program_id.value, hostname, reinterpret_cast<const char *>(srv.GetPointer()));

View file

@ -35,6 +35,7 @@ namespace ams::mitm::socket::resolver {
/* We will mitm:
* - everything.
*/
AMS_UNUSED(client_info);
return true;
}
public:

View file

@ -20,6 +20,9 @@
namespace ams::mitm::socket::resolver::serializer {
ssize_t DNSSerializer::CheckToBufferArguments(const u8 *dst, size_t dst_size, size_t required, int error_id) {
/* TODO: Logging, using error_id */
AMS_UNUSED(error_id);
if (dst == nullptr) {
return -1;
} else if (dst_size < required) {

View file

@ -26,7 +26,7 @@ namespace ams::mitm::socket::resolver::serializer {
concept IsInAddr = std::same_as<T, ams::socket::InAddr> || std::same_as<T, struct in_addr>;
template<typename T> requires IsInAddr<T>
size_t SizeOfImpl(const T &in) {
size_t SizeOfImpl(const T &) {
return sizeof(u32);
}

View file

@ -99,7 +99,7 @@ namespace ams::mitm::fs {
return sf::CreateSharedObjectEmplaced<ams::fssrv::sf::IStorage, ams::fssrv::impl::StorageInterfaceAdapter>(std::forward<Arguments>(args)...);
}
Result OpenHblWebContentFileSystem(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> &out, ncm::ProgramId client_program_id, ncm::ProgramId program_id, FsFileSystemType filesystem_type) {
Result OpenHblWebContentFileSystem(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> &out, ncm::ProgramId program_id) {
/* Verify eligibility. */
bool is_hbl;
R_UNLESS(R_SUCCEEDED(pm::info::IsHblProgramId(&is_hbl, program_id)), sm::mitm::ResultShouldForwardToSession());
@ -122,7 +122,7 @@ namespace ams::mitm::fs {
return ResultSuccess();
}
Result OpenProgramSpecificWebContentFileSystem(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> &out, ncm::ProgramId client_program_id, ncm::ProgramId program_id, FsFileSystemType filesystem_type, Service *fwd, const fssrv::sf::Path *path, bool with_id) {
Result OpenProgramSpecificWebContentFileSystem(sf::Out<sf::SharedPointer<ams::fssrv::sf::IFileSystem>> &out, ncm::ProgramId program_id, FsFileSystemType filesystem_type, Service *fwd, const fssrv::sf::Path *path, bool with_id) {
/* Directory must exist. */
{
FsDir d;
@ -174,13 +174,13 @@ namespace ams::mitm::fs {
R_UNLESS(filesystem_type == FsFileSystemType_ContentManual, sm::mitm::ResultShouldForwardToSession());
/* Try to mount the HBL web filesystem. If this succeeds then we're done. */
R_UNLESS(R_FAILED(OpenHblWebContentFileSystem(out, client_program_id, program_id, filesystem_type)), ResultSuccess());
R_SUCCEED_IF(R_SUCCEEDED(OpenHblWebContentFileSystem(out, program_id)));
/* If program specific override shouldn't be attempted, fall back. */
R_UNLESS(try_program_specific, sm::mitm::ResultShouldForwardToSession());
/* If we're not opening a HBL filesystem, just try to open a generic one. */
return OpenProgramSpecificWebContentFileSystem(out, client_program_id, program_id, filesystem_type, fwd, path, with_id);
return OpenProgramSpecificWebContentFileSystem(out, program_id, filesystem_type, fwd, path, with_id);
}
}

View file

@ -28,7 +28,7 @@ namespace ams::mitm::fs {
os::MessageQueue g_req_mq(g_mq_storage + 0, 1);
os::MessageQueue g_ack_mq(g_mq_storage + 1, 1);
void RomfsInitializerThreadFunction(void *arg) {
void RomfsInitializerThreadFunction(void *) {
while (true) {
uintptr_t storage_uptr = 0;
g_req_mq.Receive(&storage_uptr);
@ -100,7 +100,6 @@ namespace ams::mitm::fs {
Result LayeredRomfsStorage::Read(s64 offset, void *buffer, size_t size) {
/* Check if we can succeed immediately. */
R_UNLESS(size >= 0, fs::ResultInvalidSize());
R_SUCCEED_IF(size == 0);
/* Ensure we're initialized. */
@ -112,8 +111,8 @@ namespace ams::mitm::fs {
const s64 virt_size = this->GetSize();
R_UNLESS(offset >= 0, fs::ResultInvalidOffset());
R_UNLESS(offset < virt_size, fs::ResultInvalidOffset());
if (size_t(virt_size - offset) < size) {
size = size_t(virt_size - offset);
if (static_cast<size_t>(virt_size - offset) < size) {
size = static_cast<size_t>(virt_size - offset);
}
/* Find first source info via binary search. */
@ -130,7 +129,7 @@ namespace ams::mitm::fs {
if (offset < cur_source.virtual_offset + cur_source.size) {
const s64 offset_within_source = offset - cur_source.virtual_offset;
const size_t cur_read_size = std::min(size - read_so_far, size_t(cur_source.size - offset_within_source));
const size_t cur_read_size = std::min(size - read_so_far, static_cast<size_t>(cur_source.size - offset_within_source));
switch (cur_source.source_type) {
case romfs::DataSourceType::Storage:
R_ABORT_UNLESS(this->storage_romfs->Read(cur_source.storage_source_info.offset + offset_within_source, cur_dst, cur_read_size));
@ -167,7 +166,7 @@ namespace ams::mitm::fs {
} else {
/* Explicitly handle padding. */
const auto &next_source = *(++it);
const size_t padding_size = size_t(next_source.virtual_offset - offset);
const size_t padding_size = static_cast<size_t>(next_source.virtual_offset - offset);
std::memset(cur_dst, 0, padding_size);
read_so_far += padding_size;
@ -194,6 +193,8 @@ namespace ams::mitm::fs {
}
Result LayeredRomfsStorage::OperateRange(void *dst, size_t dst_size, OperationId op_id, s64 offset, s64 size, const void *src, size_t src_size) {
AMS_UNUSED(offset, src, src_size);
switch (op_id) {
case OperationId::Invalidate:
case OperationId::QueryRange:

View file

@ -52,11 +52,13 @@ namespace ams::mitm::fs {
virtual Result Write(s64 offset, const void *buffer, size_t size) override {
/* TODO: Better result code? */
AMS_UNUSED(offset, buffer, size);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result SetSize(s64 size) override {
/* TODO: Better result code? */
AMS_UNUSED(size);
return ams::fs::ResultUnsupportedOperation();
}
};

View file

@ -64,7 +64,7 @@ namespace ams::mitm::fs {
os::ThreadType g_extra_threads[NumExtraThreads];
void LoopServerThread(void *arg) {
void LoopServerThread(void *) {
/* Loop forever, servicing our services. */
g_server_manager.LoopProcess();
}
@ -98,7 +98,7 @@ namespace ams::mitm::fs {
}
void MitmModule::ThreadFunction(void *arg) {
void MitmModule::ThreadFunction(void *) {
/* Create fs mitm. */
R_ABORT_UNLESS((g_server_manager.RegisterMitmServer<FsMitmService>(PortIndex_Mitm, MitmServiceName)));

View file

@ -28,45 +28,52 @@ namespace ams::mitm::fs {
virtual ~ReadOnlyLayeredFileSystem() { /* ... */ }
private:
virtual Result DoCreateFile(const char *path, s64 size, int flags) override final {
AMS_UNUSED(path, size, flags);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoDeleteFile(const char *path) override final {
AMS_UNUSED(path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoCreateDirectory(const char *path) override final {
AMS_UNUSED(path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoDeleteDirectory(const char *path) override final {
AMS_UNUSED(path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoDeleteDirectoryRecursively(const char *path) override final {
AMS_UNUSED(path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoRenameFile(const char *old_path, const char *new_path) override final {
AMS_UNUSED(old_path, new_path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoRenameDirectory(const char *old_path, const char *new_path) override final {
AMS_UNUSED(old_path, new_path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoGetEntryType(ams::fs::DirectoryEntryType *out, const char *path) override final {
R_UNLESS(R_FAILED(this->fs_1.GetEntryType(out, path)), ResultSuccess());
R_SUCCEED_IF(R_SUCCEEDED(this->fs_1.GetEntryType(out, path)));
return this->fs_2.GetEntryType(out, path);
}
virtual Result DoOpenFile(std::unique_ptr<ams::fs::fsa::IFile> *out_file, const char *path, ams::fs::OpenMode mode) override final {
R_UNLESS(R_FAILED(this->fs_1.OpenFile(out_file, path, mode)), ResultSuccess());
R_SUCCEED_IF(R_SUCCEEDED(this->fs_1.OpenFile(out_file, path, mode)));
return this->fs_2.OpenFile(out_file, path, mode);
}
virtual Result DoOpenDirectory(std::unique_ptr<ams::fs::fsa::IDirectory> *out_dir, const char *path, ams::fs::OpenDirectoryMode mode) override final {
R_UNLESS(R_FAILED(this->fs_1.OpenDirectory(out_dir, path, mode)), ResultSuccess());
R_SUCCEED_IF(R_SUCCEEDED(this->fs_1.OpenDirectory(out_dir, path, mode)));
return this->fs_2.OpenDirectory(out_dir, path, mode);
}
@ -75,19 +82,22 @@ namespace ams::mitm::fs {
}
virtual Result DoGetFreeSpaceSize(s64 *out, const char *path) {
AMS_UNUSED(out, path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoGetTotalSpaceSize(s64 *out, const char *path) {
AMS_UNUSED(out, path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoCleanDirectoryRecursively(const char *path) {
AMS_UNUSED(path);
return ams::fs::ResultUnsupportedOperation();
}
virtual Result DoGetFileTimeStampRaw(ams::fs::FileTimeStampRaw *out, const char *path) {
R_UNLESS(R_FAILED(this->fs_1.GetFileTimeStampRaw(out, path)), ResultSuccess());
R_SUCCEED_IF(R_SUCCEEDED(this->fs_1.GetFileTimeStampRaw(out, path)));
return this->fs_2.GetFileTimeStampRaw(out, path);
}
};

View file

@ -61,7 +61,7 @@ namespace ams::mitm::ns {
}
void MitmModule::ThreadFunction(void *arg) {
void MitmModule::ThreadFunction(void *) {
/* Wait until initialization is complete. */
mitm::WaitInitialized();

View file

@ -64,7 +64,7 @@ namespace ams::mitm::settings {
}
void MitmModule::ThreadFunction(void *arg) {
void MitmModule::ThreadFunction(void *) {
/* Wait until initialization is complete. */
mitm::WaitInitialized();

View file

@ -35,6 +35,7 @@ namespace ams::mitm::settings {
/* We will mitm:
* - everything, because we want to intercept all settings requests.
*/
AMS_UNUSED(client_info);
return true;
}
public:

View file

@ -45,7 +45,7 @@ namespace ams::mitm::sysupdater {
}
void MitmModule::ThreadFunction(void *arg) {
void MitmModule::ThreadFunction(void *) {
/* Wait until initialization is complete. */
mitm::WaitInitialized();

View file

@ -111,6 +111,8 @@ namespace ams {
}
void SetClockRate(const ClkRstDefinition &def, u32 hz) {
AMS_UNUSED(hz);
/* Enable clock. */
reg::ReadWrite(g_clkrst_registers + def.clk_en_ofs, 1u << def.clk_en_index, 1u << def.clk_en_index);
@ -166,6 +168,7 @@ namespace ams {
}
void SetClockDisabled(ClkRstSession *session) {
AMS_UNUSED(session);
AMS_ABORT("SetClockDisabled not implemented for boot system module");
}

View file

@ -34,7 +34,8 @@ namespace ams::boot {
bool present;
R_TRY(powctl::IsBatteryPresent(std::addressof(present), this->battery_session));
return present == false;
*out = !present;
return ResultSuccess();
}
Result GetSocRep(float *out) {

View file

@ -143,25 +143,25 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *__libnx_alloc(size_t size) {
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
@ -177,6 +177,10 @@ void operator delete(void *p) {
return Deallocate(p, 0);
}
void operator delete(void *p, size_t size) {
return Deallocate(p, size);
}
void *operator new[](size_t size) {
return Allocate(size);
}
@ -189,8 +193,14 @@ void operator delete[](void *p) {
return Deallocate(p, 0);
}
void operator delete[](void *p, size_t size) {
return Deallocate(p, size);
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Set thread name. */
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(boot, Main));
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(boot, Main));

View file

@ -68,6 +68,7 @@ namespace {
}
void DeallocateForFs(void *p, size_t size) {
AMS_UNUSED(size);
return lmem::FreeToExpHeap(g_fs_heap_handle, p);
}
@ -111,38 +112,44 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *operator new(size_t size) {
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Set thread name. */
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(boot2, Main));
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(boot2, Main));

View file

@ -71,6 +71,7 @@ namespace {
}
void DeallocateForFs(void *p, size_t size) {
AMS_UNUSED(size);
return lmem::FreeToExpHeap(g_fs_heap_handle, p);
}
@ -100,33 +101,37 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *operator new(size_t size) {
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}

View file

@ -76,6 +76,8 @@ namespace ams::cs {
}
void Deallocate(void *p, size_t size) {
AMS_UNUSED(size);
std::scoped_lock lk(g_heap_mutex);
lmem::FreeToExpHeap(g_heap_handle, p);
}
@ -131,33 +133,37 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *operator new(size_t size) {
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
@ -178,6 +184,8 @@ namespace ams::cs {
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
using namespace ams::cs;
/* Set thread name. */

View file

@ -389,6 +389,7 @@ namespace ams::dmnt {
}
} else {
/* TODO aarch32 branch decoding */
AMS_UNUSED(ctx);
}
}

View file

@ -1096,6 +1096,7 @@ namespace ams::dmnt {
reply = true;
}
}
break;
case svc::DebugEvent_ExitThread:
{
AMS_DMNT2_GDB_LOG_DEBUG("ExitThread %lx\n", thread_id);

View file

@ -91,6 +91,8 @@ namespace ams::dmnt {
}
Result HardwareBreakPoint::Clear(DebugProcess *debug_process) {
AMS_UNUSED(debug_process);
Result result = svc::ResultInvalidArgument();
if (m_in_use) {
AMS_DMNT2_GDB_LOG_DEBUG("HardwareBreakPoint::Clear %p 0x%lx\n", this, m_address);

View file

@ -93,6 +93,8 @@ namespace ams::dmnt {
}
Result WatchPoint::Clear(DebugProcess *debug_process) {
AMS_UNUSED(debug_process);
Result result = svc::ResultInvalidArgument();
if (m_in_use) {
AMS_DMNT2_GDB_LOG_DEBUG("WatchPoint::Clear %p 0x%lx\n", this, m_address);

View file

@ -95,38 +95,44 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *operator new(size_t size) {
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* TODO ThreadName */
/* Initialize htcs. */

View file

@ -81,6 +81,8 @@ namespace ams::dmnt::cheat::impl {
}
fs::WriteFile(this->debug_log_file, this->debug_log_offset, this->debug_log_format_buf, fmt_len, fs::WriteOption::Flush);
#else
AMS_UNUSED(format);
#endif
}

View file

@ -61,6 +61,7 @@ namespace {
}
void DeallocateForFs(void *p, size_t size) {
AMS_UNUSED(size);
return lmem::FreeToExpHeap(g_fs_heap_handle, p);
}
@ -126,7 +127,7 @@ namespace {
constinit sf::UnmanagedServiceObject<dmnt::cheat::impl::ICheatInterface, dmnt::cheat::CheatService> g_cheat_service;
void LoopServerThread(void *arg) {
void LoopServerThread(void *) {
g_server_manager.LoopProcess();
}
@ -140,40 +141,48 @@ namespace {
}
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *operator new(size_t size) {
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Set thread name. */
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(dmnt, Main));
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(dmnt, Main));

View file

@ -62,6 +62,7 @@ void __appExit(void) {
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
return 0;
}

View file

@ -115,38 +115,44 @@ namespace ams::erpt {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *operator new(size_t size) {
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Set thread name. */
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(erpt, Main));
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(erpt, Main));

View file

@ -143,6 +143,7 @@ namespace ams::fatal::srv {
if (request.meta.num_send_buffers != 1) {
return false;
}
break;
default:
return false;
}

View file

@ -60,6 +60,7 @@ namespace ams::fatal {
}
void DeallocateForFs(void *p, size_t size) {
AMS_UNUSED(size);
return lmem::FreeToExpHeap(g_fs_heap_handle, p);
}
@ -162,38 +163,44 @@ namespace {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *operator new(size_t size) {
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Disable auto-abort in fs operations. */
fs::SetEnabledAutoAbort(false);

View file

@ -67,6 +67,8 @@ namespace ams::htc {
}
void Deallocate(void *p, size_t size) {
AMS_UNUSED(size);
return lmem::FreeToExpHeap(g_heap_handle, p);
}
@ -117,48 +119,51 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
void *MallocForRapidJson(size_t size) {
void *MallocForRapidJson(size_t) {
AMS_ABORT("ams::MallocForRapidJson was called");
}
void *ReallocForRapidJson(void *ptr, size_t size) {
void *ReallocForRapidJson(void *, size_t) {
AMS_ABORT("ams::ReallocForRapidJson was called");
}
void FreeForRapidJson(void *ptr) {
if (ptr == nullptr) {
return;
if (ptr != nullptr) {
AMS_ABORT("ams::FreeForRapidJson was called");
}
AMS_ABORT("ams::FreeForRapidJson was called");
}
}
void *operator new(size_t size) {
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
@ -211,15 +216,15 @@ namespace ams::htc {
}
}
void HtcIpcThreadFunction(void *arg) {
void HtcIpcThreadFunction(void *) {
htc::server::LoopHtcmiscServer();
}
void HtcfsIpcThreadFunction(void *arg) {
void HtcfsIpcThreadFunction(void *) {
htcfs::LoopHipcServer();
}
void HtcsIpcThreadFunction(void *arg) {
void HtcsIpcThreadFunction(void *) {
htcs::server::LoopHipcServer();
}
@ -244,6 +249,8 @@ namespace ams::htclow::driver {
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Set thread name. */
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(htc, Main));
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(htc, Main));

View file

@ -67,6 +67,8 @@ void __appExit(void) {
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Set thread name. */
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(jpegdec, Main));

View file

@ -34,10 +34,12 @@ namespace ams::ldr {
R_TRY(ldr::GetProgramInfo(out, &status, loc));
if (loc.storage_id != static_cast<u8>(ncm::StorageId::None) && loc.program_id != out->program_id) {
char path[FS_MAX_PATH];
char path[fs::EntryNameLengthMax];
const ncm::ProgramLocation new_loc = ncm::ProgramLocation::Make(out->program_id, static_cast<ncm::StorageId>(loc.storage_id));
R_TRY(ResolveContentPath(path, loc));
path[sizeof(path) - 1] = '\x00';
R_TRY(RedirectContentPath(path, new_loc));
const auto arg_info = args::Get(loc.program_id);
@ -59,13 +61,16 @@ namespace ams::ldr {
Result LoaderService::CreateProcess(sf::OutMoveHandle out, PinId id, u32 flags, sf::CopyHandle &&reslimit_h) {
ncm::ProgramLocation loc;
cfg::OverrideStatus override_status;
char path[FS_MAX_PATH];
char path[fs::EntryNameLengthMax];
/* Get location and override status. */
R_TRY(ldr::ro::GetProgramLocationAndStatus(&loc, &override_status, id));
if (loc.storage_id != static_cast<u8>(ncm::StorageId::None)) {
R_TRY(ResolveContentPath(path, loc));
path[sizeof(path) - 1] = '\x00';
} else {
path[0] = '\x00';
}
/* Create the process. */

View file

@ -60,6 +60,7 @@ namespace ams::ldr {
}
void Deallocate(void *p, size_t size) {
AMS_UNUSED(size);
return lmem::FreeToExpHeap(g_server_heap_handle, p);
}
@ -159,11 +160,11 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
@ -177,20 +178,26 @@ void operator delete(void *p) {
return ldr::Deallocate(p, 0);
}
void *__libnx_alloc(size_t size) {
void operator delete(void *p, size_t size) {
return ldr::Deallocate(p, size);
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Disable auto-abort in fs operations. */
fs::SetEnabledAutoAbort(false);

View file

@ -123,6 +123,8 @@ namespace ams::ldr {
R_UNLESS(entries[i].version <= version, ResultInvalidVersion());
}
}
#else
AMS_UNUSED(program_id, version);
#endif
return ResultSuccess();
}
@ -662,6 +664,7 @@ namespace ams::ldr {
{
/* Mount code. */
AMS_UNUSED(path);
ScopedCodeMount mount(loc, override_status);
R_TRY(mount.GetResult());

View file

@ -103,25 +103,25 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *__libnx_alloc(size_t size) {
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
@ -137,6 +137,10 @@ void operator delete(void *p) {
return Deallocate(p, 0);
}
void operator delete(void *p, size_t size) {
return Deallocate(p, size);
}
void *operator new[](size_t size) {
return Allocate(size);
}
@ -149,6 +153,11 @@ void operator delete[](void *p) {
return Deallocate(p, 0);
}
void operator delete[](void *p, size_t size) {
return Deallocate(p, size);
}
namespace {
struct ContentManagerServerOptions {
@ -265,6 +274,8 @@ namespace {
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Disable auto-abort in fs operations. */
fs::SetEnabledAutoAbort(false);

View file

@ -87,11 +87,11 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
@ -105,20 +105,26 @@ void operator delete(void *p) {
return pgl::srv::Deallocate(p, 0);
}
void *__libnx_alloc(size_t size) {
void operator delete(void *p, size_t size) {
return pgl::srv::Deallocate(p, size);
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Disable auto-abort in fs operations. */
fs::SetEnabledAutoAbort(false);

View file

@ -118,7 +118,7 @@ namespace ams::pm::impl {
};
/* Process Tracking globals. */
void ProcessTrackingMain(void *arg);
void ProcessTrackingMain(void *);
constinit os::ThreadType g_process_track_thread;
alignas(os::ThreadStackAlignment) constinit u8 g_process_track_thread_stack[16_KB];
@ -154,7 +154,7 @@ namespace ams::pm::impl {
void OnProcessSignaled(ProcessListAccessor &list, ProcessInfo *process_info);
/* Helpers. */
void ProcessTrackingMain(void *arg) {
void ProcessTrackingMain(void *) {
/* This is the main loop of the process tracking thread. */
/* Setup multi wait/holders. */
@ -552,6 +552,7 @@ namespace ams::pm::impl {
/* Information Getters. */
Result GetModuleIdList(u32 *out_count, u8 *out_buf, size_t max_out_count, u64 unused) {
/* This function was always stubbed... */
AMS_UNUSED(out_buf, max_out_count, unused);
*out_count = 0;
return ResultSuccess();
}
@ -560,11 +561,19 @@ namespace ams::pm::impl {
ProcessListAccessor list(g_process_list);
size_t count = 0;
for (auto &process : *list) {
if (process.HasExceptionWaitingAttach()) {
out_process_ids[count++] = process.GetProcessId();
if (max_out_count > 0) {
for (auto &process : *list) {
if (process.HasExceptionWaitingAttach()) {
out_process_ids[count++] = process.GetProcessId();
if (count >= max_out_count) {
break;
}
}
}
}
*out_count = static_cast<u32>(count);
return ResultSuccess();
}

View file

@ -218,28 +218,46 @@ namespace {
}
void *operator new(size_t size) {
namespace ams {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Set thread name. */
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(pm, Main));
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(pm, Main));

View file

@ -95,6 +95,8 @@ namespace ams::ro {
}
void Deallocate(void *p, size_t size) {
AMS_UNUSED(size);
return lmem::FreeToExpHeap(g_server_heap_handle, p);
}
@ -158,38 +160,44 @@ void __appExit(void) {
namespace ams {
void *Malloc(size_t size) {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *ptr) {
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *operator new(size_t size) {
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Set thread name. */
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(ro, Main));
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(ro, Main));

View file

@ -52,6 +52,7 @@ namespace {
namespace ams {
void NORETURN Exit(int rc) {
AMS_UNUSED(rc);
AMS_ABORT("Exit called by immortal process");
}
@ -92,28 +93,34 @@ void __appExit(void) {
/* Nothing to clean up, because we're sm. */
}
void *operator new(size_t size) {
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Set thread name. */
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(sm, Main));
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(sm, Main));

View file

@ -52,6 +52,8 @@ namespace ams::sm {
}
Result UserService::DetachClient(const tipc::ClientProcessId client_process_id) {
AMS_UNUSED(client_process_id);
m_initialized = false;
return ResultSuccess();
}

View file

@ -175,28 +175,46 @@ namespace {
}
void *operator new(size_t size) {
namespace ams {
void *Malloc(size_t) {
AMS_ABORT("ams::Malloc was called");
}
void Free(void *) {
AMS_ABORT("ams::Free was called");
}
}
void *operator new(size_t) {
AMS_ABORT("operator new(size_t) was called");
}
void operator delete(void *p) {
void operator delete(void *) {
AMS_ABORT("operator delete(void *) was called");
}
void *__libnx_alloc(size_t size) {
void operator delete(void *, size_t) {
AMS_ABORT("operator delete(void *, size_t) was called");
}
void *__libnx_alloc(size_t) {
AMS_ABORT("__libnx_alloc was called");
}
void *__libnx_aligned_alloc(size_t alignment, size_t size) {
void *__libnx_aligned_alloc(size_t, size_t) {
AMS_ABORT("__libnx_aligned_alloc was called");
}
void __libnx_free(void *mem) {
void __libnx_free(void *) {
AMS_ABORT("__libnx_free was called");
}
int main(int argc, char **argv)
{
AMS_UNUSED(argc, argv);
/* Set thread name. */
os::SetThreadNamePointer(os::GetCurrentThread(), AMS_GET_SYSTEM_THREAD_NAME(spl, Main));
AMS_ASSERT(os::GetThreadPriority(os::GetCurrentThread()) == AMS_GET_SYSTEM_THREAD_PRIORITY(spl, Main));