aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle')
-rw-r--r--src/core/hle/kernel/resource_limit.h8
-rw-r--r--src/core/hle/kernel/semaphore.cpp2
-rw-r--r--src/core/hle/kernel/thread.cpp8
-rw-r--r--src/core/hle/kernel/thread.h2
-rw-r--r--src/core/hle/kernel/timer.cpp2
-rw-r--r--src/core/hle/kernel/vm_manager.cpp245
-rw-r--r--src/core/hle/kernel/vm_manager.h200
-rw-r--r--src/core/hle/service/apt/apt.cpp4
-rw-r--r--src/core/hle/service/apt/apt.h8
-rw-r--r--src/core/hle/service/boss_p.h2
-rw-r--r--src/core/hle/service/boss_u.h2
-rw-r--r--src/core/hle/service/cam_u.cpp2
-rw-r--r--src/core/hle/service/cfg/cfg.cpp4
-rw-r--r--src/core/hle/service/fs/archive.cpp6
-rw-r--r--src/core/hle/service/fs/fs_user.cpp6
-rw-r--r--src/core/hle/service/gsp_gpu.cpp24
-rw-r--r--src/core/hle/service/hid/hid.cpp2
-rw-r--r--src/core/hle/service/hid/hid_spvr.cpp2
-rw-r--r--src/core/hle/service/hid/hid_user.h2
-rw-r--r--src/core/hle/service/ptm/ptm.h6
-rw-r--r--src/core/hle/service/ptm/ptm_play.cpp2
-rw-r--r--src/core/hle/service/service.cpp2
-rw-r--r--src/core/hle/service/soc_u.cpp30
-rw-r--r--src/core/hle/svc.cpp4
24 files changed, 510 insertions, 65 deletions
diff --git a/src/core/hle/kernel/resource_limit.h b/src/core/hle/kernel/resource_limit.h
index 201ec0db9..1b8249c74 100644
--- a/src/core/hle/kernel/resource_limit.h
+++ b/src/core/hle/kernel/resource_limit.h
@@ -81,13 +81,13 @@ public:
s32 max_timers = 0;
s32 max_shared_mems = 0;
s32 max_address_arbiters = 0;
-
+
/// Max CPU time that the processes in this category can utilize
s32 max_cpu_time = 0;
- // TODO(Subv): Increment these in their respective Kernel::T::Create functions, keeping in mind that
- // APPLICATION resource limits should not be affected by the objects created by service modules.
- // Currently we have no way of distinguishing if a Create was called by the running application,
+ // TODO(Subv): Increment these in their respective Kernel::T::Create functions, keeping in mind that
+ // APPLICATION resource limits should not be affected by the objects created by service modules.
+ // Currently we have no way of distinguishing if a Create was called by the running application,
// or by a service module. Approach this once we have separated the service modules into their own processes
/// Current memory that the processes in this category are using
diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp
index dbb4c9b7f..96d61ed3a 100644
--- a/src/core/hle/kernel/semaphore.cpp
+++ b/src/core/hle/kernel/semaphore.cpp
@@ -42,7 +42,7 @@ void Semaphore::Acquire() {
ResultVal<s32> Semaphore::Release(s32 release_count) {
if (max_count - available_count < release_count)
- return ResultCode(ErrorDescription::OutOfRange, ErrorModule::Kernel,
+ return ResultCode(ErrorDescription::OutOfRange, ErrorModule::Kernel,
ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
s32 previous_count = available_count;
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 690d33b55..22c795ad4 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -100,7 +100,7 @@ void Thread::Stop() {
}
status = THREADSTATUS_DEAD;
-
+
WakeupAllWaitingThreads();
// Clean up any dangling references in objects that this thread was waiting for
@@ -169,7 +169,7 @@ static void PriorityBoostStarvedThreads() {
}
}
-/**
+/**
* Switches the CPU's active thread context to that of the specified thread
* @param new_thread The thread to switch to
*/
@@ -353,7 +353,7 @@ void Thread::ResumeFromWait() {
GetObjectId());
return;
}
-
+
ready_queue.push_back(current_priority, this);
status = THREADSTATUS_READY;
}
@@ -504,7 +504,7 @@ void Reschedule() {
} else if (next) {
LOG_TRACE(Kernel, "context switch idle -> %u", next->GetObjectId());
}
-
+
SwitchContext(next);
}
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index 389928178..2c65419c3 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -94,7 +94,7 @@ public:
* @return The thread's ID
*/
u32 GetThreadId() const { return thread_id; }
-
+
/**
* Release an acquired wait object
* @param wait_object WaitObject to release
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp
index 25d066bf1..8aa4110a6 100644
--- a/src/core/hle/kernel/timer.cpp
+++ b/src/core/hle/kernel/timer.cpp
@@ -88,7 +88,7 @@ static void TimerCallback(u64 timer_handle, int cycles_late) {
if (timer->interval_delay != 0) {
// Reschedule the timer with the interval delay
u64 interval_microseconds = timer->interval_delay / 1000;
- CoreTiming::ScheduleEvent(usToCycles(interval_microseconds) - cycles_late,
+ CoreTiming::ScheduleEvent(usToCycles(interval_microseconds) - cycles_late,
timer_callback_event_type, timer_handle);
}
}
diff --git a/src/core/hle/kernel/vm_manager.cpp b/src/core/hle/kernel/vm_manager.cpp
new file mode 100644
index 000000000..b2dd21542
--- /dev/null
+++ b/src/core/hle/kernel/vm_manager.cpp
@@ -0,0 +1,245 @@
+// Copyright 2015 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "common/assert.h"
+
+#include "core/hle/kernel/vm_manager.h"
+#include "core/memory_setup.h"
+
+namespace Kernel {
+
+bool VirtualMemoryArea::CanBeMergedWith(const VirtualMemoryArea& next) const {
+ ASSERT(base + size == next.base);
+ if (permissions != next.permissions ||
+ meminfo_state != next.meminfo_state ||
+ type != next.type) {
+ return false;
+ }
+ if (type == VMAType::AllocatedMemoryBlock &&
+ (backing_block != next.backing_block || offset + size != next.offset)) {
+ return false;
+ }
+ if (type == VMAType::BackingMemory && backing_memory + size != next.backing_memory) {
+ return false;
+ }
+ if (type == VMAType::MMIO && paddr + size != next.paddr) {
+ return false;
+ }
+ return true;
+}
+
+VMManager::VMManager() {
+ Reset();
+}
+
+void VMManager::Reset() {
+ vma_map.clear();
+
+ // Initialize the map with a single free region covering the entire managed space.
+ VirtualMemoryArea initial_vma;
+ initial_vma.size = MAX_ADDRESS;
+ vma_map.emplace(initial_vma.base, initial_vma);
+
+ UpdatePageTableForVMA(initial_vma);
+}
+
+VMManager::VMAHandle VMManager::FindVMA(VAddr target) const {
+ return std::prev(vma_map.upper_bound(target));
+}
+
+ResultVal<VMManager::VMAHandle> VMManager::MapMemoryBlock(VAddr target,
+ std::shared_ptr<std::vector<u8>> block, u32 offset, u32 size, MemoryState state) {
+ ASSERT(block != nullptr);
+ ASSERT(offset + size <= block->size());
+
+ // This is the appropriately sized VMA that will turn into our allocation.
+ CASCADE_RESULT(VMAIter vma_handle, CarveVMA(target, size));
+ VirtualMemoryArea& final_vma = vma_handle->second;
+ ASSERT(final_vma.size == size);
+
+ final_vma.type = VMAType::AllocatedMemoryBlock;
+ final_vma.permissions = VMAPermission::ReadWrite;
+ final_vma.meminfo_state = state;
+ final_vma.backing_block = block;
+ final_vma.offset = offset;
+ UpdatePageTableForVMA(final_vma);
+
+ return MakeResult<VMAHandle>(MergeAdjacent(vma_handle));
+}
+
+ResultVal<VMManager::VMAHandle> VMManager::MapBackingMemory(VAddr target, u8 * memory, u32 size, MemoryState state) {
+ ASSERT(memory != nullptr);
+
+ // This is the appropriately sized VMA that will turn into our allocation.
+ CASCADE_RESULT(VMAIter vma_handle, CarveVMA(target, size));
+ VirtualMemoryArea& final_vma = vma_handle->second;
+ ASSERT(final_vma.size == size);
+
+ final_vma.type = VMAType::BackingMemory;
+ final_vma.permissions = VMAPermission::ReadWrite;
+ final_vma.meminfo_state = state;
+ final_vma.backing_memory = memory;
+ UpdatePageTableForVMA(final_vma);
+
+ return MakeResult<VMAHandle>(MergeAdjacent(vma_handle));
+}
+
+ResultVal<VMManager::VMAHandle> VMManager::MapMMIO(VAddr target, PAddr paddr, u32 size, MemoryState state) {
+ // This is the appropriately sized VMA that will turn into our allocation.
+ CASCADE_RESULT(VMAIter vma_handle, CarveVMA(target, size));
+ VirtualMemoryArea& final_vma = vma_handle->second;
+ ASSERT(final_vma.size == size);
+
+ final_vma.type = VMAType::MMIO;
+ final_vma.permissions = VMAPermission::ReadWrite;
+ final_vma.meminfo_state = state;
+ final_vma.paddr = paddr;
+ UpdatePageTableForVMA(final_vma);
+
+ return MakeResult<VMAHandle>(MergeAdjacent(vma_handle));
+}
+
+void VMManager::Unmap(VMAHandle vma_handle) {
+ VMAIter iter = StripIterConstness(vma_handle);
+
+ VirtualMemoryArea& vma = iter->second;
+ vma.type = VMAType::Free;
+ vma.permissions = VMAPermission::None;
+ vma.meminfo_state = MemoryState::Free;
+
+ vma.backing_block = nullptr;
+ vma.offset = 0;
+ vma.backing_memory = nullptr;
+ vma.paddr = 0;
+
+ UpdatePageTableForVMA(vma);
+
+ MergeAdjacent(iter);
+}
+
+void VMManager::Reprotect(VMAHandle vma_handle, VMAPermission new_perms) {
+ VMAIter iter = StripIterConstness(vma_handle);
+
+ VirtualMemoryArea& vma = iter->second;
+ vma.permissions = new_perms;
+ UpdatePageTableForVMA(vma);
+
+ MergeAdjacent(iter);
+}
+
+VMManager::VMAIter VMManager::StripIterConstness(const VMAHandle & iter) {
+ // This uses a neat C++ trick to convert a const_iterator to a regular iterator, given
+ // non-const access to its container.
+ return vma_map.erase(iter, iter); // Erases an empty range of elements
+}
+
+ResultVal<VMManager::VMAIter> VMManager::CarveVMA(VAddr base, u32 size) {
+ ASSERT_MSG((size & Memory::PAGE_MASK) == 0, "non-page aligned size: %8X", size);
+ ASSERT_MSG((base & Memory::PAGE_MASK) == 0, "non-page aligned base: %08X", base);
+
+ VMAIter vma_handle = StripIterConstness(FindVMA(base));
+ if (vma_handle == vma_map.end()) {
+ // Target address is outside the range managed by the kernel
+ return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::OS,
+ ErrorSummary::InvalidArgument, ErrorLevel::Usage); // 0xE0E01BF5
+ }
+
+ VirtualMemoryArea& vma = vma_handle->second;
+ if (vma.type != VMAType::Free) {
+ // Region is already allocated
+ return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::OS,
+ ErrorSummary::InvalidState, ErrorLevel::Usage); // 0xE0A01BF5
+ }
+
+ u32 start_in_vma = base - vma.base;
+ u32 end_in_vma = start_in_vma + size;
+
+ if (end_in_vma > vma.size) {
+ // Requested allocation doesn't fit inside VMA
+ return ResultCode(ErrorDescription::InvalidAddress, ErrorModule::OS,
+ ErrorSummary::InvalidState, ErrorLevel::Usage); // 0xE0A01BF5
+ }
+
+ if (end_in_vma != vma.size) {
+ // Split VMA at the end of the allocated region
+ SplitVMA(vma_handle, end_in_vma);
+ }
+ if (start_in_vma != 0) {
+ // Split VMA at the start of the allocated region
+ vma_handle = SplitVMA(vma_handle, start_in_vma);
+ }
+
+ return MakeResult<VMAIter>(vma_handle);
+}
+
+VMManager::VMAIter VMManager::SplitVMA(VMAIter vma_handle, u32 offset_in_vma) {
+ VirtualMemoryArea& old_vma = vma_handle->second;
+ VirtualMemoryArea new_vma = old_vma; // Make a copy of the VMA
+
+ // For now, don't allow no-op VMA splits (trying to split at a boundary) because it's probably
+ // a bug. This restriction might be removed later.
+ ASSERT(offset_in_vma < old_vma.size);
+ ASSERT(offset_in_vma > 0);
+
+ old_vma.size = offset_in_vma;
+ new_vma.base += offset_in_vma;
+ new_vma.size -= offset_in_vma;
+
+ switch (new_vma.type) {
+ case VMAType::Free:
+ break;
+ case VMAType::AllocatedMemoryBlock:
+ new_vma.offset += offset_in_vma;
+ break;
+ case VMAType::BackingMemory:
+ new_vma.backing_memory += offset_in_vma;
+ break;
+ case VMAType::MMIO:
+ new_vma.paddr += offset_in_vma;
+ break;
+ }
+
+ ASSERT(old_vma.CanBeMergedWith(new_vma));
+
+ return vma_map.emplace_hint(std::next(vma_handle), new_vma.base, new_vma);
+}
+
+VMManager::VMAIter VMManager::MergeAdjacent(VMAIter iter) {
+ VMAIter next_vma = std::next(iter);
+ if (next_vma != vma_map.end() && iter->second.CanBeMergedWith(next_vma->second)) {
+ iter->second.size += next_vma->second.size;
+ vma_map.erase(next_vma);
+ }
+
+ if (iter != vma_map.begin()) {
+ VMAIter prev_vma = std::prev(iter);
+ if (prev_vma->second.CanBeMergedWith(iter->second)) {
+ prev_vma->second.size += iter->second.size;
+ vma_map.erase(iter);
+ iter = prev_vma;
+ }
+ }
+
+ return iter;
+}
+
+void VMManager::UpdatePageTableForVMA(const VirtualMemoryArea& vma) {
+ switch (vma.type) {
+ case VMAType::Free:
+ Memory::UnmapRegion(vma.base, vma.size);
+ break;
+ case VMAType::AllocatedMemoryBlock:
+ Memory::MapMemoryRegion(vma.base, vma.size, vma.backing_block->data() + vma.offset);
+ break;
+ case VMAType::BackingMemory:
+ Memory::MapMemoryRegion(vma.base, vma.size, vma.backing_memory);
+ break;
+ case VMAType::MMIO:
+ // TODO(yuriks): Add support for MMIO handlers.
+ Memory::MapIoRegion(vma.base, vma.size);
+ break;
+ }
+}
+
+}
diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h
new file mode 100644
index 000000000..22b724603
--- /dev/null
+++ b/src/core/hle/kernel/vm_manager.h
@@ -0,0 +1,200 @@
+// Copyright 2015 Citra Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <map>
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "common/common_types.h"
+
+#include "core/hle/result.h"
+
+namespace Kernel {
+
+enum class VMAType : u8 {
+ /// VMA represents an unmapped region of the address space.
+ Free,
+ /// VMA is backed by a ref-counted allocate memory block.
+ AllocatedMemoryBlock,
+ /// VMA is backed by a raw, unmanaged pointer.
+ BackingMemory,
+ /// VMA is mapped to MMIO registers at a fixed PAddr.
+ MMIO,
+ // TODO(yuriks): Implement MemoryAlias to support MAP/UNMAP
+};
+
+/// Permissions for mapped memory blocks
+enum class VMAPermission : u8 {
+ None = 0,
+ Read = 1,
+ Write = 2,
+ Execute = 4,
+
+ ReadWrite = Read | Write,
+ ReadExecute = Read | Execute,
+ WriteExecute = Write | Execute,
+ ReadWriteExecute = Read | Write | Execute,
+};
+
+/// Set of values returned in MemoryInfo.state by svcQueryMemory.
+enum class MemoryState : u8 {
+ Free = 0,
+ Reserved = 1,
+ IO = 2,
+ Static = 3,
+ Code = 4,
+ Private = 5,
+ Shared = 6,
+ Continuous = 7,
+ Aliased = 8,
+ Alias = 9,
+ AliasCode = 10,
+ Locked = 11,
+};
+
+/**
+ * Represents a VMA in an address space. A VMA is a contiguous region of virtual addressing space
+ * with homogeneous attributes across its extents. In this particular implementation each VMA is
+ * also backed by a single host memory allocation.
+ */
+struct VirtualMemoryArea {
+ /// Virtual base address of the region.
+ VAddr base = 0;
+ /// Size of the region.
+ u32 size = 0;
+
+ VMAType type = VMAType::Free;
+ VMAPermission permissions = VMAPermission::None;
+ /// Tag returned by svcQueryMemory. Not otherwise used.
+ MemoryState meminfo_state = MemoryState::Free;
+
+ // Settings for type = AllocatedMemoryBlock
+ /// Memory block backing this VMA.
+ std::shared_ptr<std::vector<u8>> backing_block = nullptr;
+ /// Offset into the backing_memory the mapping starts from.
+ u32 offset = 0;
+
+ // Settings for type = BackingMemory
+ /// Pointer backing this VMA. It will not be destroyed or freed when the VMA is removed.
+ u8* backing_memory = nullptr;
+
+ // Settings for type = MMIO
+ /// Physical address of the register area this VMA maps to.
+ PAddr paddr = 0;
+
+ /// Tests if this area can be merged to the right with `next`.
+ bool CanBeMergedWith(const VirtualMemoryArea& next) const;
+};
+
+/**
+ * Manages a process' virtual addressing space. This class maintains a list of allocated and free
+ * regions in the address space, along with their attributes, and allows kernel clients to
+ * manipulate it, adjusting the page table to match.
+ *
+ * This is similar in idea and purpose to the VM manager present in operating system kernels, with
+ * the main difference being that it doesn't have to support swapping or memory mapping of files.
+ * The implementation is also simplified by not having to allocate page frames. See these articles
+ * about the Linux kernel for an explantion of the concept and implementation:
+ * - http://duartes.org/gustavo/blog/post/how-the-kernel-manages-your-memory/
+ * - http://duartes.org/gustavo/blog/post/page-cache-the-affair-between-memory-and-files/
+ */
+class VMManager {
+ // TODO(yuriks): Make page tables switchable to support multiple VMManagers
+public:
+ /**
+ * The maximum amount of address space managed by the kernel. Addresses above this are never used.
+ * @note This is the limit used by the New 3DS kernel. Old 3DS used 0x20000000.
+ */
+ static const u32 MAX_ADDRESS = 0x40000000;
+
+ /**
+ * A map covering the entirety of the managed address space, keyed by the `base` field of each
+ * VMA. It must always be modified by splitting or merging VMAs, so that the invariant
+ * `elem.base + elem.size == next.base` is preserved, and mergeable regions must always be
+ * merged when possible so that no two similar and adjacent regions exist that have not been
+ * merged.
+ */
+ std::map<VAddr, VirtualMemoryArea> vma_map;
+ using VMAHandle = decltype(vma_map)::const_iterator;
+
+ VMManager();
+
+ /// Clears the address space map, re-initializing with a single free area.
+ void Reset();
+
+ /// Finds the VMA in which the given address is included in, or `vma_map.end()`.
+ VMAHandle FindVMA(VAddr target) const;
+
+ // TODO(yuriks): Should these functions actually return the handle?
+
+ /**
+ * Maps part of a ref-counted block of memory at a given address.
+ *
+ * @param target The guest address to start the mapping at.
+ * @param block The block to be mapped.
+ * @param offset Offset into `block` to map from.
+ * @param size Size of the mapping.
+ * @param state MemoryState tag to attach to the VMA.
+ */
+ ResultVal<VMAHandle> MapMemoryBlock(VAddr target, std::shared_ptr<std::vector<u8>> block,
+ u32 offset, u32 size, MemoryState state);
+
+ /**
+ * Maps an unmanaged host memory pointer at a given address.
+ *
+ * @param target The guest address to start the mapping at.
+ * @param memory The memory to be mapped.
+ * @param size Size of the mapping.
+ * @param state MemoryState tag to attach to the VMA.
+ */
+ ResultVal<VMAHandle> MapBackingMemory(VAddr target, u8* memory, u32 size, MemoryState state);
+
+ /**
+ * Maps a memory-mapped IO region at a given address.
+ *
+ * @param target The guest address to start the mapping at.
+ * @param paddr The physical address where the registers are present.
+ * @param size Size of the mapping.
+ * @param state MemoryState tag to attach to the VMA.
+ */
+ ResultVal<VMAHandle> MapMMIO(VAddr target, PAddr paddr, u32 size, MemoryState state);
+
+ /// Unmaps the given VMA.
+ void Unmap(VMAHandle vma);
+
+ /// Changes the permissions of the given VMA.
+ void Reprotect(VMAHandle vma, VMAPermission new_perms);
+
+private:
+ using VMAIter = decltype(vma_map)::iterator;
+
+ /// Converts a VMAHandle to a mutable VMAIter.
+ VMAIter StripIterConstness(const VMAHandle& iter);
+
+ /**
+ * Carves a VMA of a specific size at the specified address by splitting Free VMAs while doing
+ * the appropriate error checking.
+ */
+ ResultVal<VMAIter> CarveVMA(VAddr base, u32 size);
+
+ /**
+ * Splits a VMA in two, at the specified offset.
+ * @returns the right side of the split, with the original iterator becoming the left side.
+ */
+ VMAIter SplitVMA(VMAIter vma, u32 offset_in_vma);
+
+ /**
+ * Checks for and merges the specified VMA with adjacent ones if possible.
+ * @returns the merged VMA or the original if no merging was possible.
+ */
+ VMAIter MergeAdjacent(VMAIter vma);
+
+ /// Updates the pages corresponding to this VMA so they match the VMA's attributes.
+ void UpdatePageTableForVMA(const VirtualMemoryArea& vma);
+};
+
+}
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp
index 3fd4cfb08..5d14f393d 100644
--- a/src/core/hle/service/apt/apt.cpp
+++ b/src/core/hle/service/apt/apt.cpp
@@ -151,7 +151,7 @@ void SendParameter(Service::Interface* self) {
u32 handle = cmd_buff[6];
u32 size = cmd_buff[7];
u32 in_param_buffer_ptr = cmd_buff[8];
-
+
cmd_buff[1] = RESULT_SUCCESS.raw; // No error
LOG_WARNING(Service_APT, "(STUBBED) called src_app_id=0x%08X, dst_app_id=0x%08X, signal_type=0x%08X,"
@@ -283,7 +283,7 @@ void Init() {
AddService(new APT_A_Interface);
AddService(new APT_S_Interface);
AddService(new APT_U_Interface);
-
+
// Load the shared system font (if available).
// The expected format is a decrypted, uncompressed BCFNT file with the 0x80 byte header
// generated by the APT:U service. The best way to get is by dumping it from RAM. We've provided
diff --git a/src/core/hle/service/apt/apt.h b/src/core/hle/service/apt/apt.h
index e7fa39325..a03e1712a 100644
--- a/src/core/hle/service/apt/apt.h
+++ b/src/core/hle/service/apt/apt.h
@@ -63,7 +63,7 @@ void Initialize(Service::Interface* self);
* 4 : Handle to shared font memory
*/
void GetSharedFont(Service::Interface* self);
-
+
/**
* APT::NotifyToWait service function
* Inputs:
@@ -88,7 +88,7 @@ void Enable(Service::Interface* self);
* 4 : Home Menu AppId
* 5 : AppID of currently active app
*/
-void GetAppletManInfo(Service::Interface* self);
+void GetAppletManInfo(Service::Interface* self);
/**
* APT::IsRegistered service function. This returns whether the specified AppID is registered with NS yet.
@@ -100,14 +100,14 @@ void GetAppletManInfo(Service::Interface* self);
* Outputs:
* 0 : Return header
* 1 : Result of function, 0 on success, otherwise error code
- * 2 : Output, 0 = not registered, 1 = registered.
+ * 2 : Output, 0 = not registered, 1 = registered.
*/
void IsRegistered(Service::Interface* self);
void InquireNotification(Service::Interface* self);
/**
- * APT::SendParameter service function. This sets the parameter data state.
+ * APT::SendParameter service function. This sets the parameter data state.
* Inputs:
* 1 : Source AppID
* 2 : Destination AppID
diff --git a/src/core/hle/service/boss_p.h b/src/core/hle/service/boss_p.h
index 71f1e7464..6fb51d57d 100644
--- a/src/core/hle/service/boss_p.h
+++ b/src/core/hle/service/boss_p.h
@@ -14,7 +14,7 @@ namespace BOSS_P {
class Interface : public Service::Interface {
public:
Interface();
-
+
std::string GetPortName() const override {
return "boss:P";
}
diff --git a/src/core/hle/service/boss_u.h b/src/core/hle/service/boss_u.h
index 2668f2dfd..89e77fe47 100644
--- a/src/core/hle/service/boss_u.h
+++ b/src/core/hle/service/boss_u.h
@@ -14,7 +14,7 @@ namespace BOSS_U {
class Interface : public Service::Interface {
public:
Interface();
-
+
std::string GetPortName() const override {
return "boss:U";
}
diff --git a/src/core/hle/service/cam_u.cpp b/src/core/hle/service/cam_u.cpp
index fcfd87715..ecda0dbdf 100644
--- a/src/core/hle/service/cam_u.cpp
+++ b/src/core/hle/service/cam_u.cpp
@@ -19,5 +19,5 @@ namespace CAM_U {
Interface::Interface() {
//Register(FunctionTable);
}
-
+
} // namespace
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
index d42682883..62ad90fdc 100644
--- a/src/core/hle/service/cfg/cfg.cpp
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -315,11 +315,11 @@ void Init() {
AddService(new CFG_I_Interface);
AddService(new CFG_S_Interface);
AddService(new CFG_U_Interface);
-
+
// Open the SystemSaveData archive 0x00010017
FileSys::Path archive_path(cfg_system_savedata_id);
auto archive_result = Service::FS::OpenArchive(Service::FS::ArchiveIdCode::SystemSaveData, archive_path);
-
+
// If the archive didn't exist, create the files inside
if (archive_result.Code().description == ErrorDescription::FS_NotFormatted) {
// Format the archive to create the directories
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index 6d4a9c7c9..7cab68024 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -254,7 +254,7 @@ ResultVal<ArchiveHandle> OpenArchive(ArchiveIdCode id_code, FileSys::Path& archi
CASCADE_RESULT(std::unique_ptr<ArchiveBackend> res, itr->second->Open(archive_path));
- // This should never even happen in the first place with 64-bit handles,
+ // This should never even happen in the first place with 64-bit handles,
while (handle_map.count(next_handle) != 0) {
++next_handle;
}
@@ -488,7 +488,7 @@ void ArchiveInit() {
RegisterArchiveType(std::move(sdmc_factory), ArchiveIdCode::SDMC);
else
LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str());
-
+
// Create the SaveData archive
auto savedata_factory = Common::make_unique<FileSys::ArchiveFactory_SaveData>(sdmc_directory);
RegisterArchiveType(std::move(savedata_factory), ArchiveIdCode::SaveData);
@@ -503,7 +503,7 @@ void ArchiveInit() {
if (sharedextsavedata_factory->Initialize())
RegisterArchiveType(std::move(sharedextsavedata_factory), ArchiveIdCode::SharedExtSaveData);
else
- LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s",
+ LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s",
sharedextsavedata_factory->GetMountPoint().c_str());
// Create the SaveDataCheck archive, basically a small variation of the RomFS archive
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index b25c8941d..32db773bb 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -434,7 +434,7 @@ static void IsSdmcWriteable(Service::Interface* self) {
}
/**
- * FS_User::FormatSaveData service function,
+ * FS_User::FormatSaveData service function,
* formats the SaveData specified by the input path.
* Inputs:
* 0 : 0x084C0242
@@ -520,7 +520,7 @@ static void CreateExtSaveData(Service::Interface* self) {
LOG_WARNING(Service_FS, "(STUBBED) savedata_high=%08X savedata_low=%08X cmd_buff[3]=%08X "
"cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X "
"cmd_buff[9]=%08X cmd_buff[10]=%08X cmd_buff[11]=%08X", save_high, save_low,
- cmd_buff[3], cmd_buff[4], cmd_buff[5], cmd_buff[6], cmd_buff[7], cmd_buff[8], cmd_buff[9],
+ cmd_buff[3], cmd_buff[4], cmd_buff[5], cmd_buff[6], cmd_buff[7], cmd_buff[8], cmd_buff[9],
cmd_buff[10], cmd_buff[11]);
cmd_buff[1] = CreateExtSaveData(media_type, save_high, save_low).raw;
@@ -544,7 +544,7 @@ static void DeleteExtSaveData(Service::Interface* self) {
u32 save_high = cmd_buff[3];
u32 unknown = cmd_buff[4]; // TODO(Subv): Figure out what this is
- LOG_WARNING(Service_FS, "(STUBBED) save_low=%08X save_high=%08X media_type=%08X unknown=%08X",
+ LOG_WARNING(Service_FS, "(STUBBED) save_low=%08X save_high=%08X media_type=%08X unknown=%08X",
save_low, save_high, cmd_buff[1] & 0xFF, unknown);
cmd_buff[1] = DeleteExtSaveData(media_type, save_high, save_low).raw;
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 4af168bfc..4b0b4229d 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -167,7 +167,7 @@ static void WriteHWRegsWithMask(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
u32 reg_addr = cmd_buff[1];
u32 size = cmd_buff[2];
-
+
u32* src_data = (u32*)Memory::GetPointer(cmd_buff[4]);
u32* mask_data = (u32*)Memory::GetPointer(cmd_buff[6]);
@@ -208,21 +208,21 @@ static void SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) {
PAddr phys_address_left = Memory::VirtualToPhysicalAddress(info.address_left);
PAddr phys_address_right = Memory::VirtualToPhysicalAddress(info.address_right);
if (info.active_fb == 0) {
- WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_left1)), 4,
+ WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_left1)), 4,
&phys_address_left);
- WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_right1)), 4,
+ WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_right1)), 4,
&phys_address_right);
} else {
- WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_left2)), 4,
+ WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_left2)), 4,
&phys_address_left);
- WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_right2)), 4,
+ WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_right2)), 4,
&phys_address_right);
}
- WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].stride)), 4,
+ WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].stride)), 4,
&info.stride);
- WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].color_format)), 4,
+ WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].color_format)), 4,
&info.format);
- WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].active_fb)), 4,
+ WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].active_fb)), 4,
&info.shown_fb);
}
@@ -374,7 +374,7 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
{
auto& params = command.set_command_list_last;
- WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(command_processor_config.address)),
+ WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(command_processor_config.address)),
Memory::VirtualToPhysicalAddress(params.address) >> 3);
WriteGPURegister(static_cast<u32>(GPU_REG_INDEX(command_processor_config.size)), params.size);
@@ -470,7 +470,7 @@ static void SetLcdForceBlack(Service::Interface* self) {
LCD::Write(HW::VADDR_LCD + 4 * LCD_REG_INDEX(color_fill_top), data.raw); // Top LCD
LCD::Write(HW::VADDR_LCD + 4 * LCD_REG_INDEX(color_fill_bottom), data.raw); // Bottom LCD
-
+
cmd_buff[1] = RESULT_SUCCESS.raw;
}
@@ -516,8 +516,8 @@ static void TriggerCmdReqQueue(Service::Interface* self) {
*/
static void ImportDisplayCaptureInfo(Service::Interface* self) {
u32* cmd_buff = Kernel::GetCommandBuffer();
-
- // TODO(Subv): We're always returning the framebuffer structures for thread_id = 0,
+
+ // TODO(Subv): We're always returning the framebuffer structures for thread_id = 0,
// because we only support a single running application at a time.
// This should always return the framebuffer data that is currently displayed on the screen.
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index feac53816..c7c1bb5ab 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -106,7 +106,7 @@ void Update() {
mem->touch.index_reset_ticks_previous = mem->touch.index_reset_ticks;
mem->touch.index_reset_ticks = (s64)CoreTiming::GetTicks();
}
-
+
// Signal both handles when there's an update to Pad or touch
event_pad_or_touch_1->Signal();
event_pad_or_touch_2->Signal();
diff --git a/src/core/hle/service/hid/hid_spvr.cpp b/src/core/hle/service/hid/hid_spvr.cpp
index 02db12efd..532931ae0 100644
--- a/src/core/hle/service/hid/hid_spvr.cpp
+++ b/src/core/hle/service/hid/hid_spvr.cpp
@@ -25,6 +25,6 @@ const Interface::FunctionInfo FunctionTable[] = {
HID_SPVR_Interface::HID_SPVR_Interface() {
Register(FunctionTable);
}
-
+
} // namespace HID
} // namespace Service
diff --git a/src/core/hle/service/hid/hid_user.h b/src/core/hle/service/hid/hid_user.h
index 0eeec2c25..baf7fed79 100644
--- a/src/core/hle/service/hid/hid_user.h
+++ b/src/core/hle/service/hid/hid_user.h
@@ -11,7 +11,7 @@
namespace Service {
namespace HID {
-
+
/**
* HID service interface.
*/
diff --git a/src/core/hle/service/ptm/ptm.h b/src/core/hle/service/ptm/ptm.h
index 493e6a11f..b690003cb 100644
--- a/src/core/hle/service/ptm/ptm.h
+++ b/src/core/hle/service/ptm/ptm.h
@@ -20,15 +20,15 @@ enum class ChargeLevels : u32 {
CompletelyFull = 5,
};
-/**
+/**
* Represents the gamecoin file structure in the SharedExtData archive
* More information in 3dbrew (http://www.3dbrew.org/wiki/Extdata#Shared_Extdata_0xf000000b_gamecoin.dat)
*/
struct GameCoin {
u32 magic; ///< Magic number: 0x4F00
- u16 total_coins; ///< Total Play Coins
+ u16 total_coins; ///< Total Play Coins
u16 total_coins_on_date; ///< Total Play Coins obtained on the date stored below.
- u32 step_count; ///< Total step count at the time a new Play Coin was obtained.
+ u32 step_count; ///< Total step count at the time a new Play Coin was obtained.
u32 last_step_count; ///< Step count for the day the last Play Coin was obtained
u16 year;
u8 month;
diff --git a/src/core/hle/service/ptm/ptm_play.cpp b/src/core/hle/service/ptm/ptm_play.cpp
index 48e68a3d8..7bb990193 100644
--- a/src/core/hle/service/ptm/ptm_play.cpp
+++ b/src/core/hle/service/ptm/ptm_play.cpp
@@ -18,6 +18,6 @@ const Interface::FunctionInfo FunctionTable[] = {
PTM_Play_Interface::PTM_Play_Interface() {
Register(FunctionTable);
}
-
+
} // namespace PTM
} // namespace Service \ No newline at end of file
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 64185c62e..dc667500c 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -52,7 +52,7 @@ std::unordered_map<std::string, Kernel::SharedPtr<Interface>> g_kernel_named_por
std::unordered_map<std::string, Kernel::SharedPtr<Interface>> g_srv_services;
/**
- * Creates a function string for logging, complete with the name (or header code, depending
+ * Creates a function string for logging, complete with the name (or header code, depending
* on what's passed in) the port name, and all the cmd_buff arguments.
*/
static std::string MakeFunctionString(const char* name, const char* port_name, const u32* cmd_buff) {
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp
index 39b8d65fd..1e0f5df9b 100644
--- a/src/core/hle/service/soc_u.cpp
+++ b/src/core/hle/service/soc_u.cpp
@@ -139,7 +139,7 @@ static int TranslateError(int error) {
auto found = error_map.find(error);
if (found != error_map.end())
return -found->second;
-
+
return error;
}
@@ -346,7 +346,7 @@ static void Bind(Service::Interface* self) {
sockaddr sock_addr = CTRSockAddr::ToPlatform(*ctr_sock_addr);
int res = ::bind(socket_handle, &sock_addr, std::max<u32>(sizeof(sock_addr), len));
-
+
int result = 0;
if (res != 0)
result = TranslateError(GET_ERRNO);
@@ -360,14 +360,14 @@ static void Fcntl(Service::Interface* self) {
u32 socket_handle = cmd_buffer[1];
u32 ctr_cmd = cmd_buffer[2];
u32 ctr_arg = cmd_buffer[3];
-
+
int result = 0;
u32 posix_ret = 0; // TODO: Check what hardware returns for F_SETFL (unspecified by POSIX)
SCOPE_EXIT({
cmd_buffer[1] = result;
cmd_buffer[2] = posix_ret;
});
-
+
if (ctr_cmd == 3) { // F_GETFL
#if EMU_PLATFORM == PLATFORM_WINDOWS
posix_ret = 0;
@@ -404,11 +404,11 @@ static void Fcntl(Service::Interface* self) {
posix_ret = -1;
return;
}
-
+
flags &= ~O_NONBLOCK;
if (ctr_arg & 4) // O_NONBLOCK
flags |= O_NONBLOCK;
-
+
int ret = ::fcntl(socket_handle, F_SETFL, flags);
if (ret == SOCKET_ERROR_VALUE) {
result = TranslateError(GET_ERRNO);
@@ -439,8 +439,8 @@ static void Listen(Service::Interface* self) {
}
static void Accept(Service::Interface* self) {
- // TODO(Subv): Calling this function on a blocking socket will block the emu thread,
- // preventing graceful shutdown when closing the emulator, this can be fixed by always
+ // TODO(Subv): Calling this function on a blocking socket will block the emu thread,
+ // preventing graceful shutdown when closing the emulator, this can be fixed by always
// performing nonblocking operations and spinlock until the data is available
u32* cmd_buffer = Kernel::GetCommandBuffer();
u32 socket_handle = cmd_buffer[1];
@@ -448,7 +448,7 @@ static void Accept(Service::Interface* self) {
sockaddr addr;
socklen_t addr_len = sizeof(addr);
u32 ret = static_cast<u32>(::accept(socket_handle, &addr, &addr_len));
-
+
if ((s32)ret != SOCKET_ERROR_VALUE)
open_sockets[ret] = { ret, true };
@@ -525,8 +525,8 @@ static void SendTo(Service::Interface* self) {
}
static void RecvFrom(Service::Interface* self) {
- // TODO(Subv): Calling this function on a blocking socket will block the emu thread,
- // preventing graceful shutdown when closing the emulator, this can be fixed by always
+ // TODO(Subv): Calling this function on a blocking socket will block the emu thread,
+ // preventing graceful shutdown when closing the emulator, this can be fixed by always
// performing nonblocking operations and spinlock until the data is available
u32* cmd_buffer = Kernel::GetCommandBuffer();
u32 socket_handle = cmd_buffer[1];
@@ -568,7 +568,7 @@ static void Poll(Service::Interface* self) {
pollfd* platform_pollfd = new pollfd[nfds];
for (unsigned current_fds = 0; current_fds < nfds; ++current_fds)
platform_pollfd[current_fds] = CTRPollFD::ToPlatform(input_fds[current_fds]);
-
+
int ret = ::poll(platform_pollfd, nfds, timeout);
// Now update the output pollfd structure
@@ -630,7 +630,7 @@ static void GetPeerName(Service::Interface* self) {
socklen_t len = cmd_buffer[2];
CTRSockAddr* ctr_dest_addr = reinterpret_cast<CTRSockAddr*>(Memory::GetPointer(cmd_buffer[0x104 >> 2]));
-
+
sockaddr dest_addr;
socklen_t dest_addr_len = sizeof(dest_addr);
int ret = ::getpeername(socket_handle, &dest_addr, &dest_addr_len);
@@ -651,8 +651,8 @@ static void GetPeerName(Service::Interface* self) {
}
static void Connect(Service::Interface* self) {
- // TODO(Subv): Calling this function on a blocking socket will block the emu thread,
- // preventing graceful shutdown when closing the emulator, this can be fixed by always
+ // TODO(Subv): Calling this function on a blocking socket will block the emu thread,
+ // preventing graceful shutdown when closing the emulator, this can be fixed by always
// performing nonblocking operations and spinlock until the data is available
u32* cmd_buffer = Kernel::GetCommandBuffer();
u32 socket_handle = cmd_buffer[1];
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index ca3ff3328..d1555c753 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -228,7 +228,7 @@ static ResultCode WaitSynchronizationN(s32* out, Handle* handles, s32 handle_cou
// Actually wait the current thread on each object if we decided to wait...
std::vector<SharedPtr<Kernel::WaitObject>> wait_objects;
wait_objects.reserve(handle_count);
-
+
for (int i = 0; i < handle_count; ++i) {
auto object = Kernel::g_handle_table.GetWaitObject(handles[i]);
object->AddWaitingThread(Kernel::GetCurrentThread());
@@ -475,7 +475,7 @@ static ResultCode GetProcessIdOfThread(u32* process_id, Handle thread_handle) {
return ERR_INVALID_HANDLE;
const SharedPtr<Kernel::Process> process = thread->owner_process;
-
+
ASSERT_MSG(process != nullptr, "Invalid parent process for thread=0x%08X", thread_handle);
*process_id = process->process_id;