From 379b8c65b9471905b03e3613863d270d0945711b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 5 Aug 2018 21:31:56 -0400 Subject: [PATCH 1/2] memory: Remove unnecessary const qualifiers in prototypes These aren't necessary, as value-wise const only matters in the definition. --- src/core/memory.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/core/memory.h b/src/core/memory.h index 0fe85c725..d7c09af65 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -181,10 +181,10 @@ void SetCurrentPageTable(PageTable* page_table); PageTable* GetCurrentPageTable(); /// Determines if the given VAddr is valid for the specified process. -bool IsValidVirtualAddress(const Kernel::Process& process, const VAddr vaddr); -bool IsValidVirtualAddress(const VAddr addr); +bool IsValidVirtualAddress(const Kernel::Process& process, VAddr vaddr); +bool IsValidVirtualAddress(VAddr addr); -bool IsValidPhysicalAddress(const PAddr addr); +bool IsValidPhysicalAddress(PAddr addr); u8 Read8(VAddr addr); u16 Read16(VAddr addr); @@ -196,14 +196,13 @@ void Write16(VAddr addr, u16 data); void Write32(VAddr addr, u32 data); void Write64(VAddr addr, u64 data); -void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_buffer, - size_t size); -void ReadBlock(const VAddr src_addr, void* dest_buffer, size_t size); -void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const void* src_buffer, +void ReadBlock(const Kernel::Process& process, VAddr src_addr, void* dest_buffer, size_t size); +void ReadBlock(VAddr src_addr, void* dest_buffer, size_t size); +void WriteBlock(const Kernel::Process& process, VAddr dest_addr, const void* src_buffer, size_t size); -void WriteBlock(const VAddr dest_addr, const void* src_buffer, size_t size); -void ZeroBlock(const Kernel::Process& process, const VAddr dest_addr, const size_t size); -void ZeroBlock(const VAddr dest_addr, const size_t size); +void WriteBlock(VAddr dest_addr, const void* src_buffer, size_t size); +void ZeroBlock(const Kernel::Process& process, VAddr dest_addr, const size_t size); +void ZeroBlock(VAddr dest_addr, const size_t size); void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr, size_t size); void CopyBlock(VAddr dest_addr, VAddr src_addr, size_t size); From 8fa861c2c66163ac8537e5afa8ca256582692520 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 31 Aug 2018 00:28:28 +0200 Subject: [PATCH 2/2] memory: Make prototype parameter names match their definitions Keeps the code consistent. --- src/core/memory.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/memory.h b/src/core/memory.h index d7c09af65..70d057ecc 100644 --- a/src/core/memory.h +++ b/src/core/memory.h @@ -182,9 +182,9 @@ PageTable* GetCurrentPageTable(); /// Determines if the given VAddr is valid for the specified process. bool IsValidVirtualAddress(const Kernel::Process& process, VAddr vaddr); -bool IsValidVirtualAddress(VAddr addr); +bool IsValidVirtualAddress(VAddr vaddr); -bool IsValidPhysicalAddress(PAddr addr); +bool IsValidPhysicalAddress(PAddr paddr); u8 Read8(VAddr addr); u16 Read16(VAddr addr); @@ -206,9 +206,9 @@ void ZeroBlock(VAddr dest_addr, const size_t size); void CopyBlock(const Kernel::Process& process, VAddr dest_addr, VAddr src_addr, size_t size); void CopyBlock(VAddr dest_addr, VAddr src_addr, size_t size); -u8* GetPointer(VAddr virtual_address); +u8* GetPointer(VAddr vaddr); -std::string ReadCString(VAddr virtual_address, std::size_t max_length); +std::string ReadCString(VAddr vaddr, std::size_t max_length); /** * Converts a virtual address inside a region with 1:1 mapping to physical memory to a physical @@ -227,7 +227,7 @@ PAddr VirtualToPhysicalAddress(VAddr addr); /** * Undoes a mapping performed by VirtualToPhysicalAddress(). */ -boost::optional PhysicalToVirtualAddress(PAddr addr); +boost::optional PhysicalToVirtualAddress(PAddr paddr); /** * Gets a pointer to the memory region beginning at the specified physical address.