* @brief Queries if FEX is installed as a binfmt_misc interpreter * * @param ExecutedWithFD If FEXInterpreter was executed using a binfmt_misc FD handle from the kernel * @param Portable Portability information about FEX being run in portable mode * * @return true if the binfmt_misc handlers are installed and being used */
| 151 | * @return true if the binfmt_misc handlers are installed and being used |
| 152 | */ |
| 153 | bool QueryInterpreterInstalled(bool ExecutedWithFD, const FEX::Config::PortableInformation& Portable) { |
| 154 | if (Portable.IsPortable) { |
| 155 | // Don't use binfmt interpreter even if it's installed |
| 156 | return false; |
| 157 | } |
| 158 | |
| 159 | // Check if FEX's binfmt_misc handlers are both installed. |
| 160 | // The explicit check can be omitted if FEX was executed from an FD, |
| 161 | // since this only happens if the kernel launched FEX through binfmt_misc |
| 162 | return ExecutedWithFD || (access("/proc/sys/fs/binfmt_misc/FEX-x86", F_OK) == 0 && access("/proc/sys/fs/binfmt_misc/FEX-x86_64", F_OK) == 0); |
| 163 | } |
| 164 | |
| 165 | namespace FEX::TSO { |
| 166 | void SetupTSOEmulation(FEXCore::Context::Context* CTX) { |