Package org.jnode.assembler

Examples of org.jnode.assembler.Label


     * @throws BuildException
     * @throws ClassNotFoundException
     */
    protected void initMain(X86BinaryAssembler os, PluginRegistry registry)
        throws BuildException, ClassNotFoundException {
        os.setObjectRef(new Label("$$Initialize Main"));
        final VmType<?> mainClass = loadClass(Main.class);
        final VmStaticField registryField = (VmStaticField) mainClass
            .getField(Main.REGISTRY_FIELD_NAME);

        final GPR abx = os.isCode32() ? (GPR) X86Register.EBX : X86Register.RBX;
View Full Code Here


            JNAsm.assembler(os, sourceInfo, symbols);
            log("Compiling native kernel with JNAsm, Version " + version + ", " + i_bist + " bits done");

            // Link the jump table entries
            for (int i = 0; i < X86JumpTable.TABLE_LENGTH; i++) {
                final Label lbl = new Label(X86JumpTable.TABLE_ENTRY_LABELS[i]);
                final int idx = (arch.getMode().is32()) ? i : i * 2;
                sharedStatics.setAddress(idx, lbl);
            }
        } catch (Exception e) {
            throw new BuildException(e);
View Full Code Here

        this.pass = pass;
    }

    private void defineLabel(String label, X86Assembler asm) {
        try {
            Label lab = new Label(label);
            labels.put(label, lab);
            NativeStream.ObjectRef ref = asm.setObjectRef(lab);
            assembler.putConstant(label, ref.getOffset() + (int) asm.getBaseAddr());
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

        Object o1 = operands.get(0);
        if (o1 instanceof Register) {
            stream.writeCALL(getRegister(((Register) o1).name));
        } else if (o1 instanceof Identifier) {
            String id = ((Identifier) o1).name;
            Label lab = labels.get(id);
            lab = (lab == null) ? new Label(id) : lab;
            stream.writeCALL(lab);
        } else if (o1 instanceof Address) {
            Address ind = (Address) o1;
            if (ind.reg != null && ind.sreg != null) {
                throw new IllegalArgumentException("Scaled is not supported for call ");
View Full Code Here

    private void emitJCC(int jumpCode) {
        Object o1 = operands.get(0);
        if (o1 instanceof Identifier) {
            String id = ((Identifier) o1).name;
            Label lab = labels.get(id);
            lab = (lab == null) ? new Label(id) : lab;
            stream.writeJCC(lab, jumpCode);
        } else {
            throw new IllegalArgumentException("Unknown operand: " + o1);
        }
    }
View Full Code Here

    private void emitJECXZ() {
        Object o1 = operands.get(0);
        if (o1 instanceof Identifier) {
            String id = ((Identifier) o1).name;
            Label lab = labels.get(id);
            lab = (lab == null) ? new Label(id) : lab;
            stream.writeJECXZ(lab);
        } else {
            throw new IllegalArgumentException("Unknown operand: " + o1);
        }
    }
View Full Code Here

        Object o1 = operands.get(0);
        if (o1 instanceof Register) {
            stream.writeJMP(getRegister(((Register) o1).name));
        } else if (o1 instanceof Identifier) {
            String id = ((Identifier) o1).name;
            Label lab = labels.get(id);
            lab = (lab == null) ? new Label(id) : lab;
            stream.writeJMP(lab);
        } else if (o1 instanceof Address) {
            Address addr = (Address) o1;
            if (addr.reg != null) {
                stream.writeJMP(getRegister(addr.reg), addr.disp);
View Full Code Here

    private void emitLOOP() {
        Object o1 = operands.get(0);
        if (o1 instanceof Identifier) {
            String id = ((Identifier) o1).name;
            Label lab = labels.get(id);
            lab = (lab == null) ? new Label(id) : lab;
            try {
                stream.writeLOOP(lab);
            } catch (UnresolvedObjectRefException x) {
                x.printStackTrace();
            }
View Full Code Here

    private void emitMOV() {
        if (operands.size() == 2 &&
            operands.get(0) instanceof Register &&
            operands.get(1) instanceof Identifier) {
            stream.writeMOV_Const(getRegister(((Register) operands.get(0)).name),
                new Label(((Identifier) operands.get(1)).name));
            return;
        }
        int addr = getAddressingMode(2);
        switch (addr) {
            case RR_ADDR:
View Full Code Here

        stream.writePOPF();
    }

    private void emitPUSH() {
        if (operands.size() == 1 && operands.get(0) instanceof Identifier) {
            stream.writePUSH_Const(new Label(((Identifier) operands.get(0)).name));
            return;
        }
        int addr = getAddressingMode(1);
        switch (addr) {
            case C_ADDR:
View Full Code Here

TOP

Related Classes of org.jnode.assembler.Label

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.