AnyPS5/core/relinker/cli/include/Cli.hpp
mugurc 92b20608e8 feat(relinker): convert for Rosetta with --to-rosetta
Rosetta runs AVX2, FMA, BMI1/2, F16C and MOVBE, but, unlike an Intel
host, it has neither RDSEED, CLWB nor RDPID. --to-rosetta converts
everything --to-intel does and lowers these three as well:

- RDSEED becomes RDRAND (the /6 form of the same opcode), which also
  returns a random value and sets CF.
- CLWB only writes a cache line back, so it becomes a NOP of the same
  length.
- RDPID becomes a load of 0 through an optional stub: Rosetta's TSC_AUX
  is a constant, not a processor index, so every thread reports
  processor 0. A site with no movable instruction after it for the jump
  is kept.

The flag implies --to-intel and conflicts with --windows. It is
independent of --macos: it only changes what the conversion produces, so
--macos alone leaves these instructions as they are, as on an Intel Mac,
and a title for Rosetta is relinked with --macos --to-rosetta. Intel
output is unchanged: the target is a parameter of the converter, Intel by
default.
2026-10-10 22:46:45 +03:00

39 lines
875 B
C++

#ifndef CORE_RELINKER_CLI_INCLUDE_CLI_HPP
#define CORE_RELINKER_CLI_INCLUDE_CLI_HPP
#include <set>
#include <string>
#include <cstdint>
namespace Cli {
struct Args {
bool showHelp = false;
bool skipSyscallCheck = false;
bool skipSceModule = false;
bool toIntel = false;
bool toRosetta = false;
bool writeRegistry = false;
bool toWindows = false;
bool toMacos = false;
bool lazyBinding = false;
bool autorun = false;
bool windowsDiagnostics = false;
bool windowsGui = false;
std::uint32_t unusedFilterLevel = 0;
std::string inputPath;
std::string outputPath;
std::string sceModulePath;
std::string runPath = "$ORIGIN/libs";
std::set<std::string> excludedSceModules;
};
Args ParseArgs(int argc, char* argv[]);
const char* Usage();
int Autorun(const std::string& absPath, bool toWindows);
}
#endif