当前位置: 首页>>代码示例>>C#>>正文


C# X86.Addr32类代码示例

本文整理汇总了C#中Girl.X86.Addr32的典型用法代码示例。如果您正苦于以下问题:C# Addr32类的具体用法?C# Addr32怎么用?C# Addr32使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Addr32类属于Girl.X86命名空间,在下文中一共展示了Addr32类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddCodes

        public static void AddCodes(NodeBase caller, BlockBase parent, NodeBase target, OpModule codes, string op, Addr32 dest)
        {
            if (target is TypeOf) target = (target as TypeOf).Target;

            var v = target as Variant;
            if (v != null && parent.GetFunction(v.Name) == null)
            {
                var fpname = (target as Variant).Name;
                var fpt = Types.GetType(parent, fpname);
                if (fpt == null || !fpt.Check())
                    throw caller.Abort("undefined type: {0}", fpname);
                codes.AddCodesV(op, dest, codes.GetTypeObject(fpt));
                return;
            }

            var tt = target.Type;
            var tr = tt as TypeReference;
            var tts = tt.Type as TypeStruct;
            if (tr != null && (tr.IsArray || (tts != null && tts.IsClass)))
            {
                target.AddCodesV(codes, "mov", null);
                var label = new OpCode();
                codes.Add(I386.Test(Reg32.EAX, Reg32.EAX));
                codes.Add(I386.Jcc(Cc.Z, label.Address));
                codes.Add(I386.MovRA(Reg32.EAX, Addr32.NewRO(Reg32.EAX, -16)));
                codes.Add(label);
                codes.AddCodes(op, dest);
            }
            else
                codes.AddCodesV(op, dest, codes.GetTypeObject(tt));
        }
开发者ID:7shi,项目名称:LLPML,代码行数:31,代码来源:TypeOf.cs

示例2: AddCodesV

 public override void AddCodesV(OpModule codes, string op, Addr32 dest)
 {
     Val32 v;
     var m = codes.Module;
     if (func != null)
         v = func.GetAddress(m);
     else
     {
         var vv = GetVar();
         if (vv != null)
         {
             vv.AddCodesV(codes, op, dest);
             return;
         }
         var c = GetConst();
         if (c != null)
         {
             c.AddCodesV(codes, op, dest);
             return;
         }
         var f = GetFunction();
         if (f == null)
         {
             var g = GetGetter();
             if (g != null)
             {
                 Call.NewName(Parent, g.Name).AddCodesV(codes, op, dest);
                 return;
             }
             throw Abort("undefined symbol: " + name);
         }
         v = f.GetAddress(m);
     }
     codes.AddCodesV(op, dest, v);
 }
开发者ID:7shi,项目名称:LLPML,代码行数:35,代码来源:Variant.cs

示例3: FromName1A

 public static OpCode FromName1A(string op, Addr32 op1)
 {
     switch (op)
     {
         case "push":
             return OpCode.NewA(Util.GetBytes1(0xff), Addr32.NewAdM(op1, 6));
         case "pop":
             return OpCode.NewA(Util.GetBytes1(0x8f), op1);
         case "inc":
             return OpCode.NewA(Util.GetBytes1(0xff), op1);
         case "dec":
             return OpCode.NewA(Util.GetBytes1(0xff), Addr32.NewAdM(op1, 1));
         case "not":
             return OpCode.NewA(Util.GetBytes1(0xf7), Addr32.NewAdM(op1, 2));
         case "neg":
             return OpCode.NewA(Util.GetBytes1(0xf7), Addr32.NewAdM(op1, 3));
         case "mul":
             return OpCode.NewA(Util.GetBytes1(0xf7), Addr32.NewAdM(op1, 4));
         case "imul":
             return OpCode.NewA(Util.GetBytes1(0xf7), Addr32.NewAdM(op1, 5));
         case "div":
             return OpCode.NewA(Util.GetBytes1(0xf7), Addr32.NewAdM(op1, 6));
         case "idiv":
             return OpCode.NewA(Util.GetBytes1(0xf7), Addr32.NewAdM(op1, 7));
         default:
             throw new Exception("invalid operator: " + op);
     }
 }
开发者ID:7shi,项目名称:LLPML,代码行数:28,代码来源:I386.1.32.cs

示例4: AddOpCodes

 public override void AddOpCodes(string op, OpModule codes, Addr32 dest)
 {
     switch (op)
     {
         case "shift-left":
             Shift("sal", codes, dest);
             break;
         case "shift-right":
             Shift("sar", codes, dest);
             break;
         case "mul":
             codes.Add(I386.ImulA(dest));
             codes.Add(I386.MovAR(dest, Reg32.EAX));
             break;
         case "div":
             codes.Add(I386.XchgRA(Reg32.EAX, dest));
             codes.Add(I386.Cdq());
             codes.Add(I386.IdivA(dest));
             codes.Add(I386.MovAR(dest, Reg32.EAX));
             break;
         case "mod":
             codes.Add(I386.XchgRA(Reg32.EAX, dest));
             codes.Add(I386.Cdq());
             codes.Add(I386.IdivA(dest));
             codes.Add(I386.MovAR(dest, Reg32.EDX));
             break;
         default:
             base.AddOpCodes(op, codes, dest);
             break;
     }
 }
开发者ID:7shi,项目名称:LLPML,代码行数:31,代码来源:TypeInt.cs

示例5: AddOpCodes

 public override void AddOpCodes(string op, OpModule codes, Addr32 dest)
 {
     switch (op)
     {
         case "inc":
         case "post-inc":
             if (Type.Size == 1)
                 codes.Add(I386.IncA(dest));
             else
                 codes.Add(I386.AddA(dest, Val32.NewI(Type.Size)));
             break;
         case "dec":
         case "post-dec":
             if (Type.Size == 1)
                 codes.Add(I386.DecA(dest));
             else
                 codes.Add(I386.SubA(dest, Val32.NewI(Type.Size)));
             break;
         case "add":
             codes.Add(I386.MovR(Reg32.EDX, Val32.NewI(Type.Size)));
             codes.Add(I386.Mul(Reg32.EDX));
             codes.Add(I386.AddAR(dest, Reg32.EAX));
             break;
         case "sub":
             codes.Add(I386.MovR(Reg32.EDX, Val32.NewI(Type.Size)));
             codes.Add(I386.Mul(Reg32.EDX));
             codes.Add(I386.SubAR(dest, Reg32.EAX));
             break;
         default:
             base.AddOpCodes(op, codes, dest);
             break;
     }
 }
开发者ID:7shi,项目名称:LLPML,代码行数:33,代码来源:TypePointer.cs

示例6: AddConstructorA

 public void AddConstructorA(OpModule codes, Addr32 ad)
 {
     if (ad != null)
         codes.Add(I386.Lea(Reg32.EAX, ad));
     codes.Add(I386.Push(Reg32.EAX));
     AddConstructor(codes);
     codes.Add(I386.AddR(Reg32.ESP, Val32.New(4)));
 }
开发者ID:7shi,项目名称:LLPML,代码行数:8,代码来源:TypeBase.cs

示例7: AddConstCodes

        protected bool AddConstCodes(OpModule codes, string op, Addr32 dest)
        {
            var v = GetConst();
            if (v == null) return false;

            v.AddCodesV(codes, op, dest);
            return true;
        }
开发者ID:7shi,项目名称:LLPML,代码行数:8,代码来源:Operator.cs

示例8: AddCodesV

 public override void AddCodesV(OpModule codes, string op, Addr32 dest)
 {
     var t = Var.Get(Target);
     if (t == null)
         throw Abort("addrof: variable required");
     var ad = t.GetAddress(codes);
     codes.Add(I386.Lea(Reg32.EAX, ad));
     codes.AddCodes(op, dest);
 }
开发者ID:7shi,项目名称:LLPML,代码行数:9,代码来源:AddrOf.cs

示例9: AddCodesV

        public override void AddCodesV(OpModule codes, string op, Addr32 dest)
        {
            var f = Parent.GetFunction(Tag);
            if (f == null) throw Abort("is: can not find: {0}", Tag);

            TypeOf.AddCodes(this, Parent, values[1] as NodeBase, codes, "push", null);
            TypeOf.AddCodes(this, Parent, values[0] as NodeBase, codes, "push", null);
            codes.Add(I386.CallD(f.First));
            codes.Add(I386.AddR(Reg32.ESP, Val32.New(8)));
            codes.AddCodes(op, dest);
        }
开发者ID:7shi,项目名称:LLPML,代码行数:11,代码来源:Is.cs

示例10: AddCodesV

 public override void AddCodesV(OpModule codes, string op, Addr32 dest)
 {
     var t = Type;
     var st = Source.Type;
     if (st is TypeIntBase && t.Size < st.Size)
     {
         Source.AddCodesV(codes, "mov", null);
         t.AddGetCodes(codes, op, dest, null);
     }
     else
         Source.AddCodesV(codes, op, dest);
 }
开发者ID:7shi,项目名称:LLPML,代码行数:12,代码来源:Cast.cs

示例11: AddSetCodes

        // set value
        public override void AddSetCodes(OpModule codes, Addr32 ad)
        {
            var flag = !ad.IsAddress && ad.Register == Var.DestRegister;
            if (flag) codes.Add(I386.Push(ad.Register));

            codes.Add(I386.Push(Reg32.EAX));
            codes.Add(I386.PushA(ad));
            codes.Add(codes.GetCall("delegate", DelgFunc.Free));
            codes.Add(I386.AddR(Reg32.ESP, Val32.New(4)));
            codes.Add(codes.GetCall("delegate", DelgFunc.Duplicate));
            codes.Add(I386.AddR(Reg32.ESP, Val32.New(4)));

            if (flag) codes.Add(I386.Pop(ad.Register));
            base.AddSetCodes(codes, ad);
        }
开发者ID:7shi,项目名称:LLPML,代码行数:16,代码来源:TypeFunction.cs

示例12: AddCodesV

        public override void AddCodesV(OpModule codes, string op, Addr32 dest)
        {
            if (AddConstCodes(codes, op, dest)) return;

            var v = values[0] as NodeBase;
            if (!OpModule.NeedsDtor(v))
                v.AddCodesV(codes, op, dest);
            else
            {
                v.AddCodesV(codes, "mov", null);
                codes.Add(I386.Push(Reg32.EAX));
                codes.AddCodes(op, dest);
                codes.AddDtorCodes(v.Type);
            }
        }
开发者ID:7shi,项目名称:LLPML,代码行数:15,代码来源:Expression.cs

示例13: FromNameWA

 public static OpCode FromNameWA(string op, Reg32 op1, Addr32 op2)
 {
     byte b;
     switch (op)
     {
         case "movzx":
             b = 0xb7;
             break;
         case "movsx":
             b = 0xbf;
             break;
         default:
             throw new Exception("invalid operator: " + op);
     }
     return OpCode.NewA(Util.GetBytes2(0x0f, b), Addr32.NewAdM(op2, (byte)op1));
 }
开发者ID:7shi,项目名称:LLPML,代码行数:16,代码来源:I386.Movx.16.cs

示例14: AddCodesA

 public void AddCodesA(string op, Addr32 dest, Addr32 ad)
 {
     switch (op)
     {
         case "push":
             if (ad != null)
                 Add(I386.PushA(ad));
             else
                 Add(I386.Push(Reg32.EAX));
             break;
         default:
             if (ad != null) Add(I386.MovRA(Reg32.EAX, ad));
             if (dest != null) Add(I386.FromName2AR(op, dest, Reg32.EAX));
             break;
     }
 }
开发者ID:7shi,项目名称:LLPML,代码行数:16,代码来源:OpCodes.cs

示例15: AddCodesV

        public override void AddCodesV(OpModule codes, string op, Addr32 dest)
        {
            if (AddConstCodes(codes, op, dest)) return;

            var last = new OpCode();
            for (int i = 0; i < values.Count; i++)
            {
                var v = values[i] as NodeBase;
                v.AddCodesV(codes, "mov", null);
                codes.Add(I386.Test(Reg32.EAX, Reg32.EAX));
                codes.Add(I386.Jcc(Cc.Z, last.Address));
            }
            codes.Add(I386.MovR(Reg32.EAX, Val32.New(1)));
            codes.Add(last);
            codes.AddCodes(op, dest);
        }
开发者ID:7shi,项目名称:LLPML,代码行数:16,代码来源:AndAlso.cs


注:本文中的Girl.X86.Addr32类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。