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

Method MOVSOp

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

Source from the content-addressed store, hash-verified

3224}
3225
3226void OpDispatchBuilder::MOVSOp(OpcodeArgs) {
3227 if (Op->Flags & FEXCore::X86Tables::DecodeFlags::FLAG_ADDRESS_SIZE) {
3228 LogMan::Msg::EFmt("Can't handle adddress size");
3229 DecodeFailure = true;
3230 return;
3231 }
3232
3233 // RA now can handle these to be here, to avoid DF accesses
3234 const auto Size = OpSizeFromSrc(Op);
3235
3236 if (Op->Flags & (FEXCore::X86Tables::DecodeFlags::FLAG_REP_PREFIX | FEXCore::X86Tables::DecodeFlags::FLAG_REPNE_PREFIX)) {
3237 auto SrcAddr = LoadGPRRegister(X86State::REG_RSI);
3238 auto DstAddr = LoadGPRRegister(X86State::REG_RDI);
3239 auto Counter = LoadGPRRegister(X86State::REG_RCX);
3240
3241 auto DstSegment = GetSegment(0, FEXCore::X86Tables::DecodeFlags::FLAG_ES_PREFIX, true);
3242 auto SrcSegment = GetSegment(Op->Flags, FEXCore::X86Tables::DecodeFlags::FLAG_DS_PREFIX);
3243
3244 if (DstSegment) {
3245 DstAddr = Add(OpSize::i64Bit, DstAddr, DstSegment);
3246 }
3247
3248 if (SrcSegment) {
3249 SrcAddr = Add(OpSize::i64Bit, SrcAddr, SrcSegment);
3250 }
3251
3252 Ref Result_Src = _AllocateGPR(false);
3253 Ref Result_Dst = _AllocateGPR(false);
3254 _MemCpy(CTX->IsAtomicTSOEnabled(), Size, DstAddr, SrcAddr, Counter, LoadDir(1), Result_Dst, Result_Src);
3255
3256 if (DstSegment) {
3257 Result_Dst = Sub(OpSize::i64Bit, Result_Dst, DstSegment);
3258 }
3259
3260 if (SrcSegment) {
3261 Result_Src = Sub(OpSize::i64Bit, Result_Src, SrcSegment);
3262 }
3263
3264 StoreGPRRegister(X86State::REG_RCX, Constant(0));
3265 StoreGPRRegister(X86State::REG_RDI, Result_Dst);
3266 StoreGPRRegister(X86State::REG_RSI, Result_Src);
3267 } else {
3268 Ref RSI = MakeSegmentAddress(X86State::REG_RSI, Op->Flags, X86Tables::DecodeFlags::FLAG_DS_PREFIX);
3269 Ref RDI = MakeSegmentAddress(X86State::REG_RDI, 0, X86Tables::DecodeFlags::FLAG_ES_PREFIX, true);
3270
3271 auto Src = _LoadMemAutoTSO(GPRClass, Size, RSI, Size);
3272
3273 // Store to memory where RDI points
3274 _StoreMemAutoTSO(GPRClass, Size, RDI, Src, Size);
3275
3276 auto PtrDir = LoadDir(IR::OpSizeToSize(Size));
3277 RSI = Add(OpSize::i64Bit, RSI, PtrDir);
3278 RDI = Add(OpSize::i64Bit, RDI, PtrDir);
3279
3280 StoreGPRRegister(X86State::REG_RSI, RSI);
3281 StoreGPRRegister(X86State::REG_RDI, RDI);
3282 }
3283}

Callers

nothing calls this directly

Calls 3

EFmtFunction · 0.85
OpSizeToSizeFunction · 0.85
IsAtomicTSOEnabledMethod · 0.80

Tested by

no test coverage detected