mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-23 09:03:22 -05:00
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.
26 lines
585 B
C++
26 lines
585 B
C++
#ifndef CODEGEN_IAMD64ONLYCONVERTER_HPP
|
|
#define CODEGEN_IAMD64ONLYCONVERTER_HPP
|
|
|
|
#include <codegen/CodegenTypes.hpp>
|
|
#include <domain/Types.hpp>
|
|
#include <memory>
|
|
#include <vector>
|
|
|
|
namespace Codegen {
|
|
|
|
class IAmd64OnlyConverter {
|
|
public:
|
|
virtual ~IAmd64OnlyConverter() = default;
|
|
|
|
[[nodiscard]] virtual ConvertResult Convert(
|
|
std::vector<std::uint8_t> fileBytes,
|
|
const std::vector<Domain::ProgramHeader>& codeSegments
|
|
) const = 0;
|
|
};
|
|
|
|
std::unique_ptr<IAmd64OnlyConverter> MakeAmd64OnlyConverter(Amd64OnlyTarget target = Amd64OnlyTarget::Intel);
|
|
|
|
}
|
|
|
|
#endif
|