general: Replace RESULT_SUCCESS with ResultSuccess

Transition to PascalCase for result names.
This commit is contained in:
Morph 2021-05-21 01:05:04 -04:00
parent 377cd301b3
commit 12c1766997
113 changed files with 930 additions and 933 deletions

View file

@ -169,12 +169,12 @@ ResultCode HLERequestContext::PopulateFromIncomingCommandBuffer(const KHandleTab
if (command_header->IsCloseCommand()) {
// Close does not populate the rest of the IPC header
return RESULT_SUCCESS;
return ResultSuccess;
}
std::copy_n(src_cmdbuf, IPC::COMMAND_BUFFER_LENGTH, cmd_buf.begin());
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_thread) {
@ -216,7 +216,7 @@ ResultCode HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_t
memory.WriteBlock(owner_process, requesting_thread.GetTLSAddress(), cmd_buf.data(),
write_size * sizeof(u32));
return RESULT_SUCCESS;
return ResultSuccess;
}
std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const {

View file

@ -97,7 +97,7 @@ ResultCode KAddressArbiter::Signal(VAddr addr, s32 count) {
while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) &&
(it->GetAddressArbiterKey() == addr)) {
KThread* target_thread = std::addressof(*it);
target_thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
target_thread->SetSyncedObject(nullptr, ResultSuccess);
ASSERT(target_thread->IsWaitingForAddressArbiter());
target_thread->Wakeup();
@ -107,7 +107,7 @@ ResultCode KAddressArbiter::Signal(VAddr addr, s32 count) {
++num_waiters;
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32 count) {
@ -130,7 +130,7 @@ ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32
while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) &&
(it->GetAddressArbiterKey() == addr)) {
KThread* target_thread = std::addressof(*it);
target_thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
target_thread->SetSyncedObject(nullptr, ResultSuccess);
ASSERT(target_thread->IsWaitingForAddressArbiter());
target_thread->Wakeup();
@ -140,7 +140,7 @@ ResultCode KAddressArbiter::SignalAndIncrementIfEqual(VAddr addr, s32 value, s32
++num_waiters;
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32 value, s32 count) {
@ -198,7 +198,7 @@ ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32
while ((it != thread_tree.end()) && (count <= 0 || num_waiters < count) &&
(it->GetAddressArbiterKey() == addr)) {
KThread* target_thread = std::addressof(*it);
target_thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
target_thread->SetSyncedObject(nullptr, ResultSuccess);
ASSERT(target_thread->IsWaitingForAddressArbiter());
target_thread->Wakeup();
@ -208,7 +208,7 @@ ResultCode KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(VAddr addr, s32
++num_waiters;
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KAddressArbiter::WaitIfLessThan(VAddr addr, s32 value, bool decrement, s64 timeout) {

View file

@ -119,7 +119,7 @@ ResultCode KClientPort::CreateSession(KClientSession** out) {
// We succeeded, so set the output.
session_guard.Cancel();
*out = std::addressof(session->GetClientSession());
return RESULT_SUCCESS;
return ResultSuccess;
}
} // namespace Kernel

View file

@ -86,7 +86,7 @@ ResultCode KConditionVariable::SignalToAddress(VAddr addr) {
next_value |= Svc::HandleWaitMask;
}
next_owner_thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
next_owner_thread->SetSyncedObject(nullptr, ResultSuccess);
next_owner_thread->Wakeup();
}
@ -100,7 +100,7 @@ ResultCode KConditionVariable::SignalToAddress(VAddr addr) {
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KConditionVariable::WaitForAddress(Handle handle, VAddr addr, u32 value) {
@ -112,7 +112,7 @@ ResultCode KConditionVariable::WaitForAddress(Handle handle, VAddr addr, u32 val
ASSERT(owner_thread.IsNull());
{
KScopedSchedulerLock sl(kernel);
cur_thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
cur_thread->SetSyncedObject(nullptr, ResultSuccess);
// Check if the thread should terminate.
R_UNLESS(!cur_thread->IsTerminationRequested(), ResultTerminationRequested);
@ -124,7 +124,7 @@ ResultCode KConditionVariable::WaitForAddress(Handle handle, VAddr addr, u32 val
ResultInvalidCurrentMemory);
// If the tag isn't the handle (with wait mask), we're done.
R_UNLESS(test_tag == (handle | Svc::HandleWaitMask), RESULT_SUCCESS);
R_UNLESS(test_tag == (handle | Svc::HandleWaitMask), ResultSuccess);
// Get the lock owner thread.
owner_thread =
@ -181,7 +181,7 @@ KThread* KConditionVariable::SignalImpl(KThread* thread) {
if (can_access) {
if (prev_tag == Svc::InvalidHandle) {
// If nobody held the lock previously, we're all good.
thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
thread->SetSyncedObject(nullptr, ResultSuccess);
thread->Wakeup();
} else {
// Get the previous owner.
@ -292,7 +292,7 @@ ResultCode KConditionVariable::Wait(VAddr addr, u64 key, u32 value, s64 timeout)
}
// Wake up the next owner.
next_owner_thread->SetSyncedObject(nullptr, RESULT_SUCCESS);
next_owner_thread->SetSyncedObject(nullptr, ResultSuccess);
next_owner_thread->Wakeup();
}

View file

@ -25,7 +25,7 @@ ResultCode KHandleTable::Finalize() {
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
bool KHandleTable::Remove(Handle handle) {
@ -79,7 +79,7 @@ ResultCode KHandleTable::Add(Handle* out_handle, KAutoObject* obj, u16 type) {
*out_handle = EncodeHandle(static_cast<u16>(index), linear_id);
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KHandleTable::Reserve(Handle* out_handle) {
@ -89,7 +89,7 @@ ResultCode KHandleTable::Reserve(Handle* out_handle) {
R_UNLESS(m_count < m_table_size, ResultOutOfHandles);
*out_handle = EncodeHandle(static_cast<u16>(this->AllocateEntry()), this->AllocateLinearId());
return RESULT_SUCCESS;
return ResultSuccess;
}
void KHandleTable::Unreserve(Handle handle) {

View file

@ -50,7 +50,7 @@ public:
m_free_head_index = i;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
size_t GetTableSize() const {

View file

@ -86,7 +86,7 @@ ResultCode KMemoryManager::Allocate(KPageLinkedList& page_list, std::size_t num_
// Early return if we're allocating no pages
if (num_pages == 0) {
return RESULT_SUCCESS;
return ResultSuccess;
}
// Lock the pool that we're allocating from
@ -146,14 +146,14 @@ ResultCode KMemoryManager::Allocate(KPageLinkedList& page_list, std::size_t num_
// We succeeded!
group_guard.Cancel();
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KMemoryManager::Free(KPageLinkedList& page_list, std::size_t num_pages, Pool pool,
Direction dir) {
// Early return if we're freeing no pages
if (!num_pages) {
return RESULT_SUCCESS;
return ResultSuccess;
}
// Lock the pool that we're freeing from
@ -170,7 +170,7 @@ ResultCode KMemoryManager::Free(KPageLinkedList& page_list, std::size_t num_page
chosen_manager.Free(it.GetAddress(), min_num_pages);
}
return RESULT_SUCCESS;
return ResultSuccess;
}
std::size_t KMemoryManager::Impl::CalculateManagementOverheadSize(std::size_t region_size) {

View file

@ -71,7 +71,7 @@ public:
ResultCode AddBlock(u64 address, u64 num_pages) {
if (!num_pages) {
return RESULT_SUCCESS;
return ResultSuccess;
}
if (!nodes.empty()) {
const auto node = nodes.back();
@ -82,7 +82,7 @@ public:
}
}
nodes.push_back({address, num_pages});
return RESULT_SUCCESS;
return ResultSuccess;
}
private:

View file

@ -292,7 +292,7 @@ ResultCode KPageTable::MapProcessCode(VAddr addr, std::size_t num_pages, KMemory
block_manager->Update(addr, num_pages, state, perm);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::MapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size) {
@ -329,14 +329,14 @@ ResultCode KPageTable::MapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std:
KMemoryAttribute::Locked);
block_manager->Update(dst_addr, num_pages, KMemoryState::AliasCode);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::UnmapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, std::size_t size) {
std::lock_guard lock{page_table_lock};
if (!size) {
return RESULT_SUCCESS;
return ResultSuccess;
}
const std::size_t num_pages{size / PageSize};
@ -360,7 +360,7 @@ ResultCode KPageTable::UnmapProcessCodeMemory(VAddr dst_addr, VAddr src_addr, st
block_manager->Update(src_addr, num_pages, KMemoryState::Normal,
KMemoryPermission::ReadAndWrite);
return RESULT_SUCCESS;
return ResultSuccess;
}
void KPageTable::MapPhysicalMemory(KPageLinkedList& page_linked_list, VAddr start, VAddr end) {
@ -408,7 +408,7 @@ ResultCode KPageTable::MapPhysicalMemory(VAddr addr, std::size_t size) {
});
if (mapped_size == size) {
return RESULT_SUCCESS;
return ResultSuccess;
}
const std::size_t remaining_size{size - mapped_size};
@ -440,14 +440,14 @@ ResultCode KPageTable::MapPhysicalMemory(VAddr addr, std::size_t size) {
KMemoryAttribute::None, KMemoryState::Normal,
KMemoryPermission::ReadAndWrite, KMemoryAttribute::None);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::UnmapPhysicalMemory(VAddr addr, std::size_t size) {
std::lock_guard lock{page_table_lock};
const VAddr end_addr{addr + size};
ResultCode result{RESULT_SUCCESS};
ResultCode result{ResultSuccess};
std::size_t mapped_size{};
// Verify that the region can be unmapped
@ -468,7 +468,7 @@ ResultCode KPageTable::UnmapPhysicalMemory(VAddr addr, std::size_t size) {
}
if (!mapped_size) {
return RESULT_SUCCESS;
return ResultSuccess;
}
CASCADE_CODE(UnmapMemory(addr, size));
@ -477,14 +477,14 @@ ResultCode KPageTable::UnmapPhysicalMemory(VAddr addr, std::size_t size) {
process->GetResourceLimit()->Release(LimitableResource::PhysicalMemory, mapped_size);
physical_memory_usage -= mapped_size;
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::UnmapMemory(VAddr addr, std::size_t size) {
std::lock_guard lock{page_table_lock};
const VAddr end_addr{addr + size};
ResultCode result{RESULT_SUCCESS};
ResultCode result{ResultSuccess};
KPageLinkedList page_linked_list;
// Unmap each region within the range
@ -513,7 +513,7 @@ ResultCode KPageTable::UnmapMemory(VAddr addr, std::size_t size) {
block_manager->Update(addr, num_pages, KMemoryState::Free);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::Map(VAddr dst_addr, VAddr src_addr, std::size_t size) {
@ -552,7 +552,7 @@ ResultCode KPageTable::Map(VAddr dst_addr, VAddr src_addr, std::size_t size) {
block_manager->Update(dst_addr, num_pages, KMemoryState::Stack,
KMemoryPermission::ReadAndWrite);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::Unmap(VAddr dst_addr, VAddr src_addr, std::size_t size) {
@ -594,7 +594,7 @@ ResultCode KPageTable::Unmap(VAddr dst_addr, VAddr src_addr, std::size_t size) {
block_manager->Update(src_addr, num_pages, src_state, KMemoryPermission::ReadAndWrite);
block_manager->Update(dst_addr, num_pages, KMemoryState::Free);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::MapPages(VAddr addr, const KPageLinkedList& page_linked_list,
@ -616,7 +616,7 @@ ResultCode KPageTable::MapPages(VAddr addr, const KPageLinkedList& page_linked_l
cur_addr += node.GetNumPages() * PageSize;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::MapPages(VAddr addr, KPageLinkedList& page_linked_list, KMemoryState state,
@ -638,7 +638,7 @@ ResultCode KPageTable::MapPages(VAddr addr, KPageLinkedList& page_linked_list, K
block_manager->Update(addr, num_pages, state, perm);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::UnmapPages(VAddr addr, const KPageLinkedList& page_linked_list) {
@ -655,7 +655,7 @@ ResultCode KPageTable::UnmapPages(VAddr addr, const KPageLinkedList& page_linked
cur_addr += node.GetNumPages() * PageSize;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::UnmapPages(VAddr addr, KPageLinkedList& page_linked_list,
@ -677,7 +677,7 @@ ResultCode KPageTable::UnmapPages(VAddr addr, KPageLinkedList& page_linked_list,
block_manager->Update(addr, num_pages, state, KMemoryPermission::None);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::SetCodeMemoryPermission(VAddr addr, std::size_t size,
@ -708,7 +708,7 @@ ResultCode KPageTable::SetCodeMemoryPermission(VAddr addr, std::size_t size,
// Return early if there is nothing to change
if (state == prev_state && perm == prev_perm) {
return RESULT_SUCCESS;
return ResultSuccess;
}
if ((prev_perm & KMemoryPermission::Execute) != (perm & KMemoryPermission::Execute)) {
@ -725,7 +725,7 @@ ResultCode KPageTable::SetCodeMemoryPermission(VAddr addr, std::size_t size,
block_manager->Update(addr, num_pages, state, perm);
return RESULT_SUCCESS;
return ResultSuccess;
}
KMemoryInfo KPageTable::QueryInfoImpl(VAddr addr) {
@ -758,7 +758,7 @@ ResultCode KPageTable::ReserveTransferMemory(VAddr addr, std::size_t size, KMemo
block_manager->Update(addr, size / PageSize, state, perm, attribute | KMemoryAttribute::Locked);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::ResetTransferMemory(VAddr addr, std::size_t size) {
@ -775,7 +775,7 @@ ResultCode KPageTable::ResetTransferMemory(VAddr addr, std::size_t size) {
block_manager->Update(addr, size / PageSize, state, KMemoryPermission::ReadAndWrite);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::SetMemoryAttribute(VAddr addr, std::size_t size, KMemoryAttribute mask,
@ -797,13 +797,13 @@ ResultCode KPageTable::SetMemoryAttribute(VAddr addr, std::size_t size, KMemoryA
block_manager->Update(addr, size / PageSize, state, perm, attribute);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::SetHeapCapacity(std::size_t new_heap_capacity) {
std::lock_guard lock{page_table_lock};
heap_capacity = new_heap_capacity;
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultVal<VAddr> KPageTable::SetHeapSize(std::size_t size) {
@ -911,7 +911,7 @@ ResultCode KPageTable::LockForDeviceAddressSpace(VAddr addr, std::size_t size) {
},
perm);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::UnlockForDeviceAddressSpace(VAddr addr, std::size_t size) {
@ -934,13 +934,13 @@ ResultCode KPageTable::UnlockForDeviceAddressSpace(VAddr addr, std::size_t size)
},
perm);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::InitializeMemoryLayout(VAddr start, VAddr end) {
block_manager = std::make_unique<KMemoryBlockManager>(start, end);
return RESULT_SUCCESS;
return ResultSuccess;
}
bool KPageTable::IsRegionMapped(VAddr address, u64 size) {
@ -1006,7 +1006,7 @@ ResultCode KPageTable::Operate(VAddr addr, std::size_t num_pages, const KPageLin
addr += size;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::Operate(VAddr addr, std::size_t num_pages, KMemoryPermission perm,
@ -1033,7 +1033,7 @@ ResultCode KPageTable::Operate(VAddr addr, std::size_t num_pages, KMemoryPermiss
default:
UNREACHABLE();
}
return RESULT_SUCCESS;
return ResultSuccess;
}
constexpr VAddr KPageTable::GetRegionAddress(KMemoryState state) const {
@ -1164,7 +1164,7 @@ constexpr ResultCode KPageTable::CheckMemoryState(const KMemoryInfo& info, KMemo
return ResultInvalidCurrentMemory;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KPageTable::CheckMemoryState(KMemoryState* out_state, KMemoryPermission* out_perm,
@ -1223,7 +1223,7 @@ ResultCode KPageTable::CheckMemoryState(KMemoryState* out_state, KMemoryPermissi
*out_attr = first_attr & static_cast<KMemoryAttribute>(~ignore_attr);
}
return RESULT_SUCCESS;
return ResultSuccess;
}
} // namespace Kernel

View file

@ -59,7 +59,7 @@ ResultCode KPort::EnqueueSession(KServerSession* session) {
server.EnqueueSession(session);
server.GetSessionRequestHandler()->ClientConnected(server.AcceptSession());
return RESULT_SUCCESS;
return ResultSuccess;
}
} // namespace Kernel

View file

@ -142,7 +142,7 @@ ResultCode KProcess::Initialize(KProcess* process, Core::System& system, std::st
// Open a reference to the resource limit.
process->resource_limit->Open();
return RESULT_SUCCESS;
return ResultSuccess;
}
KResourceLimit* KProcess::GetResourceLimit() const {
@ -258,7 +258,7 @@ ResultCode KProcess::AddSharedMemory(KSharedMemory* shmem, [[maybe_unused]] VAdd
// Open a reference to the shared memory.
shmem->Open();
return RESULT_SUCCESS;
return ResultSuccess;
}
void KProcess::RemoveSharedMemory(KSharedMemory* shmem, [[maybe_unused]] VAddr address,
@ -291,7 +291,7 @@ ResultCode KProcess::Reset() {
// Clear signaled.
is_signaled = false;
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata,
@ -524,7 +524,7 @@ ResultCode KProcess::AllocateMainThreadStack(std::size_t stack_size) {
main_thread_stack_top += main_thread_stack_size;
return RESULT_SUCCESS;
return ResultSuccess;
}
} // namespace Kernel

View file

@ -310,7 +310,7 @@ public:
*
* @param metadata The provided metadata to load process specific info from.
*
* @returns RESULT_SUCCESS if all relevant metadata was able to be
* @returns ResultSuccess if all relevant metadata was able to be
* loaded and parsed. Otherwise, an error code is returned.
*/
ResultCode LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std::size_t code_size);

View file

@ -36,13 +36,13 @@ ResultCode KReadableEvent::Signal() {
NotifyAvailable();
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KReadableEvent::Clear() {
Reset();
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KReadableEvent::Reset() {
@ -53,7 +53,7 @@ ResultCode KReadableEvent::Reset() {
}
is_signaled = false;
return RESULT_SUCCESS;
return ResultSuccess;
}
} // namespace Kernel

View file

@ -80,7 +80,7 @@ ResultCode KResourceLimit::SetLimitValue(LimitableResource which, s64 value) {
limit_values[index] = value;
return RESULT_SUCCESS;
return ResultSuccess;
}
bool KResourceLimit::Reserve(LimitableResource which, s64 value) {

View file

@ -71,7 +71,7 @@ std::size_t KServerSession::NumDomainRequestHandlers() const {
ResultCode KServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& context) {
if (!context.HasDomainMessageHeader()) {
return RESULT_SUCCESS;
return ResultSuccess;
}
// Set domain handlers in HLE context, used for domain objects (IPC interfaces) as inputs
@ -88,7 +88,7 @@ ResultCode KServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& co
"to {} needed to return a new interface!",
object_id, name);
UNREACHABLE();
return RESULT_SUCCESS; // Ignore error if asserts are off
return ResultSuccess; // Ignore error if asserts are off
}
return manager->DomainHandler(object_id - 1)->HandleSyncRequest(*this, context);
@ -98,14 +98,14 @@ ResultCode KServerSession::HandleDomainSyncRequest(Kernel::HLERequestContext& co
manager->CloseDomainHandler(object_id - 1);
IPC::ResponseBuilder rb{context, 2};
rb.Push(RESULT_SUCCESS);
return RESULT_SUCCESS;
rb.Push(ResultSuccess);
return ResultSuccess;
}
}
LOG_CRITICAL(IPC, "Unknown domain command={}", domain_message_header.command.Value());
ASSERT(false);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KServerSession::QueueSyncRequest(KThread* thread, Core::Memory::Memory& memory) {
@ -116,14 +116,14 @@ ResultCode KServerSession::QueueSyncRequest(KThread* thread, Core::Memory::Memor
if (auto strong_ptr = service_thread.lock()) {
strong_ptr->QueueSyncRequest(*parent, std::move(context));
return RESULT_SUCCESS;
return ResultSuccess;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KServerSession::CompleteSyncRequest(HLERequestContext& context) {
ResultCode result = RESULT_SUCCESS;
ResultCode result = ResultSuccess;
// If the session has been converted to a domain, handle the domain request
if (IsDomain() && context.HasDomainMessageHeader()) {
result = HandleDomainSyncRequest(context);

View file

@ -55,7 +55,7 @@ ResultCode KSharedMemory::Initialize(Core::DeviceMemory& device_memory_, KProces
// Clear all pages in the memory.
std::memset(device_memory_.GetPointer(physical_address_), 0, size_);
return RESULT_SUCCESS;
return ResultSuccess;
}
void KSharedMemory::Finalize() {

View file

@ -38,7 +38,7 @@ ResultCode KSynchronizationObject::Wait(KernelCore& kernel_ctx, s32* out_index,
if (objects[i]->IsSignaled()) {
*out_index = i;
slp.CancelSleep();
return RESULT_SUCCESS;
return ResultSuccess;
}
}
@ -97,7 +97,7 @@ ResultCode KSynchronizationObject::Wait(KernelCore& kernel_ctx, s32* out_index,
kernel_ctx.TimeManager().UnscheduleTimeEvent(thread);
// Get the wait result.
ResultCode wait_result{RESULT_SUCCESS};
ResultCode wait_result{ResultSuccess};
s32 sync_index = -1;
{
KScopedSchedulerLock lock(kernel_ctx);

View file

@ -43,7 +43,7 @@ protected:
void NotifyAvailable(ResultCode result);
void NotifyAvailable() {
return this->NotifyAvailable(RESULT_SUCCESS);
return this->NotifyAvailable(ResultSuccess);
}
private:

View file

@ -205,7 +205,7 @@ ResultCode KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_s
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uintptr_t arg,
@ -219,7 +219,7 @@ ResultCode KThread::InitializeThread(KThread* thread, KThreadFunction func, uint
thread->host_context =
std::make_shared<Common::Fiber>(std::move(init_func), init_func_parameter);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KThread::InitializeDummyThread(KThread* thread) {
@ -460,7 +460,7 @@ ResultCode KThread::GetCoreMask(s32* out_ideal_core, u64* out_affinity_mask) {
*out_ideal_core = virtual_ideal_core_id;
*out_affinity_mask = virtual_affinity_mask;
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KThread::GetPhysicalCoreMask(s32* out_ideal_core, u64* out_affinity_mask) {
@ -476,7 +476,7 @@ ResultCode KThread::GetPhysicalCoreMask(s32* out_ideal_core, u64* out_affinity_m
*out_affinity_mask = original_physical_affinity_mask.GetAffinityMask();
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KThread::SetCoreMask(s32 cpu_core_id, u64 v_affinity_mask) {
@ -599,7 +599,7 @@ ResultCode KThread::SetCoreMask(s32 cpu_core_id, u64 v_affinity_mask) {
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
void KThread::SetBasePriority(s32 value) {
@ -778,7 +778,7 @@ ResultCode KThread::SetActivity(Svc::ThreadActivity activity) {
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode KThread::GetThreadContext3(std::vector<u8>& out) {
@ -813,7 +813,7 @@ ResultCode KThread::GetThreadContext3(std::vector<u8>& out) {
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
void KThread::AddWaiterImpl(KThread* thread) {
@ -970,7 +970,7 @@ ResultCode KThread::Run() {
// Set our state and finish.
SetState(ThreadState::Runnable);
return RESULT_SUCCESS;
return ResultSuccess;
}
}
@ -1020,7 +1020,7 @@ ResultCode KThread::Sleep(s64 timeout) {
// Cancel the timer.
kernel.TimeManager().UnscheduleTimeEvent(this);
return RESULT_SUCCESS;
return ResultSuccess;
}
void KThread::SetState(ThreadState state) {

View file

@ -684,7 +684,7 @@ private:
u32 address_key_value{};
u32 suspend_request_flags{};
u32 suspend_allowed_flags{};
ResultCode wait_result{RESULT_SUCCESS};
ResultCode wait_result{ResultSuccess};
s32 base_priority{};
s32 physical_ideal_core_id{};
s32 virtual_ideal_core_id{};

View file

@ -28,7 +28,7 @@ ResultCode KTransferMemory::Initialize(VAddr address_, std::size_t size_,
size = size_;
is_initialized = true;
return RESULT_SUCCESS;
return ResultSuccess;
}
void KTransferMemory::Finalize() {

View file

@ -153,7 +153,7 @@ ResultCode ProcessCapabilities::ParseCapabilities(const u32* capabilities,
}
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& set_svc_bits,
@ -167,7 +167,7 @@ ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& s
// Bail early on ignorable entries, as one would expect,
// ignorable descriptors can be ignored.
if (type == CapabilityType::Ignorable) {
return RESULT_SUCCESS;
return ResultSuccess;
}
// Ensure that the give flag hasn't already been initialized before.
@ -264,7 +264,7 @@ ResultCode ProcessCapabilities::HandlePriorityCoreNumFlags(u32 flags) {
core_mask = make_mask(core_num_min, core_num_max);
priority_mask = make_mask(priority_min, priority_max);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleSyscallFlags(u32& set_svc_bits, u32 flags) {
@ -288,23 +288,23 @@ ResultCode ProcessCapabilities::HandleSyscallFlags(u32& set_svc_bits, u32 flags)
svc_capabilities[svc_number] = true;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleMapPhysicalFlags(u32 flags, u32 size_flags,
KPageTable& page_table) {
// TODO(Lioncache): Implement once the memory manager can handle this.
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleMapIOFlags(u32 flags, KPageTable& page_table) {
// TODO(Lioncache): Implement once the memory manager can handle this.
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleMapRegionFlags(u32 flags, KPageTable& page_table) {
// TODO(Lioncache): Implement once the memory manager can handle this.
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleInterruptFlags(u32 flags) {
@ -331,7 +331,7 @@ ResultCode ProcessCapabilities::HandleInterruptFlags(u32 flags) {
interrupt_capabilities[interrupt] = true;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleProgramTypeFlags(u32 flags) {
@ -342,7 +342,7 @@ ResultCode ProcessCapabilities::HandleProgramTypeFlags(u32 flags) {
}
program_type = static_cast<ProgramType>((flags >> 14) & 0b111);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleKernelVersionFlags(u32 flags) {
@ -362,7 +362,7 @@ ResultCode ProcessCapabilities::HandleKernelVersionFlags(u32 flags) {
}
kernel_version = flags;
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleHandleTableFlags(u32 flags) {
@ -373,7 +373,7 @@ ResultCode ProcessCapabilities::HandleHandleTableFlags(u32 flags) {
}
handle_table_size = static_cast<s32>((flags >> 16) & 0x3FF);
return RESULT_SUCCESS;
return ResultSuccess;
}
ResultCode ProcessCapabilities::HandleDebugFlags(u32 flags) {
@ -385,7 +385,7 @@ ResultCode ProcessCapabilities::HandleDebugFlags(u32 flags) {
is_debuggable = (flags & 0x20000) != 0;
can_force_debug = (flags & 0x40000) != 0;
return RESULT_SUCCESS;
return ResultSuccess;
}
} // namespace Kernel

View file

@ -84,7 +84,7 @@ public:
/// @param page_table The memory manager to use for handling any mapping-related
/// operations (such as mapping IO memory, etc).
///
/// @returns RESULT_SUCCESS if this capabilities instance was able to be initialized,
/// @returns ResultSuccess if this capabilities instance was able to be initialized,
/// otherwise, an error code upon failure.
///
ResultCode InitializeForKernelProcess(const u32* capabilities, std::size_t num_capabilities,
@ -97,7 +97,7 @@ public:
/// @param page_table The memory manager to use for handling any mapping-related
/// operations (such as mapping IO memory, etc).
///
/// @returns RESULT_SUCCESS if this capabilities instance was able to be initialized,
/// @returns ResultSuccess if this capabilities instance was able to be initialized,
/// otherwise, an error code upon failure.
///
ResultCode InitializeForUserProcess(const u32* capabilities, std::size_t num_capabilities,
@ -184,7 +184,7 @@ private:
/// @param page_table The memory manager that will perform any memory
/// mapping if necessary.
///
/// @return RESULT_SUCCESS if no errors occur, otherwise an error code.
/// @return ResultSuccess if no errors occur, otherwise an error code.
///
ResultCode ParseCapabilities(const u32* capabilities, std::size_t num_capabilities,
KPageTable& page_table);
@ -199,7 +199,7 @@ private:
/// @param page_table The memory manager that will perform any memory
/// mapping if necessary.
///
/// @return RESULT_SUCCESS if no errors occurred, otherwise an error code.
/// @return ResultSuccess if no errors occurred, otherwise an error code.
///
ResultCode ParseSingleFlagCapability(u32& set_flags, u32& set_svc_bits, u32 flag,
KPageTable& page_table);

View file

@ -132,7 +132,7 @@ ResultCode MapUnmapMemorySanityChecks(const KPageTable& manager, VAddr dst_addr,
return ResultInvalidMemoryRegion;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
enum class ResourceLimitValueType {
@ -164,7 +164,7 @@ static ResultCode SetHeapSize(Core::System& system, VAddr* heap_addr, u64 heap_s
CASCADE_RESULT(*heap_addr, page_table.SetHeapSize(heap_size));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode SetHeapSize32(Core::System& system, u32* heap_addr, u32 heap_size) {
@ -305,7 +305,7 @@ static ResultCode ConnectToNamedPort(Core::System& system, Handle* out, VAddr po
// We succeeded.
handle_guard.Cancel();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode ConnectToNamedPort32(Core::System& system, Handle* out_handle,
@ -349,7 +349,7 @@ static ResultCode GetThreadId(Core::System& system, u64* out_thread_id, Handle t
// Get the thread's id.
*out_thread_id = thread->GetId();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetThreadId32(Core::System& system, u32* out_thread_id_low,
@ -454,7 +454,7 @@ static ResultCode CancelSynchronization(Core::System& system, Handle handle) {
// Cancel the thread's wait.
thread->WaitCancel();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode CancelSynchronization32(Core::System& system, Handle handle) {
@ -715,76 +715,76 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
switch (info_id_type) {
case GetInfoType::AllowedCPUCoreMask:
*result = process->GetCoreMask();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::AllowedThreadPriorityMask:
*result = process->GetPriorityMask();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::MapRegionBaseAddr:
*result = process->PageTable().GetAliasRegionStart();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::MapRegionSize:
*result = process->PageTable().GetAliasRegionSize();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::HeapRegionBaseAddr:
*result = process->PageTable().GetHeapRegionStart();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::HeapRegionSize:
*result = process->PageTable().GetHeapRegionSize();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::ASLRRegionBaseAddr:
*result = process->PageTable().GetAliasCodeRegionStart();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::ASLRRegionSize:
*result = process->PageTable().GetAliasCodeRegionSize();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::StackRegionBaseAddr:
*result = process->PageTable().GetStackRegionStart();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::StackRegionSize:
*result = process->PageTable().GetStackRegionSize();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::TotalPhysicalMemoryAvailable:
*result = process->GetTotalPhysicalMemoryAvailable();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::TotalPhysicalMemoryUsed:
*result = process->GetTotalPhysicalMemoryUsed();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::SystemResourceSize:
*result = process->GetSystemResourceSize();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::SystemResourceUsage:
LOG_WARNING(Kernel_SVC, "(STUBBED) Attempted to query system resource usage");
*result = process->GetSystemResourceUsage();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::TitleId:
*result = process->GetTitleID();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::UserExceptionContextAddr:
*result = process->GetTLSRegionAddress();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::TotalPhysicalMemoryAvailableWithoutSystemResource:
*result = process->GetTotalPhysicalMemoryAvailableWithoutSystemResource();
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::TotalPhysicalMemoryUsedWithoutSystemResource:
*result = process->GetTotalPhysicalMemoryUsedWithoutSystemResource();
return RESULT_SUCCESS;
return ResultSuccess;
default:
break;
@ -796,7 +796,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
case GetInfoType::IsCurrentProcessBeingDebugged:
*result = 0;
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::RegisterResourceLimit: {
if (handle != 0) {
@ -816,14 +816,14 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
if (!resource_limit) {
*result = Svc::InvalidHandle;
// Yes, the kernel considers this a successful operation.
return RESULT_SUCCESS;
return ResultSuccess;
}
Handle resource_handle{};
R_TRY(handle_table.Add(&resource_handle, resource_limit));
*result = resource_handle;
return RESULT_SUCCESS;
return ResultSuccess;
}
case GetInfoType::RandomEntropy:
@ -840,13 +840,13 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
}
*result = system.Kernel().CurrentProcess()->GetRandomEntropy(info_sub_id);
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::PrivilegedProcessId:
LOG_WARNING(Kernel_SVC,
"(STUBBED) Attempted to query privileged process id bounds, returned 0");
*result = 0;
return RESULT_SUCCESS;
return ResultSuccess;
case GetInfoType::ThreadTickCount: {
constexpr u64 num_cpus = 4;
@ -881,7 +881,7 @@ static ResultCode GetInfo(Core::System& system, u64* result, u64 info_id, Handle
}
*result = out_ticks;
return RESULT_SUCCESS;
return ResultSuccess;
}
default:
@ -1034,7 +1034,7 @@ static ResultCode SetThreadActivity(Core::System& system, Handle thread_handle,
// Set the activity.
R_TRY(thread->SetActivity(thread_activity));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode SetThreadActivity32(Core::System& system, Handle thread_handle,
@ -1094,10 +1094,10 @@ static ResultCode GetThreadContext(Core::System& system, VAddr out_context, Hand
// Copy the thread context to user space.
system.Memory().WriteBlock(out_context, context.data(), context.size());
return RESULT_SUCCESS;
return ResultSuccess;
}
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetThreadContext32(Core::System& system, u32 out_context, Handle thread_handle) {
@ -1115,7 +1115,7 @@ static ResultCode GetThreadPriority(Core::System& system, u32* out_priority, Han
// Get the thread's priority.
*out_priority = thread->GetPriority();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetThreadPriority32(Core::System& system, u32* out_priority, Handle handle) {
@ -1138,7 +1138,7 @@ static ResultCode SetThreadPriority(Core::System& system, Handle thread_handle,
// Set the thread priority.
thread->SetBasePriority(priority);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode SetThreadPriority32(Core::System& system, Handle thread_handle, u32 priority) {
@ -1207,7 +1207,7 @@ static ResultCode MapSharedMemory(Core::System& system, Handle shmem_handle, VAd
// We succeeded.
guard.Cancel();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode MapSharedMemory32(Core::System& system, Handle shmem_handle, u32 address,
@ -1240,7 +1240,7 @@ static ResultCode UnmapSharedMemory(Core::System& system, Handle shmem_handle, V
// Remove the shared memory from the process.
process.RemoveSharedMemory(shmem.GetPointerUnsafe(), address, size);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode UnmapSharedMemory32(Core::System& system, Handle shmem_handle, u32 address,
@ -1276,7 +1276,7 @@ static ResultCode QueryProcessMemory(Core::System& system, VAddr memory_info_add
// Page info appears to be currently unused by the kernel and is always set to zero.
memory.Write32(page_info_address, 0);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode QueryMemory(Core::System& system, VAddr memory_info_address,
@ -1524,7 +1524,7 @@ static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr e
// Add the thread to the handle table.
R_TRY(process.GetHandleTable().Add(out_handle, thread));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode CreateThread32(Core::System& system, Handle* out_handle, u32 priority,
@ -1547,7 +1547,7 @@ static ResultCode StartThread(Core::System& system, Handle thread_handle) {
// If we succeeded, persist a reference to the thread.
thread->Open();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode StartThread32(Core::System& system, Handle thread_handle) {
@ -1796,7 +1796,7 @@ static ResultCode CloseHandle(Core::System& system, Handle handle) {
R_UNLESS(system.Kernel().CurrentProcess()->GetHandleTable().Remove(handle),
ResultInvalidHandle);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode CloseHandle32(Core::System& system, Handle handle) {
@ -1891,7 +1891,7 @@ static ResultCode CreateTransferMemory(Core::System& system, Handle* out, VAddr
// Add the transfer memory to the handle table.
R_TRY(handle_table.Add(out, trmem));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode CreateTransferMemory32(Core::System& system, Handle* out, u32 address, u32 size,
@ -1911,7 +1911,7 @@ static ResultCode GetThreadCoreMask(Core::System& system, Handle thread_handle,
// Get the core mask.
R_TRY(thread->GetCoreMask(out_core_id, out_affinity_mask));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetThreadCoreMask32(Core::System& system, Handle thread_handle, s32* out_core_id,
@ -1952,7 +1952,7 @@ static ResultCode SetThreadCoreMask(Core::System& system, Handle thread_handle,
// Set the core mask.
R_TRY(thread->SetCoreMask(core_id, affinity_mask));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode SetThreadCoreMask32(Core::System& system, Handle thread_handle, s32 core_id,
@ -2051,7 +2051,7 @@ static ResultCode CreateEvent(Core::System& system, Handle* out_write, Handle* o
// We succeeded.
handle_guard.Cancel();
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode CreateEvent32(Core::System& system, Handle* out_write, Handle* out_read) {
@ -2081,7 +2081,7 @@ static ResultCode GetProcessInfo(Core::System& system, u64* out, Handle process_
}
*out = static_cast<u64>(process->GetStatus());
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode CreateResourceLimit(Core::System& system, Handle* out_handle) {
@ -2104,7 +2104,7 @@ static ResultCode CreateResourceLimit(Core::System& system, Handle* out_handle)
// Add the limit to the handle table.
R_TRY(kernel.CurrentProcess()->GetHandleTable().Add(out_handle, resource_limit));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetResourceLimitLimitValue(Core::System& system, u64* out_limit_value,
@ -2125,7 +2125,7 @@ static ResultCode GetResourceLimitLimitValue(Core::System& system, u64* out_limi
// Get the limit value.
*out_limit_value = resource_limit->GetLimitValue(which);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetResourceLimitCurrentValue(Core::System& system, u64* out_current_value,
@ -2146,7 +2146,7 @@ static ResultCode GetResourceLimitCurrentValue(Core::System& system, u64* out_cu
// Get the current value.
*out_current_value = resource_limit->GetCurrentValue(which);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_handle,
@ -2166,7 +2166,7 @@ static ResultCode SetResourceLimitLimitValue(Core::System& system, Handle resour
// Set the limit value.
R_TRY(resource_limit->SetLimitValue(which, limit_value));
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetProcessList(Core::System& system, u32* out_num_processes,
@ -2203,7 +2203,7 @@ static ResultCode GetProcessList(Core::System& system, u32* out_num_processes,
}
*out_num_processes = static_cast<u32>(num_processes);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode GetThreadList(Core::System& system, u32* out_num_threads, VAddr out_thread_ids,
@ -2243,7 +2243,7 @@ static ResultCode GetThreadList(Core::System& system, u32* out_num_threads, VAdd
}
*out_num_threads = static_cast<u32>(num_threads);
return RESULT_SUCCESS;
return ResultSuccess;
}
static ResultCode FlushProcessDataCache32([[maybe_unused]] Core::System& system,
@ -2253,7 +2253,7 @@ static ResultCode FlushProcessDataCache32([[maybe_unused]] Core::System& system,
// as all emulation is done in the same cache level in host architecture, thus data cache
// does not need flushing.
LOG_DEBUG(Kernel_SVC, "called");
return RESULT_SUCCESS;
return ResultSuccess;
}
namespace {