extra ps4 defs

This commit is contained in:
lizzie 2025-12-01 21:29:18 +00:00
parent 5262e18252
commit 2a82754448
2 changed files with 4 additions and 23 deletions

View file

@ -48,17 +48,6 @@
#ifndef MAP_ANONYMOUS #ifndef MAP_ANONYMOUS
# define MAP_ANONYMOUS MAP_ANON # define MAP_ANONYMOUS MAP_ANON
#endif #endif
// PlayStation 4
// Flag needs to be undef-ed on non PS4 since it has different semantics
// on some platforms.
#ifndef MAP_SYSTEM
# ifdef __OPENORBIS__
# define MAP_SYSTEM 0x2000
# else
# undef MAP_SYSTEM
# define MAP_SYSTEM 0
# endif
#endif
#endif // ^^^ POSIX ^^^ #endif // ^^^ POSIX ^^^

View file

@ -29,30 +29,22 @@ public:
template <typename T> template <typename T>
Common::PhysicalAddress GetPhysicalAddr(const T* ptr) const { Common::PhysicalAddress GetPhysicalAddr(const T* ptr) const {
return GetPhysicalAddr(reinterpret_cast<uintptr_t>(ptr)); return (uintptr_t(ptr) - uintptr_t(buffer.BackingBasePointer())) + DramMemoryMap::Base;
}
Common::PhysicalAddress GetPhysicalAddr(uintptr_t ptr) const {
return (ptr - reinterpret_cast<uintptr_t>(buffer.BackingBasePointer())) +
DramMemoryMap::Base;
} }
template <typename T> template <typename T>
PAddr GetRawPhysicalAddr(const T* ptr) const { PAddr GetRawPhysicalAddr(const T* ptr) const {
return static_cast<PAddr>(reinterpret_cast<uintptr_t>(ptr) - return PAddr(uintptr_t(ptr) - uintptr_t(buffer.BackingBasePointer()));
reinterpret_cast<uintptr_t>(buffer.BackingBasePointer()));
} }
template <typename T> template <typename T>
T* GetPointer(Common::PhysicalAddress addr) { T* GetPointer(Common::PhysicalAddress addr) {
return reinterpret_cast<T*>(buffer.BackingBasePointer() + return reinterpret_cast<T*>(buffer.BackingBasePointer() + (GetInteger(addr) - DramMemoryMap::Base));
(GetInteger(addr) - DramMemoryMap::Base));
} }
template <typename T> template <typename T>
const T* GetPointer(Common::PhysicalAddress addr) const { const T* GetPointer(Common::PhysicalAddress addr) const {
return reinterpret_cast<T*>(buffer.BackingBasePointer() + return reinterpret_cast<T*>(buffer.BackingBasePointer() + (GetInteger(addr) - DramMemoryMap::Base));
(GetInteger(addr) - DramMemoryMap::Base));
} }
template <typename T> template <typename T>