diff options
| -rw-r--r-- | src/common/alignment.h | 5 | ||||
| -rw-r--r-- | src/core/hle/kernel/physical_memory.h | 8 | ||||
| -rw-r--r-- | src/core/hle/kernel/shared_memory.cpp | 4 |
3 files changed, 11 insertions, 6 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h index da2e61e10..0ce218c60 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h | |||
| @@ -52,7 +52,6 @@ public: | |||
| 52 | using const_reference = const T&; | 52 | using const_reference = const T&; |
| 53 | 53 | ||
| 54 | public: | 54 | public: |
| 55 | |||
| 56 | pointer address(reference r) { | 55 | pointer address(reference r) { |
| 57 | return std::addressof(r); | 56 | return std::addressof(r); |
| 58 | } | 57 | } |
| @@ -62,11 +61,11 @@ public: | |||
| 62 | } | 61 | } |
| 63 | 62 | ||
| 64 | pointer allocate(size_type n) { | 63 | pointer allocate(size_type n) { |
| 65 | return static_cast<pointer>(::operator new(n, std::align_val_t{Align})); | 64 | return static_cast<pointer>(::operator new (n, std::align_val_t{Align})); |
| 66 | } | 65 | } |
| 67 | 66 | ||
| 68 | void deallocate(pointer p, size_type) { | 67 | void deallocate(pointer p, size_type) { |
| 69 | ::operator delete(p, std::align_val_t{Align}); | 68 | ::operator delete (p, std::align_val_t{Align}); |
| 70 | } | 69 | } |
| 71 | 70 | ||
| 72 | void construct(pointer p, const value_type& wert) { | 71 | void construct(pointer p, const value_type& wert) { |
diff --git a/src/core/hle/kernel/physical_memory.h b/src/core/hle/kernel/physical_memory.h index dd49c75a2..090565310 100644 --- a/src/core/hle/kernel/physical_memory.h +++ b/src/core/hle/kernel/physical_memory.h | |||
| @@ -8,6 +8,12 @@ | |||
| 8 | 8 | ||
| 9 | namespace Kernel { | 9 | namespace Kernel { |
| 10 | 10 | ||
| 11 | // This encapsulation serves 2 purposes: | ||
| 12 | // - First, to encapsulate host physical memory under a single type and set an | ||
| 13 | // standard for managing it. | ||
| 14 | // - Second to ensure all host backing memory used is aligned to 256 bytes due | ||
| 15 | // to strict alignment restrictions on GPU memory. | ||
| 16 | |||
| 11 | using PhysicalMemory = std::vector<u8, Common::AlignmentAllocator<u8, 256>>; | 17 | using PhysicalMemory = std::vector<u8, Common::AlignmentAllocator<u8, 256>>; |
| 12 | 18 | ||
| 13 | } | 19 | } // namespace Kernel |
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 45a9e1942..a815c4eea 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp | |||
| @@ -59,8 +59,8 @@ SharedPtr<SharedMemory> SharedMemory::Create(KernelCore& kernel, Process* owner_ | |||
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | SharedPtr<SharedMemory> SharedMemory::CreateForApplet( | 61 | SharedPtr<SharedMemory> SharedMemory::CreateForApplet( |
| 62 | KernelCore& kernel, std::shared_ptr<Kernel::PhysicalMemory> heap_block, std::size_t offset, u64 size, | 62 | KernelCore& kernel, std::shared_ptr<Kernel::PhysicalMemory> heap_block, std::size_t offset, |
| 63 | MemoryPermission permissions, MemoryPermission other_permissions, std::string name) { | 63 | u64 size, MemoryPermission permissions, MemoryPermission other_permissions, std::string name) { |
| 64 | SharedPtr<SharedMemory> shared_memory(new SharedMemory(kernel)); | 64 | SharedPtr<SharedMemory> shared_memory(new SharedMemory(kernel)); |
| 65 | 65 | ||
| 66 | shared_memory->owner_process = nullptr; | 66 | shared_memory->owner_process = nullptr; |