本文整理汇总了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));
}
示例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);
}
示例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);
}
}
示例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;
}
}
示例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;
}
}
示例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)));
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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));
}
示例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;
}
}
示例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);
}