MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / CheckLegacySegmentWrite

Method CheckLegacySegmentWrite

FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp:4079–4115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4077}
4078
4079void OpDispatchBuilder::CheckLegacySegmentWrite(Ref NewNode, uint32_t SegmentReg) {
4080#ifndef FEX_DISABLE_TELEMETRY
4081 if (SegmentReg == FEXCore::X86Tables::DecodeFlags::FLAG_FS_PREFIX || SegmentReg == FEXCore::X86Tables::DecodeFlags::FLAG_GS_PREFIX) {
4082 // FS and GS segments aren't considered legacy.
4083 return;
4084 }
4085
4086 if (CTX->Config.DisableTelemetry()) {
4087 // Telemetry disabled at runtime.
4088 return;
4089 }
4090
4091 FEXCore::Telemetry::TelemetryType TelemIndex {};
4092 switch (SegmentReg) {
4093 case FEXCore::X86Tables::DecodeFlags::FLAG_ES_PREFIX:
4094 TelemIndex = FEXCore::Telemetry::TelemetryType::TYPE_WRITES_32BIT_SEGMENT_ES;
4095 SegmentsNeedReadCheck |= FEXCore::X86Tables::DecodeFlags::FLAG_ES_PREFIX;
4096 break;
4097 case FEXCore::X86Tables::DecodeFlags::FLAG_CS_PREFIX:
4098 TelemIndex = FEXCore::Telemetry::TelemetryType::TYPE_WRITES_32BIT_SEGMENT_CS;
4099 SegmentsNeedReadCheck |= FEXCore::X86Tables::DecodeFlags::FLAG_CS_PREFIX;
4100 break;
4101 case FEXCore::X86Tables::DecodeFlags::FLAG_SS_PREFIX:
4102 TelemIndex = FEXCore::Telemetry::TelemetryType::TYPE_WRITES_32BIT_SEGMENT_SS;
4103 SegmentsNeedReadCheck |= FEXCore::X86Tables::DecodeFlags::FLAG_SS_PREFIX;
4104 break;
4105 case FEXCore::X86Tables::DecodeFlags::FLAG_DS_PREFIX:
4106 TelemIndex = FEXCore::Telemetry::TelemetryType::TYPE_WRITES_32BIT_SEGMENT_DS;
4107 SegmentsNeedReadCheck |= FEXCore::X86Tables::DecodeFlags::FLAG_DS_PREFIX;
4108 break;
4109 default: FEX_UNREACHABLE;
4110 }
4111
4112 // Will set the telemetry value if NewNode is != 0
4113 _TelemetrySetValue(NewNode, TelemIndex);
4114#endif
4115}
4116
4117void OpDispatchBuilder::UpdatePrefixFromSegment(Ref Segment, uint32_t SegmentReg) {
4118 // Use BFE to extract the selector index in bits [15,3] of the segment register.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected