MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / decodeBlock

Function decodeBlock

source/emulation/cpu/decoder.cpp:6417–6518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6415#endif
6416
6417DecodedOp* decodeBlock(DecodeBlockCallback* callback, U32 eip, bool isBig, U32& opCount, U32& decodedLen, U32 maxOpCount) {
6418 DecodeData d;
6419 DecodedOp* op = DecodedOp::alloc();
6420 DecodedOp* result = op;
6421 U32 furtherestDirectJump = 0;
6422 U32 startOfOp = 0;
6423
6424 d.callback = callback;
6425 d.eip = eip;
6426 d.opCountSoFarInThisBlock = 0;
6427
6428 decodedLen = 0;
6429 opCount = 0;
6430
6431 while (1) {
6432 startOfOp = d.eip;
6433
6434 d.opLen = 0;
6435 d.ds = DS;
6436 d.ss = SS;
6437 if (isBig) {
6438 d.opCode = 0x200;
6439 d.ea16 = 0;
6440 }
6441 else {
6442 d.opCode = 0;
6443 d.ea16 = 1;
6444 }
6445#if defined (_DEBUG)
6446 op->eip = d.eip;
6447#endif
6448 d.inst = d.opCode + d.fetch8();
6449 if (!decoder[d.inst]) {
6450 op->inst = Invalid;
6451 }
6452 else {
6453 decoder[d.inst]->decode(&d, op);
6454 // per x86 spec, this has an implicit lock
6455 if (op->inst == XchgE8R8 || op->inst == XchgE16R16 || op->inst == XchgE32R32) {
6456 op->lock = true;
6457 }
6458#ifdef BOXEDWINE_MULTI_THREADED
6459 if (op->lock) {
6460 translateToLockInstruction(op);
6461 }
6462#endif
6463 }
6464#ifdef _DEBUG
6465 op->lastInst = op->inst;
6466#endif
6467 if (op->inst == Invalid) {
6468#if defined _DEBUG
6469 op->originalOp = d.inst;
6470#endif
6471 break;
6472 }
6473 d.opCountSoFarInThisBlock++;
6474 op->len = d.opLen;

Callers 2

decodeOneOpMethod · 0.85
getOpMethod · 0.85

Calls 6

allocFunction · 0.85
fetch8Method · 0.80
getOpLocationMethod · 0.80
shouldContinueMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected