Beispiel #1
0
void
arch::AppendGeneral(BytecodeContainer& container,
                    const X86Common& common,
                    const X86Opcode& opcode,
                    std::auto_ptr<X86EffAddr> ea,
                    std::auto_ptr<Value> imm,
                    unsigned char special_prefix,
                    unsigned char rex,
                    X86GeneralPostOp postop,
                    bool default_rel,
                    SourceLocation source)
{
    Bytecode& bc = container.FreshBytecode();
    ++num_generic;

    // if no postop and no effective address, output the fixed contents
    if (postop == X86_POSTOP_NONE && ea.get() == 0)
    {
        Bytes& bytes = bc.getFixed();
        unsigned long orig_size = bytes.size();
        GeneralToBytes(bytes, common, opcode, ea.get(), special_prefix, rex);
        if (imm.get() != 0)
        {
            imm->setInsnStart(bytes.size()-orig_size);
            bc.AppendFixed(imm);
        }
        return;
    }

    // TODO: optimize EA case
    bc.Transform(Bytecode::Contents::Ptr(new X86General(
        common, opcode, ea, imm, special_prefix, rex, postop, default_rel)));
    bc.setSource(source);
    ++num_generic_bc;
}
Beispiel #2
0
void
objfmt::AppendSxData(BytecodeContainer& container,
                     SymbolRef sym,
                     SourceLocation source)
{
    Bytecode& bc = container.FreshBytecode();
    bc.Transform(Bytecode::Contents::Ptr(new SxData(sym)));
    bc.setSource(source);
}
void
yasm::AppendSkip(BytecodeContainer& container,
                 std::auto_ptr<Expr> multiple,
                 unsigned int size,
                 SourceLocation source)
{
    Bytecode& bc = container.FreshBytecode();
    FillBytecode* fillbc(new FillBytecode(multiple, size));
    bc.Transform(Bytecode::Contents::Ptr(fillbc));
    bc.setSource(source);
}