fxos/include/fxos/passes/pcrel.h

37 lines
1.4 KiB
C++

//---------------------------------------------------------------------------//
// 1100101 |_ mov #0, r4 __ //
// 11 |_ <0xb380 %5c4> / _|_ _____ ___ //
// 0110 |_ 3.50 -> 3.60 | _\ \ / _ (_-< //
// |_ base# + offset |_| /_\_\___/__/ //
//---------------------------------------------------------------------------//
// fxos/passes/pcrel: Resolution of PC-relative addresses
//
// This passes computes PC-relative addresses in statically-determined jumps
// and in PC-relative mov instructions. It determines the target address and,
// when applicable, the value read from memory.
//
// When an instruction accesses memory, the argument's [location] field holds
// the target address and the [value] field holds the value. When an
// instruction computes an address for a jump or for storage (mova) then both
// fields hold the target address (as the "value" obtained by the instruction
// is the address itself).
//---
#ifndef FXOS_PASSES_PCREL_H
#define FXOS_PASSES_PCREL_H
#include <fxos/disassembly.h>
namespace FxOS {
class PcrelPass: public InstructionPass
{
public:
PcrelPass(Disassembly &disasm);
bool analyzeInstruction(uint32_t pc, Instruction &inst) override;
};
} /* namespace FxOS */
#endif /* FXOS_PASSES_PCREL_H */