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


C# Cosmos类代码示例

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


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

示例1: AssembleNew

    //; Method 'System.UInt32  Cosmos.Kernel.Plugs.CPU.HasCPUIDSupport()'
    //; Locals:
    //; 	(0) 0	4	ebp - 04h (Type = System.UInt32)
    //; Arguments:
    //; 	(none)
    //; 	ReturnSize: 4
    public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo) {
        /*XS.Pushfd();
        new CPUx86.Pop("eax");
        new CPUx86.Move("ecx", "eax");

        new CPUx86.Xor("eax", "200000h");
        new CPUx86.Push("eax");
        XS.Popfd();

        XS.Pushfd();
        new CPUx86.Pop("ebx");
        new CPUx86.Xor("eax", "ebx");
        new CPUx86.And("eax", "200000h");
        new CPUx86.JumpIfZero(".not");

        new CPUx86.Move("eax", "1");
        new CPUx86.Jump(".return");

        new CPUAll.Label(".not");
        new CPUx86.Xor("eax", "eax");

        new CPUAll.Label(".return");
        new CPUx86.Push("ecx");
        XS.Popfd();

        new CPUx86.Push("eax");*/
      XS.Push(0);
    }
开发者ID:ChrisJamesSadler,项目名称:Cosmos,代码行数:34,代码来源:CPUID.cs

示例2: AssembleNew

 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
 {
     // $this   ebp+8
     new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 8 };
     new Mov { DestinationReg = Registers.EAX, SourceReg = Registers.EAX, SourceIsIndirect = true };
     new Push { DestinationIsIndirect = true, DestinationReg = Registers.EAX, DestinationDisplacement = 8 };
 }
开发者ID:nstone101,项目名称:Cosmos,代码行数:7,代码来源:Array_get_Length.cs

示例3: AssembleNew

        public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
        {
            // method signature: $this, object @object, IntPtr method
            var xAssembler = aAssembler;
            var xMethodInfo = (MethodInfo)aMethodInfo;
            XS.Comment("Save target ($this) to field");
            XS.Comment("-- ldarg 0");
            Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
            XS.Comment("-- ldarg 1");
            Ldarg.DoExecute(xAssembler, xMethodInfo, 1);
            XS.Comment("-- stfld _target");
            Stfld.DoExecute(xAssembler, xMethodInfo, "System.Object System.Delegate._target", xMethodInfo.MethodBase.DeclaringType, true, false);
            XS.Comment("Save method pointer to field");
            XS.Comment("-- ldarg 0");
            Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
            XS.Comment("-- ldarg 2");
            Ldarg.DoExecute(xAssembler, xMethodInfo, 2);
            XS.Comment("-- stfld _methodPtr");
            Stfld.DoExecute(xAssembler, xMethodInfo, "System.IntPtr System.Delegate._methodPtr", xMethodInfo.MethodBase.DeclaringType, true, false);
            XS.Comment("Saving ArgSize to field");
            uint xSize = 0;
            foreach (var xArg in xMethodInfo.MethodBase.DeclaringType.GetMethod("Invoke").GetParameters())
            {
                xSize += ILOp.Align(ILOp.SizeOfType(xArg.ParameterType), 4);
            }

            XS.Comment("-- ldarg 0");
            Ldarg.DoExecute(xAssembler, xMethodInfo, 0);
            XS.Comment("-- push argsize");
            XS.Push(xSize);
            XS.Comment("-- stfld ArgSize");
            Stfld.DoExecute(xAssembler, xMethodInfo, "$$ArgSize$$", xMethodInfo.MethodBase.DeclaringType, true, false);
        }
开发者ID:fanoI,项目名称:Cosmos,代码行数:33,代码来源:DelegateCtorAsm.cs

示例4: AssembleNew

 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
 {
     new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x08 };
     new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
     new CPUx86.IN { DestinationReg = CPUx86.Registers.AX };
     new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
 }
开发者ID:Orvid,项目名称:Cosmos,代码行数:7,代码来源:IOPortImpl.cs

示例5: AssembleNew

    /* void Copy(Array sourceArray,			ebp + 0x1C
     *			 int sourceIndex,			ebp + 0x18
     *			 Array destinationArray,	ebp + 0x14
     *			 int destinationIndex,		ebp + 0x10
     *			 int length,				ebp + 0xC
     *			 bool reliable);			ebp + 0x8
     */
    public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo) {
      new CPUx86.Push { DestinationReg = CPUx86.Registers.EBP, DestinationIsIndirect = true, DestinationDisplacement = 0x1C };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, SourceValue = 12, Size = 32 }; // pointer is at the element size
      new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EAX, SourceIsIndirect = true }; // element size
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EBX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x18 };
      new CPUx86.Multiply { DestinationReg = CPUx86.Registers.EBX };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 16 };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.ESI, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x1C };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.ESI, SourceReg = CPUx86.Registers.EAX }; // source ptr
      new CPUx86.Push { DestinationReg = CPUx86.Registers.EBP, DestinationIsIndirect = true, DestinationDisplacement = 0x14 };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, SourceValue = 12, Size = 32 }; // pointer is at element size
      new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EAX, SourceIsIndirect = true };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x10 };
      new CPUx86.Multiply { DestinationReg = CPUx86.Registers.ECX };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 16 };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x14 };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.EDI, SourceReg = CPUx86.Registers.EAX };

      // calculate byte count to copy
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0x14 };
      new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = 12 };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.EAX, SourceIsIndirect = true };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EBP, SourceIsIndirect = true, SourceDisplacement = 0xC };
      new CPUx86.Multiply { DestinationReg = CPUx86.Registers.EDX };
      new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.EAX, };
      new CPUx86.Movs { Size = 8, Prefixes = CPUx86.InstructionPrefixes.Repeat };
    }
开发者ID:iSalva,项目名称:Cosmos,代码行数:36,代码来源:Array_InternalCopy.cs

示例6: UpdateAddress

 public override void UpdateAddress( Cosmos.Assembler.Assembler aAssembler, ref ulong aAddress )
 {
     if (SourceRef != null) {
         SourceValue = 0xFFFFFFFF;
     }
     base.UpdateAddress(aAssembler, ref aAddress);
 }
开发者ID:Orvid,项目名称:Cosmos,代码行数:7,代码来源:InstructionWithDestinationAndSource.cs

示例7: UpdateAddress

 public override void UpdateAddress( Cosmos.Assembler.Assembler aAssembler, ref ulong aAddress )
 {
     if (ArgumentRef != null) {
         ArgumentValue = 0xFFFFFFFF;
     }
     base.UpdateAddress(aAssembler, ref aAddress);
 }
开发者ID:Orvid,项目名称:Cosmos,代码行数:7,代码来源:InstructionWithDestinationAndSourceAndArgument.cs

示例8: DoExecute

        public static void DoExecute(Cosmos.Assembler.Assembler Assembler, MethodInfo aMethod, Type aDeclaringType, FieldInfo aField, bool aDerefValue, bool aDebugEnabled)
        {
            int xExtraOffset = 0;
            var xType = aMethod.MethodBase.DeclaringType;
            bool xNeedsGC = aDeclaringType.IsClass && !aDeclaringType.IsValueType;

            if (xNeedsGC)
            {
                xExtraOffset = 12;
            }

            var xActualOffset = aField.Offset + xExtraOffset;
            var xSize = aField.Size;
            DoNullReferenceCheck(Assembler, aDebugEnabled, 0);

            if (aDerefValue && aField.IsExternalValue)
            {
                new CPUx86.Mov
                {
                    DestinationReg = CPUx86.Registers.EAX,
                    SourceReg = CPUx86.Registers.ESP, SourceIsIndirect = true, SourceDisplacement = (int) xActualOffset
                };
                new CPUx86.Mov {DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, SourceReg = CPUx86.Registers.EAX};
            }
            else
                new CPUx86.Add {DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, SourceValue = (uint) (xActualOffset)};
        }
开发者ID:iSalva,项目名称:Cosmos,代码行数:27,代码来源:Ldflda.cs

示例9: Assemble

        public static void Assemble(Cosmos.Assembler.Assembler aAssembler, OpType aOpType, uint aElementSize, bool debugEnabled)
        {
            XS.Comment("Arraytype: " + aOpType.StackPopTypes.Last().FullName);
            XS.Comment("Size: " + aElementSize);

            DoNullReferenceCheck(aAssembler, debugEnabled, 4);
            // calculate element offset into array memory (including header)
            XS.Pop(XSRegisters.EAX);
            XS.Set(XSRegisters.EDX, aElementSize);
            XS.Multiply(XSRegisters.EDX);
            XS.Add(XSRegisters.EAX, (uint)(ObjectImpl.FieldDataOffset + 4));

            // pop the array now
            XS.Pop(XSRegisters.EDX);
            // translate it to actual memory
            XS.Set(XSRegisters.EDX, XSRegisters.EDX, sourceIsIndirect: true);

            if (aOpType.StackPopTypes.Last().GetElementType().IsClass)
            {
                XS.Set(XSRegisters.EDX, XSRegisters.EDX, sourceIsIndirect: true);
            }

            XS.Add(XSRegisters.EDX, XSRegisters.EAX);
            XS.Push(XSRegisters.EDX);
        }
开发者ID:Zino2201,项目名称:Cosmos,代码行数:25,代码来源:Ldelema.cs

示例10: UpdateAddress

 public override void UpdateAddress( Cosmos.Assembler.Assembler aAssembler, ref ulong aAddresss )
 {
     if (DestinationRef != null) {
         DestinationValue = 0xFFFFFFFF;
     }
     base.UpdateAddress(aAssembler, ref aAddresss);
 }
开发者ID:Orvid,项目名称:Cosmos,代码行数:7,代码来源:InstructionWithDestination.cs

示例11: WriteText

 public override void WriteText(Cosmos.Assembler.Assembler aAssembler, System.IO.TextWriter aOutput)
 {
     switch (Condition)
     {
         case FloatConditionalMoveTestEnum.Below:
             aOutput.Write("fcmovb");
             break;
         case FloatConditionalMoveTestEnum.Equal:
             aOutput.Write("fcmove");
             break;
         case FloatConditionalMoveTestEnum.BelowOrEqual:
             aOutput.Write("fcmovbe");
             break;
         case FloatConditionalMoveTestEnum.Unordered:
             aOutput.Write("fcmovu");
             break;
         case FloatConditionalMoveTestEnum.NotBelow:
             aOutput.Write("fcmovnb");
             break;
         case FloatConditionalMoveTestEnum.NotEqual:
             aOutput.Write("fcmovne");
             break;
         case FloatConditionalMoveTestEnum.NotBelowOrEqual:
             aOutput.Write("fcmovnbe");
             break;
         case FloatConditionalMoveTestEnum.Ordered:
             aOutput.Write("fcmovnu");
             break;
     }
     aOutput.Write(" ");
     aOutput.Write("ST0");
     aOutput.Write(", ");
     aOutput.Write(this.GetSourceAsString());
 }
开发者ID:Orvid,项目名称:Cosmos,代码行数:34,代码来源:FloatConditionalMove.cs

示例12: Assemble

        public static void Assemble(Cosmos.Assembler.Assembler aAssembler, OpType aOpType, uint aElementSize, bool debugEnabled)
        {
            new Comment("Arraytype: " + aOpType.StackPopTypes.Last().FullName);
            new Comment("Size: " + aElementSize);

            DoNullReferenceCheck(aAssembler, debugEnabled, 4);
            // calculate element offset into array memory (including header)
            new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
            new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceValue = aElementSize };
            new CPUx86.Multiply { DestinationReg = CPUx86.Registers.EDX };
            new CPUx86.Add { DestinationReg = CPUx86.Registers.EAX, SourceValue = (uint)(ObjectImpl.FieldDataOffset + 4) };

            // pop the array now
            new CPUx86.Pop { DestinationReg = CPUx86.Registers.EDX };
            // translate it to actual memory
            new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.RegistersEnum.EDX, SourceIsIndirect = true };

            if (aOpType.StackPopTypes.Last().GetElementType().IsClass)
            {
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.RegistersEnum.EDX, SourceIsIndirect = true };
            }

            new CPUx86.Add { DestinationReg = CPUx86.Registers.EDX, SourceReg = CPUx86.Registers.EAX };
            new CPUx86.Push { DestinationReg = CPUx86.Registers.EDX };
        }
开发者ID:CSharpLover,项目名称:Cosmos,代码行数:25,代码来源:Ldelema.cs

示例13: AssembleNew

 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo) {
  new LiteralAssemblerCode("%ifdef DEBUGSTUB");
  new LiteralAssemblerCode("pushad");
  new LiteralAssemblerCode("Call DebugStub_TraceOn");
  new LiteralAssemblerCode("popad");
  new LiteralAssemblerCode("%endif");
 }
开发者ID:nwiede,项目名称:Cosmos,代码行数:7,代码来源:DebuggerAsm.cs

示例14: DoExecute

        public static void DoExecute(Cosmos.Assembler.Assembler Assembler, Type aDeclaringType, string xFieldId, bool aDerefExternalField, bool debugEnabled) {
          var xOffset = GetFieldOffset(aDeclaringType, xFieldId);
          var xFields = GetFieldsInfo(aDeclaringType, false);
          var xFieldInfo = (from item in xFields
                            where item.Id == xFieldId
                            select item).Single();
          new Comment("Field = '" + xFieldId + "'");

            DoNullReferenceCheck(Assembler, debugEnabled, 0);

          new CPUx86.Pop { DestinationReg = CPUx86.Registers.ECX };

#if DOTNETCOMPATIBLE
			// pushed size is always 4 or 8
			var xSize = ILOp.Align(xFieldInfo.Size, 4);
#else
			var xSize = xFieldInfo.Size;
#endif

          new CPUx86.Add { DestinationReg = CPUx86.Registers.ECX, SourceValue = (uint)(xOffset) };

          if( xFieldInfo.IsExternalValue && aDerefExternalField)
          {
              new CPUx86.Mov { DestinationReg = CPUx86.Registers.ECX, SourceReg = CPUx86.Registers.ECX, SourceIsIndirect = true };
          }

          for (int i = 1; i <= (xSize / 4); i++) {
            new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.ECX, SourceIsIndirect = true, SourceDisplacement = (int)(xSize - (i * 4)) };
            new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
          }
          switch (xSize % 4) {
            case 1: {
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.AL, SourceReg = CPUx86.Registers.ECX, SourceIsIndirect = true };
                new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
                break;
              }
            case 2: {
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.AX, SourceReg = CPUx86.Registers.ECX, SourceIsIndirect = true };
                new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
                break;
              }

            case 3: //For Release
                    {
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceValue = 0 };
                new CPUx86.Mov { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.ECX, SourceIsIndirect = true };
                new CPUx86.ShiftRight { DestinationReg = CPUx86.Registers.EAX, SourceValue = 8 };
                new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };
                break;
              }
            case 0: {
                      break;
                    }
            default:
              throw new Exception(string.Format("Remainder size {0:D} {1:D} not supported!", xFieldInfo.FieldType.ToString(), xSize));
          }
        }
开发者ID:iSalva,项目名称:Cosmos,代码行数:59,代码来源:Ldfld.cs

示例15: AssembleNew

 public override void AssembleNew(Cosmos.Assembler.Assembler aAssembler, object aMethodInfo)
 {
     new LiteralAssemblerCode("%ifdef DEBUGSTUB");
       new LiteralAssemblerCode("push dword [EBP + 8]");
       new LiteralAssemblerCode("Call DebugStub_SendComplexNumber");
       new LiteralAssemblerCode("add ESP, 4");
       new LiteralAssemblerCode("%endif");
 }
开发者ID:Zino2201,项目名称:Cosmos,代码行数:8,代码来源:DebuggerAsm.cs


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