summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorLiam White <yteslice@airmail.cc>2022-04-13 21:02:55 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2022-10-06 21:00:53 +0200
commitafab6c143cb486c7d14f1509cd04049ad08d3a65 (patch)
treefb3a35b23be7dd5b2c502ec550c027760257c6f3 /src/common
parentVideoCore: Implement formats needed for N64 emulation. (diff)
downloadyuzu-afab6c143cb486c7d14f1509cd04049ad08d3a65.tar
yuzu-afab6c143cb486c7d14f1509cd04049ad08d3a65.tar.gz
yuzu-afab6c143cb486c7d14f1509cd04049ad08d3a65.tar.bz2
yuzu-afab6c143cb486c7d14f1509cd04049ad08d3a65.tar.lz
yuzu-afab6c143cb486c7d14f1509cd04049ad08d3a65.tar.xz
yuzu-afab6c143cb486c7d14f1509cd04049ad08d3a65.tar.zst
yuzu-afab6c143cb486c7d14f1509cd04049ad08d3a65.zip
Diffstat (limited to 'src/common')
-rw-r--r--src/common/address_space.h10
-rw-r--r--src/common/algorithm.h2
-rw-r--r--src/common/bit_field.h13
-rw-r--r--src/common/multi_level_page_table.cpp4
-rw-r--r--src/common/multi_level_page_table.inc2
5 files changed, 14 insertions, 17 deletions
diff --git a/src/common/address_space.h b/src/common/address_space.h
index fd2f32b7d..8e13935af 100644
--- a/src/common/address_space.h
+++ b/src/common/address_space.h
@@ -22,7 +22,8 @@ struct EmptyStruct {};
*/
template <typename VaType, VaType UnmappedVa, typename PaType, PaType UnmappedPa,
bool PaContigSplit, size_t AddressSpaceBits, typename ExtraBlockInfo = EmptyStruct>
-requires AddressSpaceValid<VaType, AddressSpaceBits> class FlatAddressSpaceMap {
+requires AddressSpaceValid<VaType, AddressSpaceBits>
+class FlatAddressSpaceMap {
private:
std::function<void(VaType, VaType)>
unmapCallback{}; //!< Callback called when the mappings in an region have changed
@@ -40,8 +41,8 @@ protected:
Block() = default;
- Block(VaType virt, PaType phys, ExtraBlockInfo extraInfo)
- : virt(virt), phys(phys), extraInfo(extraInfo) {}
+ Block(VaType virt_, PaType phys_, ExtraBlockInfo extraInfo_)
+ : virt(virt_), phys(phys_), extraInfo(extraInfo_) {}
constexpr bool Valid() {
return virt != UnmappedVa;
@@ -102,7 +103,8 @@ public:
* initial, fast linear pass and a subsequent slower pass that iterates until it finds a free block
*/
template <typename VaType, VaType UnmappedVa, size_t AddressSpaceBits>
-requires AddressSpaceValid<VaType, AddressSpaceBits> class FlatAllocator
+requires AddressSpaceValid<VaType, AddressSpaceBits>
+class FlatAllocator
: public FlatAddressSpaceMap<VaType, UnmappedVa, bool, false, false, AddressSpaceBits> {
private:
using Base = FlatAddressSpaceMap<VaType, UnmappedVa, bool, false, false, AddressSpaceBits>;
diff --git a/src/common/algorithm.h b/src/common/algorithm.h
index 055dca142..c27c9241d 100644
--- a/src/common/algorithm.h
+++ b/src/common/algorithm.h
@@ -27,7 +27,7 @@ template <class ForwardIt, class T, class Compare = std::less<>>
template <typename T, typename Func, typename... Args>
T FoldRight(T initial_value, Func&& func, Args&&... args) {
T value{initial_value};
- const auto high_func = [&value, &func]<typename T>(T x) { value = func(value, x); };
+ const auto high_func = [&value, &func]<typename U>(U x) { value = func(value, x); };
(std::invoke(high_func, std::forward<Args>(args)), ...);
return value;
}
diff --git a/src/common/bit_field.h b/src/common/bit_field.h
index 368b7b98c..7e1df62b1 100644
--- a/src/common/bit_field.h
+++ b/src/common/bit_field.h
@@ -127,14 +127,11 @@ public:
}
}
- BitField(T val) {
- Assign(val);
- }
-
- BitField& operator=(T val) {
- Assign(val);
- return *this;
- }
+ // This constructor and assignment operator might be considered ambiguous:
+ // Would they initialize the storage or just the bitfield?
+ // Hence, delete them. Use the Assign method to set bitfield values!
+ BitField(T val) = delete;
+ BitField& operator=(T val) = delete;
constexpr BitField() noexcept = default;
diff --git a/src/common/multi_level_page_table.cpp b/src/common/multi_level_page_table.cpp
index aed04d0b5..3a7a75aa7 100644
--- a/src/common/multi_level_page_table.cpp
+++ b/src/common/multi_level_page_table.cpp
@@ -1,8 +1,6 @@
#include "common/multi_level_page_table.inc"
namespace Common {
-template class Common::MultiLevelPageTable<GPUVAddr>;
-template class Common::MultiLevelPageTable<VAddr>;
-template class Common::MultiLevelPageTable<PAddr>;
+template class Common::MultiLevelPageTable<u64>;
template class Common::MultiLevelPageTable<u32>;
} // namespace Common
diff --git a/src/common/multi_level_page_table.inc b/src/common/multi_level_page_table.inc
index 9a68cad93..4def6dba8 100644
--- a/src/common/multi_level_page_table.inc
+++ b/src/common/multi_level_page_table.inc
@@ -30,7 +30,7 @@ MultiLevelPageTable<BaseAddr>::MultiLevelPageTable(std::size_t address_space_bit
#ifdef _WIN32
void* base{VirtualAlloc(nullptr, alloc_size, MEM_RESERVE, PAGE_READWRITE)};
#else
- void* base{mmap(nullptr, alloc_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)};
+ void* base{mmap(nullptr, alloc_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)};
if (base == MAP_FAILED) {
base = nullptr;