mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
kern: build with -Wextra
This commit is contained in:
parent
d3014f6ed9
commit
73798cb812
32 changed files with 100 additions and 30 deletions
|
@ -7,7 +7,7 @@ include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../common.mk
|
||||||
# options for code generation
|
# options for code generation
|
||||||
#---------------------------------------------------------------------------------
|
#---------------------------------------------------------------------------------
|
||||||
export DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE
|
export DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE
|
||||||
export SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 -mgeneral-regs-only -ffixed-x18 -Werror -fno-non-call-exceptions
|
export SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 -mgeneral-regs-only -ffixed-x18 -Wextra -Werror -fno-non-call-exceptions
|
||||||
export CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
export CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
||||||
export CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit
|
export CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit
|
||||||
export ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES)
|
export ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES)
|
||||||
|
|
|
@ -9,7 +9,7 @@ include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/../config/common.mk
|
||||||
PRECOMPILED_HEADERS := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/include/mesosphere.hpp
|
PRECOMPILED_HEADERS := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/include/mesosphere.hpp
|
||||||
|
|
||||||
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE
|
DEFINES := $(ATMOSPHERE_DEFINES) -DATMOSPHERE_IS_MESOSPHERE
|
||||||
SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 -mgeneral-regs-only -ffixed-x18 -Werror -fno-non-call-exceptions
|
SETTINGS := $(ATMOSPHERE_SETTINGS) -O2 -mgeneral-regs-only -ffixed-x18 -Wextra -Werror -fno-non-call-exceptions
|
||||||
CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
|
||||||
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit -flto
|
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit -flto
|
||||||
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS)
|
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS)
|
||||||
|
|
|
@ -31,6 +31,9 @@ namespace ams::kern {
|
||||||
template<typename U>
|
template<typename U>
|
||||||
constexpr ALWAYS_INLINE explicit KTypedAddress(U *ptr) : address(reinterpret_cast<uintptr_t>(ptr)) { /* ... */ }
|
constexpr ALWAYS_INLINE explicit KTypedAddress(U *ptr) : address(reinterpret_cast<uintptr_t>(ptr)) { /* ... */ }
|
||||||
|
|
||||||
|
/* Copy constructor. */
|
||||||
|
constexpr ALWAYS_INLINE KTypedAddress(const KTypedAddress &rhs) : address(rhs.address) { /* ... */ }
|
||||||
|
|
||||||
/* Assignment operator. */
|
/* Assignment operator. */
|
||||||
constexpr ALWAYS_INLINE KTypedAddress operator=(KTypedAddress rhs) {
|
constexpr ALWAYS_INLINE KTypedAddress operator=(KTypedAddress rhs) {
|
||||||
this->address = rhs.address;
|
this->address = rhs.address;
|
||||||
|
|
|
@ -19,17 +19,12 @@
|
||||||
|
|
||||||
namespace ams::kern {
|
namespace ams::kern {
|
||||||
|
|
||||||
template<typename... ArgTypes>
|
|
||||||
ALWAYS_INLINE void UnusedImpl(ArgTypes &&... args) {
|
|
||||||
(static_cast<void>(args), ...);
|
|
||||||
}
|
|
||||||
|
|
||||||
NORETURN NOINLINE void Panic(const char *file, int line, const char *format, ...) __attribute__((format(printf, 3, 4)));
|
NORETURN NOINLINE void Panic(const char *file, int line, const char *format, ...) __attribute__((format(printf, 3, 4)));
|
||||||
NORETURN NOINLINE void Panic();
|
NORETURN NOINLINE void Panic();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MESOSPHERE_UNUSED(...) ::ams::kern::UnusedImpl(__VA_ARGS__)
|
#define MESOSPHERE_UNUSED(...) AMS_UNUSED(__VA_ARGS__)
|
||||||
|
|
||||||
#ifdef MESOSPHERE_ENABLE_DEBUG_PRINT
|
#ifdef MESOSPHERE_ENABLE_DEBUG_PRINT
|
||||||
#define MESOSPHERE_PANIC(...) do { ::ams::kern::Panic(__FILE__, __LINE__, ## __VA_ARGS__); } while(0)
|
#define MESOSPHERE_PANIC(...) do { ::ams::kern::Panic(__FILE__, __LINE__, ## __VA_ARGS__); } while(0)
|
||||||
|
|
|
@ -37,6 +37,7 @@ namespace ams::kern::arch::arm64::cpu {
|
||||||
constexpr KThreadTerminationInterruptHandler() : KInterruptHandler() { /* ... */ }
|
constexpr KThreadTerminationInterruptHandler() : KInterruptHandler() { /* ... */ }
|
||||||
|
|
||||||
virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override {
|
virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override {
|
||||||
|
MESOSPHERE_UNUSED(interrupt_id);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -68,6 +69,8 @@ namespace ams::kern::arch::arm64::cpu {
|
||||||
|
|
||||||
/* Nintendo misuses this per their own API, but it's functional. */
|
/* Nintendo misuses this per their own API, but it's functional. */
|
||||||
virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override {
|
virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override {
|
||||||
|
MESOSPHERE_UNUSED(interrupt_id);
|
||||||
|
|
||||||
if (this->which < 0) {
|
if (this->which < 0) {
|
||||||
this->counter = cpu::GetCycleCounter();
|
this->counter = cpu::GetCycleCounter();
|
||||||
} else {
|
} else {
|
||||||
|
@ -145,6 +148,7 @@ namespace ams::kern::arch::arm64::cpu {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override {
|
virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override {
|
||||||
|
MESOSPHERE_UNUSED(interrupt_id);
|
||||||
this->ProcessOperation();
|
this->ProcessOperation();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace ams::kern::arch::arm64 {
|
||||||
constexpr KHardwareTimerInterruptTask() : KInterruptTask() { /* ... */ }
|
constexpr KHardwareTimerInterruptTask() : KInterruptTask() { /* ... */ }
|
||||||
|
|
||||||
virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override {
|
virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override {
|
||||||
|
MESOSPHERE_UNUSED(interrupt_id);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,7 @@ namespace ams::kern::arch::arm64 {
|
||||||
|
|
||||||
void KPageTable::Initialize(s32 core_id) {
|
void KPageTable::Initialize(s32 core_id) {
|
||||||
/* Nothing actually needed here. */
|
/* Nothing actually needed here. */
|
||||||
|
MESOSPHERE_UNUSED(core_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result KPageTable::InitializeForKernel(void *table, KVirtualAddress start, KVirtualAddress end) {
|
Result KPageTable::InitializeForKernel(void *table, KVirtualAddress start, KVirtualAddress end) {
|
||||||
|
@ -181,7 +182,8 @@ namespace ams::kern::arch::arm64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
Result KPageTable::InitializeForProcess(u32 id, ams::svc::CreateProcessFlag as_type, bool enable_aslr, bool from_back, KMemoryManager::Pool pool, KProcessAddress code_address, size_t code_size, KMemoryBlockSlabManager *mem_block_slab_manager, KBlockInfoManager *block_info_manager, KPageTableManager *pt_manager) {
|
Result KPageTable::InitializeForProcess(u32 id, ams::svc::CreateProcessFlag as_type, bool enable_aslr, bool from_back, KMemoryManager::Pool pool, KProcessAddress code_address, size_t code_size, KMemoryBlockSlabManager *mem_block_slab_manager, KBlockInfoManager *block_info_manager, KPageTableManager *pt_manager) {
|
||||||
/* Convert the address space type to a width. */
|
/* The input ID isn't actually used. */
|
||||||
|
MESOSPHERE_UNUSED(id);
|
||||||
|
|
||||||
/* Get an ASID */
|
/* Get an ASID */
|
||||||
this->asid = g_asid_manager.Reserve();
|
this->asid = g_asid_manager.Reserve();
|
||||||
|
@ -364,6 +366,9 @@ namespace ams::kern::arch::arm64 {
|
||||||
MESOSPHERE_ASSERT(util::IsAligned(GetInteger(phys_addr), L1BlockSize));
|
MESOSPHERE_ASSERT(util::IsAligned(GetInteger(phys_addr), L1BlockSize));
|
||||||
MESOSPHERE_ASSERT(util::IsAligned(num_pages * PageSize, L1BlockSize));
|
MESOSPHERE_ASSERT(util::IsAligned(num_pages * PageSize, L1BlockSize));
|
||||||
|
|
||||||
|
/* Allocation is never needed for L1 block mapping. */
|
||||||
|
MESOSPHERE_UNUSED(page_list, reuse_ll);
|
||||||
|
|
||||||
auto &impl = this->GetImpl();
|
auto &impl = this->GetImpl();
|
||||||
|
|
||||||
/* Iterate, mapping each block. */
|
/* Iterate, mapping each block. */
|
||||||
|
|
|
@ -281,6 +281,7 @@ namespace ams::kern::arch::arm64 {
|
||||||
}
|
}
|
||||||
|
|
||||||
void KThreadContext::OnThreadTerminating(const KThread *thread) {
|
void KThreadContext::OnThreadTerminating(const KThread *thread) {
|
||||||
|
MESOSPHERE_UNUSED(thread);
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -498,6 +498,8 @@ namespace ams::kern {
|
||||||
|
|
||||||
R_TRY(PutUserString(user_str, len));
|
R_TRY(PutUserString(user_str, len));
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
MESOSPHERE_UNUSED(user_str, len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
|
|
|
@ -62,7 +62,7 @@ namespace ams::kern {
|
||||||
|
|
||||||
/* Allocate memory for the process. */
|
/* Allocate memory for the process. */
|
||||||
auto &mm = Kernel::GetMemoryManager();
|
auto &mm = Kernel::GetMemoryManager();
|
||||||
const auto pool = static_cast<KMemoryManager::Pool>(reader.UsesSecureMemory() ? KMemoryManager::Pool_System : KSystemControl::GetInitialProcessBinaryPool());
|
const auto pool = reader.UsesSecureMemory() ? KMemoryManager::Pool_System : static_cast<KMemoryManager::Pool>(KSystemControl::GetInitialProcessBinaryPool());
|
||||||
MESOSPHERE_R_ABORT_UNLESS(mm.Allocate(std::addressof(pg), params.code_num_pages, KMemoryManager::EncodeOption(pool, KMemoryManager::Direction_FromFront)));
|
MESOSPHERE_R_ABORT_UNLESS(mm.Allocate(std::addressof(pg), params.code_num_pages, KMemoryManager::EncodeOption(pool, KMemoryManager::Direction_FromFront)));
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -157,6 +157,7 @@ namespace ams::kern {
|
||||||
case RegionType::OnMemoryBootImage:
|
case RegionType::OnMemoryBootImage:
|
||||||
case RegionType::DTB:
|
case RegionType::DTB:
|
||||||
R_TRY(page_table->MapRegion(MemoryRegions[static_cast<u32>(type)], perm));
|
R_TRY(page_table->MapRegion(MemoryRegions[static_cast<u32>(type)], perm));
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return svc::ResultNotFound();
|
return svc::ResultNotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,10 @@ namespace ams::kern {
|
||||||
|
|
||||||
/* Manager thread functions. */
|
/* Manager thread functions. */
|
||||||
void DpcManagerNormalThreadFunction(uintptr_t arg) {
|
void DpcManagerNormalThreadFunction(uintptr_t arg) {
|
||||||
|
/* Input argument goes unused. */
|
||||||
|
MESOSPHERE_UNUSED(arg);
|
||||||
|
|
||||||
|
/* Forever wait and service requests. */
|
||||||
while (true) {
|
while (true) {
|
||||||
KDpcTask::WaitForRequest();
|
KDpcTask::WaitForRequest();
|
||||||
KDpcTask::HandleRequest();
|
KDpcTask::HandleRequest();
|
||||||
|
@ -93,6 +97,10 @@ namespace ams::kern {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DpcManagerPreemptionThreadFunction(uintptr_t arg) {
|
void DpcManagerPreemptionThreadFunction(uintptr_t arg) {
|
||||||
|
/* Input argument goes unused. */
|
||||||
|
MESOSPHERE_UNUSED(arg);
|
||||||
|
|
||||||
|
/* Forever wait and service requests, rotating the scheduled queue every 10 ms. */
|
||||||
s64 timeout = KHardwareTimer::GetTick() + DpcManagerTimeout;
|
s64 timeout = KHardwareTimer::GetTick() + DpcManagerTimeout;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (KDpcTask::TimedWaitForRequest(timeout)) {
|
if (KDpcTask::TimedWaitForRequest(timeout)) {
|
||||||
|
|
|
@ -128,7 +128,7 @@ namespace ams::kern {
|
||||||
|
|
||||||
KInterruptTask *KInterruptEventTask::OnInterrupt(s32 interrupt_id) {
|
KInterruptTask *KInterruptEventTask::OnInterrupt(s32 interrupt_id) {
|
||||||
MESOSPHERE_ASSERT_THIS();
|
MESOSPHERE_ASSERT_THIS();
|
||||||
|
MESOSPHERE_UNUSED(interrupt_id);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,10 @@ namespace ams::kern {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupCoreLocalRegionMemoryRegions(KInitialPageTable &page_table, KInitialPageAllocator &page_allocator) {
|
void SetupCoreLocalRegionMemoryRegions(KInitialPageTable &page_table, KInitialPageAllocator &page_allocator) {
|
||||||
|
/* NOTE: Nintendo passes page table here to use num_l1_entries; we don't use this at present. */
|
||||||
|
MESOSPHERE_UNUSED(page_table);
|
||||||
|
|
||||||
|
/* Get the virtual address of the core local reigon. */
|
||||||
const KVirtualAddress core_local_virt_start = GetCoreLocalRegionVirtualAddress();
|
const KVirtualAddress core_local_virt_start = GetCoreLocalRegionVirtualAddress();
|
||||||
MESOSPHERE_INIT_ABORT_UNLESS(KMemoryLayout::GetVirtualMemoryRegionTree().Insert(GetInteger(core_local_virt_start), CoreLocalRegionSize, KMemoryRegionType_CoreLocal));
|
MESOSPHERE_INIT_ABORT_UNLESS(KMemoryLayout::GetVirtualMemoryRegionTree().Insert(GetInteger(core_local_virt_start), CoreLocalRegionSize, KMemoryRegionType_CoreLocal));
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,6 @@ namespace ams::kern {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Only succeed if we allocated as many pages as we wanted. */
|
/* Only succeed if we allocated as many pages as we wanted. */
|
||||||
MESOSPHERE_ASSERT(num_pages >= 0);
|
|
||||||
R_UNLESS(num_pages == 0, svc::ResultOutOfMemory());
|
R_UNLESS(num_pages == 0, svc::ResultOutOfMemory());
|
||||||
|
|
||||||
/* We succeeded! */
|
/* We succeeded! */
|
||||||
|
|
|
@ -2761,9 +2761,12 @@ namespace ams::kern {
|
||||||
lk1.emplace(lock_1);
|
lk1.emplace(lock_1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check memory state. */
|
/* Check memory state for source. */
|
||||||
R_TRY(src_page_table.CheckMemoryStateContiguous(src_addr, size, src_state_mask, src_state, src_test_perm, src_test_perm, src_attr_mask | KMemoryAttribute_Uncached, src_attr));
|
R_TRY(src_page_table.CheckMemoryStateContiguous(src_addr, size, src_state_mask, src_state, src_test_perm, src_test_perm, src_attr_mask | KMemoryAttribute_Uncached, src_attr));
|
||||||
|
|
||||||
|
/* Destination state is intentionally unchecked. */
|
||||||
|
MESOSPHERE_UNUSED(dst_state_mask, dst_state, dst_test_perm, dst_attr_mask, dst_attr);
|
||||||
|
|
||||||
/* Get implementations. */
|
/* Get implementations. */
|
||||||
auto &src_impl = src_page_table.GetImpl();
|
auto &src_impl = src_page_table.GetImpl();
|
||||||
auto &dst_impl = dst_page_table.GetImpl();
|
auto &dst_impl = dst_page_table.GetImpl();
|
||||||
|
|
|
@ -493,6 +493,9 @@ namespace ams::kern {
|
||||||
/* Lock ourselves, to prevent concurrent access. */
|
/* Lock ourselves, to prevent concurrent access. */
|
||||||
KScopedLightLock lk(this->state_lock);
|
KScopedLightLock lk(this->state_lock);
|
||||||
|
|
||||||
|
/* Address and size parameters aren't used. */
|
||||||
|
MESOSPHERE_UNUSED(address, size);
|
||||||
|
|
||||||
/* Try to find an existing info for the memory. */
|
/* Try to find an existing info for the memory. */
|
||||||
KSharedMemoryInfo *info = nullptr;
|
KSharedMemoryInfo *info = nullptr;
|
||||||
for (auto it = this->shared_memory_list.begin(); it != this->shared_memory_list.end(); ++it) {
|
for (auto it = this->shared_memory_list.begin(); it != this->shared_memory_list.end(); ++it) {
|
||||||
|
@ -524,6 +527,9 @@ namespace ams::kern {
|
||||||
/* Lock ourselves, to prevent concurrent access. */
|
/* Lock ourselves, to prevent concurrent access. */
|
||||||
KScopedLightLock lk(this->state_lock);
|
KScopedLightLock lk(this->state_lock);
|
||||||
|
|
||||||
|
/* Address and size parameters aren't used. */
|
||||||
|
MESOSPHERE_UNUSED(address, size);
|
||||||
|
|
||||||
/* Find an existing info for the memory. */
|
/* Find an existing info for the memory. */
|
||||||
KSharedMemoryInfo *info = nullptr;
|
KSharedMemoryInfo *info = nullptr;
|
||||||
auto it = this->shared_memory_list.begin();
|
auto it = this->shared_memory_list.begin();
|
||||||
|
|
|
@ -28,6 +28,7 @@ namespace ams::kern {
|
||||||
constexpr KSchedulerInterruptTask() : KInterruptTask() { /* ... */ }
|
constexpr KSchedulerInterruptTask() : KInterruptTask() { /* ... */ }
|
||||||
|
|
||||||
virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override {
|
virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override {
|
||||||
|
MESOSPHERE_UNUSED(interrupt_id);
|
||||||
return GetDummyInterruptTask();
|
return GetDummyInterruptTask();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,10 @@ namespace ams::kern {
|
||||||
this->msg_buffer_end = dst_address + sizeof(u32) * out_offset;
|
this->msg_buffer_end = dst_address + sizeof(u32) * out_offset;
|
||||||
this->msg_buffer_space_end = dst_address + msg_size;
|
this->msg_buffer_space_end = dst_address + msg_size;
|
||||||
|
|
||||||
|
/* NOTE: Nintendo calculates the receive list index here using the special header. */
|
||||||
|
/* We pre-calculate it in the caller, and pass it as a parameter. */
|
||||||
|
MESOSPHERE_UNUSED(dst_special_header);
|
||||||
|
|
||||||
const u32 *recv_list = dst_msg + dst_recv_list_idx;
|
const u32 *recv_list = dst_msg + dst_recv_list_idx;
|
||||||
const auto entry_count = GetEntryCount(dst_header);
|
const auto entry_count = GetEntryCount(dst_header);
|
||||||
|
|
||||||
|
@ -494,6 +498,9 @@ namespace ams::kern {
|
||||||
auto &dst_page_table = dst_process.GetPageTable();
|
auto &dst_page_table = dst_process.GetPageTable();
|
||||||
auto &src_page_table = src_process.GetPageTable();
|
auto &src_page_table = src_process.GetPageTable();
|
||||||
|
|
||||||
|
/* NOTE: Session is used only for debugging, and so may go unused. */
|
||||||
|
MESOSPHERE_UNUSED(session);
|
||||||
|
|
||||||
/* The receive list is initially not broken. */
|
/* The receive list is initially not broken. */
|
||||||
recv_list_broken = false;
|
recv_list_broken = false;
|
||||||
|
|
||||||
|
@ -711,7 +718,7 @@ namespace ams::kern {
|
||||||
return ResultSuccess();
|
return ResultSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
ALWAYS_INLINE Result ProcessSendMessagePointerDescriptors(int &offset, int &pointer_key, KProcessPageTable &dst_page_table, KProcessPageTable &src_page_table, const ipc::MessageBuffer &dst_msg, const ipc::MessageBuffer &src_msg, const ReceiveList &dst_recv_list, bool dst_user) {
|
ALWAYS_INLINE Result ProcessSendMessagePointerDescriptors(int &offset, int &pointer_key, KProcessPageTable &dst_page_table, const ipc::MessageBuffer &dst_msg, const ipc::MessageBuffer &src_msg, const ReceiveList &dst_recv_list, bool dst_user) {
|
||||||
/* Get the offset at the start of processing. */
|
/* Get the offset at the start of processing. */
|
||||||
const int cur_offset = offset;
|
const int cur_offset = offset;
|
||||||
|
|
||||||
|
@ -758,6 +765,9 @@ namespace ams::kern {
|
||||||
auto &dst_page_table = dst_process.GetPageTable();
|
auto &dst_page_table = dst_process.GetPageTable();
|
||||||
auto &src_page_table = src_process.GetPageTable();
|
auto &src_page_table = src_process.GetPageTable();
|
||||||
|
|
||||||
|
/* NOTE: Session is used only for debugging, and so may go unused. */
|
||||||
|
MESOSPHERE_UNUSED(session);
|
||||||
|
|
||||||
/* Determine the message buffers. */
|
/* Determine the message buffers. */
|
||||||
u32 *dst_msg_ptr, *src_msg_ptr;
|
u32 *dst_msg_ptr, *src_msg_ptr;
|
||||||
bool dst_user, src_user;
|
bool dst_user, src_user;
|
||||||
|
@ -860,7 +870,7 @@ namespace ams::kern {
|
||||||
|
|
||||||
/* Process any pointer buffers. */
|
/* Process any pointer buffers. */
|
||||||
for (auto i = 0; i < src_header.GetPointerCount(); ++i) {
|
for (auto i = 0; i < src_header.GetPointerCount(); ++i) {
|
||||||
R_TRY(ProcessSendMessagePointerDescriptors(offset, pointer_key, dst_page_table, src_page_table, dst_msg, src_msg, dst_recv_list, dst_user && dst_header.GetReceiveListCount() == ipc::MessageBuffer::MessageHeader::ReceiveListCountType_ToMessageBuffer));
|
R_TRY(ProcessSendMessagePointerDescriptors(offset, pointer_key, dst_page_table, dst_msg, src_msg, dst_recv_list, dst_user && dst_header.GetReceiveListCount() == ipc::MessageBuffer::MessageHeader::ReceiveListCountType_ToMessageBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear any map alias buffers. */
|
/* Clear any map alias buffers. */
|
||||||
|
|
|
@ -99,6 +99,7 @@ namespace ams::kern {
|
||||||
|
|
||||||
Result KSharedMemory::Unmap(KProcessPageTable *table, KProcessAddress address, size_t size, KProcess *process) {
|
Result KSharedMemory::Unmap(KProcessPageTable *table, KProcessAddress address, size_t size, KProcess *process) {
|
||||||
MESOSPHERE_ASSERT_THIS();
|
MESOSPHERE_ASSERT_THIS();
|
||||||
|
MESOSPHERE_UNUSED(process);
|
||||||
|
|
||||||
/* Validate the size. */
|
/* Validate the size. */
|
||||||
R_UNLESS(this->page_group.GetNumPages() == util::DivideUp(size, PageSize), svc::ResultInvalidSize());
|
R_UNLESS(this->page_group.GetNumPages() == util::DivideUp(size, PageSize), svc::ResultInvalidSize());
|
||||||
|
|
|
@ -126,6 +126,8 @@ namespace ams::kern {
|
||||||
MESOSPHERE_RELEASE_VLOG(format, vl);
|
MESOSPHERE_RELEASE_VLOG(format, vl);
|
||||||
MESOSPHERE_RELEASE_LOG("\n");
|
MESOSPHERE_RELEASE_LOG("\n");
|
||||||
va_end(vl);
|
va_end(vl);
|
||||||
|
#else
|
||||||
|
MESOSPHERE_UNUSED(file, line, format);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
StopSystem();
|
StopSystem();
|
||||||
|
|
|
@ -26,6 +26,10 @@ namespace ams::kern::svc {
|
||||||
{
|
{
|
||||||
/* TODO: Implement Kernel Debugging. */
|
/* TODO: Implement Kernel Debugging. */
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
MESOSPHERE_UNUSED(kern_debug_type, arg0, arg1, arg2);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +51,10 @@ namespace ams::kern::svc {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
{
|
||||||
|
MESOSPHERE_UNUSED(kern_trace_state);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,15 +16,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <vapours/common.hpp>
|
#include <vapours/common.hpp>
|
||||||
|
|
||||||
namespace ams::impl {
|
|
||||||
|
|
||||||
template<typename... ArgTypes>
|
|
||||||
constexpr ALWAYS_INLINE void UnusedImpl(ArgTypes... args) {
|
|
||||||
(static_cast<void>(args), ...);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ams::diag {
|
namespace ams::diag {
|
||||||
|
|
||||||
NORETURN NOINLINE void AssertionFailureImpl(const char *file, int line, const char *func, const char *expr, u64 value, const char *format, ...) __attribute__((format(printf, 6, 7)));
|
NORETURN NOINLINE void AssertionFailureImpl(const char *file, int line, const char *func, const char *expr, u64 value, const char *format, ...) __attribute__((format(printf, 6, 7)));
|
||||||
|
@ -36,8 +27,6 @@ namespace ams::diag {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define AMS_UNUSED(...) ::ams::impl::UnusedImpl(__VA_ARGS__)
|
|
||||||
|
|
||||||
#ifdef AMS_ENABLE_DEBUG_PRINT
|
#ifdef AMS_ENABLE_DEBUG_PRINT
|
||||||
#define AMS_CALL_ASSERT_FAIL_IMPL(cond, ...) ::ams::diag::AssertionFailureImpl(__FILE__, __LINE__, __PRETTY_FUNCTION__, cond, 0, ## __VA_ARGS__)
|
#define AMS_CALL_ASSERT_FAIL_IMPL(cond, ...) ::ams::diag::AssertionFailureImpl(__FILE__, __LINE__, __PRETTY_FUNCTION__, cond, 0, ## __VA_ARGS__)
|
||||||
#define AMS_CALL_ABORT_IMPL(cond, ...) ::ams::diag::AbortImpl(__FILE__, __LINE__, __PRETTY_FUNCTION__, cond, 0, ## __VA_ARGS__)
|
#define AMS_CALL_ABORT_IMPL(cond, ...) ::ams::diag::AbortImpl(__FILE__, __LINE__, __PRETTY_FUNCTION__, cond, 0, ## __VA_ARGS__)
|
||||||
|
|
|
@ -66,4 +66,19 @@
|
||||||
|
|
||||||
#define AMS_CURRENT_FUNCTION_NAME __FUNCTION__
|
#define AMS_CURRENT_FUNCTION_NAME __FUNCTION__
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
|
||||||
|
namespace ams::impl {
|
||||||
|
|
||||||
|
template<typename... ArgTypes>
|
||||||
|
constexpr ALWAYS_INLINE void UnusedImpl(ArgTypes &&... args) {
|
||||||
|
(static_cast<void>(args), ...);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define AMS_UNUSED(...) ::ams::impl::UnusedImpl(__VA_ARGS__)
|
||||||
|
|
||||||
#define AMS_INFINITE_LOOP() do { __asm__ __volatile__("" ::: "memory"); } while (1)
|
#define AMS_INFINITE_LOOP() do { __asm__ __volatile__("" ::: "memory"); } while (1)
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace ams {
|
||||||
constexpr Result(typename Base::BaseType v) : value(v) { static_assert(std::is_same<typename Base::BaseType, ::Result>::value); }
|
constexpr Result(typename Base::BaseType v) : value(v) { static_assert(std::is_same<typename Base::BaseType, ::Result>::value); }
|
||||||
|
|
||||||
constexpr ALWAYS_INLINE operator ResultSuccess() const;
|
constexpr ALWAYS_INLINE operator ResultSuccess() const;
|
||||||
NX_CONSTEXPR bool CanAccept(Result result) { return true; }
|
NX_CONSTEXPR bool CanAccept(Result) { return true; }
|
||||||
|
|
||||||
constexpr ALWAYS_INLINE bool IsSuccess() const { return this->GetValue() == Base::SuccessValue; }
|
constexpr ALWAYS_INLINE bool IsSuccess() const { return this->GetValue() == Base::SuccessValue; }
|
||||||
constexpr ALWAYS_INLINE bool IsFailure() const { return !this->IsSuccess(); }
|
constexpr ALWAYS_INLINE bool IsFailure() const { return !this->IsSuccess(); }
|
||||||
|
|
|
@ -353,7 +353,7 @@ namespace ams::svc::codegen::impl {
|
||||||
};
|
};
|
||||||
|
|
||||||
template<auto Allocator, typename FirstOperation, typename...OtherOperations>
|
template<auto Allocator, typename FirstOperation, typename...OtherOperations>
|
||||||
static constexpr auto GetModifiedOperations(std::tuple<FirstOperation, OtherOperations...> ops) {
|
static constexpr auto GetModifiedOperations(std::tuple<FirstOperation, OtherOperations...>) {
|
||||||
constexpr size_t ModifyRegister = [] {
|
constexpr size_t ModifyRegister = [] {
|
||||||
auto allocator = Allocator;
|
auto allocator = Allocator;
|
||||||
return allocator.AllocateFirstFree();
|
return allocator.AllocateFirstFree();
|
||||||
|
@ -535,7 +535,11 @@ namespace ams::svc::codegen::impl {
|
||||||
GenerateCodeForMetaCode<CodeGenerator, BeforeMetaCode>();
|
GenerateCodeForMetaCode<CodeGenerator, BeforeMetaCode>();
|
||||||
ON_SCOPE_EXIT { GenerateCodeForMetaCode<CodeGenerator, AfterMetaCode>(); };
|
ON_SCOPE_EXIT { GenerateCodeForMetaCode<CodeGenerator, AfterMetaCode>(); };
|
||||||
|
|
||||||
|
/* Cast the generated function to the generic funciton pointer type. */
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wcast-function-type"
|
||||||
return reinterpret_cast<ReturnType (*)()>(Function)();
|
return reinterpret_cast<ReturnType (*)()>(Function)();
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma GCC pop_options
|
#pragma GCC pop_options
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace ams::svc::codegen::impl {
|
||||||
template<typename Operation>
|
template<typename Operation>
|
||||||
static constexpr void GenerateCodeForPrepareForKernelProcedureToSvcInvocation(MetaCodeGenerator &mcg) {
|
static constexpr void GenerateCodeForPrepareForKernelProcedureToSvcInvocation(MetaCodeGenerator &mcg) {
|
||||||
static_assert(Operation::Kind == OperationKind::PackAndUnpack);
|
static_assert(Operation::Kind == OperationKind::PackAndUnpack);
|
||||||
/* ... */
|
AMS_UNUSED(mcg);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Operation>
|
template<typename Operation>
|
||||||
|
|
|
@ -498,6 +498,7 @@ namespace ams::svc::ipc {
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr ALWAYS_INLINE s32 GetSpecialDataIndex(const MessageHeader &hdr, const SpecialHeader &spc) {
|
static constexpr ALWAYS_INLINE s32 GetSpecialDataIndex(const MessageHeader &hdr, const SpecialHeader &spc) {
|
||||||
|
AMS_UNUSED(hdr);
|
||||||
return (MessageHeader::GetDataSize() / sizeof(util::BitPack32)) + (spc.GetHeaderSize() / sizeof(util::BitPack32));
|
return (MessageHeader::GetDataSize() / sizeof(util::BitPack32)) + (spc.GetHeaderSize() / sizeof(util::BitPack32));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace ams {
|
||||||
private:
|
private:
|
||||||
TimeSpanType ts;
|
TimeSpanType ts;
|
||||||
public:
|
public:
|
||||||
constexpr ALWAYS_INLINE TimeSpan(ZeroTag z = nullptr) : ts(TimeSpanType::FromNanoSeconds(0)) { /* ... */ }
|
constexpr ALWAYS_INLINE TimeSpan(ZeroTag z = nullptr) : ts(TimeSpanType::FromNanoSeconds(0)) { AMS_UNUSED(z); /* ... */ }
|
||||||
constexpr ALWAYS_INLINE TimeSpan(const TimeSpanType &t) : ts(t) { /* ... */ }
|
constexpr ALWAYS_INLINE TimeSpan(const TimeSpanType &t) : ts(t) { /* ... */ }
|
||||||
|
|
||||||
template<typename R, typename P>
|
template<typename R, typename P>
|
||||||
|
|
|
@ -267,12 +267,14 @@ namespace ams::util {
|
||||||
}
|
}
|
||||||
|
|
||||||
void splice(const_iterator pos, IntrusiveListImpl &o, const_iterator first) {
|
void splice(const_iterator pos, IntrusiveListImpl &o, const_iterator first) {
|
||||||
|
AMS_UNUSED(o);
|
||||||
const_iterator last(first);
|
const_iterator last(first);
|
||||||
std::advance(last, 1);
|
std::advance(last, 1);
|
||||||
splice_impl(pos, first, last);
|
splice_impl(pos, first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
void splice(const_iterator pos, IntrusiveListImpl &o, const_iterator first, const_iterator last) {
|
void splice(const_iterator pos, IntrusiveListImpl &o, const_iterator first, const_iterator last) {
|
||||||
|
AMS_UNUSED(o);
|
||||||
splice_impl(pos, first, last);
|
splice_impl(pos, first, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,6 +55,7 @@ namespace ams::crypto::impl {
|
||||||
|
|
||||||
size_t XtsModeImpl::FinalizeEncryption(void *dst, size_t dst_size) {
|
size_t XtsModeImpl::FinalizeEncryption(void *dst, size_t dst_size) {
|
||||||
AMS_ASSERT(this->state == State_Processing);
|
AMS_ASSERT(this->state == State_Processing);
|
||||||
|
AMS_UNUSED(dst_size);
|
||||||
|
|
||||||
u8 *dst_u8 = static_cast<u8 *>(dst);
|
u8 *dst_u8 = static_cast<u8 *>(dst);
|
||||||
size_t processed = 0;
|
size_t processed = 0;
|
||||||
|
@ -80,6 +81,7 @@ namespace ams::crypto::impl {
|
||||||
|
|
||||||
size_t XtsModeImpl::FinalizeDecryption(void *dst, size_t dst_size) {
|
size_t XtsModeImpl::FinalizeDecryption(void *dst, size_t dst_size) {
|
||||||
AMS_ASSERT(this->state == State_Processing);
|
AMS_ASSERT(this->state == State_Processing);
|
||||||
|
AMS_UNUSED(dst_size);
|
||||||
|
|
||||||
u8 *dst_u8 = static_cast<u8 *>(dst);
|
u8 *dst_u8 = static_cast<u8 *>(dst);
|
||||||
size_t processed = 0;
|
size_t processed = 0;
|
||||||
|
@ -131,6 +133,8 @@ namespace ams::crypto::impl {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t XtsModeImpl::ProcessRemainingData(u8 *dst, const u8 *src, size_t size) {
|
size_t XtsModeImpl::ProcessRemainingData(u8 *dst, const u8 *src, size_t size) {
|
||||||
|
AMS_UNUSED(dst);
|
||||||
|
|
||||||
std::memcpy(this->buffer, src, size);
|
std::memcpy(this->buffer, src, size);
|
||||||
this->num_buffered = size;
|
this->num_buffered = size;
|
||||||
|
|
||||||
|
|
|
@ -357,6 +357,7 @@ namespace ams::kern::init {
|
||||||
case ID: \
|
case ID: \
|
||||||
cpu::SetDbgWcr##ID##El1(__VA_ARGS__); \
|
cpu::SetDbgWcr##ID##El1(__VA_ARGS__); \
|
||||||
cpu::SetDbgWvr##ID##El1(__VA_ARGS__); \
|
cpu::SetDbgWvr##ID##El1(__VA_ARGS__); \
|
||||||
|
[[fallthrough]];
|
||||||
|
|
||||||
#define MESOSPHERE_INITIALIZE_BREAKPOINT_CASE(ID, ...) \
|
#define MESOSPHERE_INITIALIZE_BREAKPOINT_CASE(ID, ...) \
|
||||||
case ID: \
|
case ID: \
|
||||||
|
|
Loading…
Reference in a new issue