29#ifndef __FUTEX_MAP_HH__
30#define __FUTEX_MAP_HH__
32#include <unordered_map>
33#include <unordered_set>
50 FutexKey(uint64_t addr_in, uint64_t tgid_in);
65 struct hash<
gem5::FutexKey>
70 for (
int i = 0; i <
sizeof(uint64_t) /
sizeof(
size_t); i++) {
71 hash ^= (size_t)(in.
addr >>
sizeof(
size_t) * i) ^
72 (
size_t)(in.
tgid >>
sizeof(size_t) * i);
101 bool checkMask(
int wakeup_bitmask)
const;
109class FutexMap :
public std::unordered_map<FutexKey, WaiterList>
FutexKey class defines an unique identifier for a particular futex in the system.
FutexKey(uint64_t addr_in, uint64_t tgid_in)
bool operator==(const FutexKey &in) const
FutexMap class holds a map of all futexes used in the system.
void suspend_bitset(Addr addr, uint64_t tgid, ThreadContext *tc, int bitmask)
bool is_waiting(ThreadContext *tc)
Determine if the given thread context is currently waiting on a futex wait operation on any of the fu...
int requeue(Addr addr1, uint64_t tgid, int count, int count2, Addr addr2)
This operation wakes a given number (val) of waiters.
void suspend(Addr addr, uint64_t tgid, ThreadContext *tc)
Inserts a futex into the map with one waiting TC.
std::unordered_set< ThreadContext * > waitingTcs
int wakeup(Addr addr, uint64_t tgid, int count)
Wakes up at most count waiting threads on a futex.
int wakeup_bitset(Addr addr, uint64_t tgid, int bitmask)
ThreadContext is the external interface to all thread state for anything outside of the CPU.
WaiterState defines internal state of a waiter thread.
bool checkMask(int wakeup_bitmask) const
return true if the bit-wise AND of the wakeup_bitmask given by a waking thread and this thread's inte...
WaiterState(ThreadContext *_tc, int _bitmask)
this constructor is used if futex ops with bitset are used
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
std::list< WaiterState > WaiterList
Overload hash function for BasicBlockRange type.
size_t operator()(const gem5::FutexKey &in) const