mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-27 07:00:48 +01:00
LinuxSyscalls: Clean up MappedResource insertion
None of the call sites needed this to be a template, and the previous function produced unreadable error messages.
This commit is contained in:
1 parent
48787ab460
commit
bf1b76dcd2
2 files changed
+6
-8
No files matched your search
@@ -375,7 +375,7 @@ void SyscallHandler::TrackMmap(FEXCore::Core::InternalThreadState* Thread, uint6
|
||||
|
||||
if (PathLength != -1) {
|
||||
Tmp[PathLength] = '\0';
|
||||
auto [Iter, Inserted] = VMATracking.EmplaceMappedResource(mrid, VMATracking::MappedResource {nullptr, nullptr, 0});
|
||||
auto [Iter, Inserted] = VMATracking.InsertMappedResource(mrid, {nullptr, nullptr, 0});
|
||||
Resource = &Iter->second;
|
||||
|
||||
if (Inserted) {
|
||||
@@ -386,7 +386,7 @@ void SyscallHandler::TrackMmap(FEXCore::Core::InternalThreadState* Thread, uint6
|
||||
} else if (flags & MAP_SHARED) {
|
||||
VMATracking::MRID mrid {VMATracking::SpecialDev::Anon, AnonSharedId++};
|
||||
|
||||
auto [Iter, Inserted] = VMATracking.EmplaceMappedResource(mrid, VMATracking::MappedResource {nullptr, nullptr, 0});
|
||||
auto [Iter, Inserted] = VMATracking.InsertMappedResource(mrid, {nullptr, nullptr, 0});
|
||||
LOGMAN_THROW_A_FMT(Inserted == true, "VMA tracking error");
|
||||
Resource = &Iter->second;
|
||||
Resource->Iterator = Iter;
|
||||
@@ -446,7 +446,7 @@ void SyscallHandler::TrackMremap(FEXCore::Core::InternalThreadState* Thread, uin
|
||||
void SyscallHandler::TrackShmat(FEXCore::Core::InternalThreadState* Thread, int shmid, uint64_t shmaddr, int shmflg, uint64_t Length) {
|
||||
VMATracking::MRID mrid {VMATracking::SpecialDev::SHM, static_cast<uint64_t>(shmid)};
|
||||
|
||||
auto [Iter, Inserted] = VMATracking.EmplaceMappedResource(mrid, VMATracking::MappedResource {nullptr, nullptr, Length});
|
||||
auto [Iter, Inserted] = VMATracking.InsertMappedResource(mrid, {nullptr, nullptr, Length});
|
||||
auto Resource = &Iter->second;
|
||||
if (Inserted) {
|
||||
Resource->Iterator = Iter;
|
||||
|
||||
@@ -114,11 +114,9 @@ struct VMATracking {
|
||||
// Returns the Size of the Shm or 0 if not found
|
||||
uintptr_t DeleteSHMRegion(FEXCore::Context::Context* Ctx, uintptr_t Base);
|
||||
|
||||
// Emplaces a new `MappedResource` to track.
|
||||
// Used for `mmap` and `shmat` resources; Anonymous, FD, and SHM depending on flags.
|
||||
template<class... Args>
|
||||
inline auto EmplaceMappedResource(Args&&... args) {
|
||||
return MappedResources.emplace(args...);
|
||||
// Adds a new `MappedResource` to track.
|
||||
inline auto InsertMappedResource(const MRID& mrid, MappedResource Resource) {
|
||||
return MappedResources.emplace(mrid, std::move(Resource));
|
||||
}
|
||||
private:
|
||||
bool ListRemove(VMAEntry* Mapping);
|
||||
|
||||
Reference in new issue
Block a user