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


C# Compiler.Mov方法代码示例

本文整理汇总了C#中Compiler.Mov方法的典型用法代码示例。如果您正苦于以下问题:C# Compiler.Mov方法的具体用法?C# Compiler.Mov怎么用?C# Compiler.Mov使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Compiler的用法示例。


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

示例1: CreateMethod

 private IntPtr CreateMethod(IntPtr stub)
 {
     Compiler compiler = new Compiler();
     compiler.NewFunction(CallingConvention.Default, typeof(Func<int>));
     GPVar x = compiler.NewGP(VariableType.INT32);
     compiler.Mov(x, 2);
     compiler.Ret(x);
     compiler.EndFunction();
     return compiler.Make();
 }
开发者ID:modulexcite,项目名称:nasmjit,代码行数:10,代码来源:TestMethodStub.cs

示例2: Main

        private static void Main(string[] args)
        {
            TestExceptionHandling test = new TestExceptionHandling();
            test.RunTest();

            Compiler compiler = new Compiler();
            CallingConvention callingConvention = CallingConvention.Default;
            compiler.NewFunction(callingConvention, typeof(Func<int>));
            GPVar var = compiler.NewGP();
            compiler.Mov(var, 3);
            compiler.Ret(var);
            compiler.EndFunction();
            IntPtr ptr = compiler.Make();
            Method1 method = (Method1)Marshal.GetDelegateForFunctionPointer(ptr, typeof(Method1));
            int result = method();
            Console.WriteLine(result);

            IntPtr method2Ptr = CreateMethodStub();
            TestMethod method2 = (TestMethod)Marshal.GetDelegateForFunctionPointer(method2Ptr, typeof(TestMethod));
            Console.WriteLine(method2());
        }
开发者ID:modulexcite,项目名称:nasmjit,代码行数:21,代码来源:Program.cs

示例3: GenerateLoadExceptionMessage

 private static void GenerateLoadExceptionMessage(Compiler c, GPVar dst, GPVar exceptionVariable)
 {
     c.Mov(dst, Mem.dword_ptr(exceptionVariable, ExceptionData_CodeOffset));
 }
开发者ID:modulexcite,项目名称:nasmjit,代码行数:4,代码来源:TestExceptionHandling.cs

示例4: GenerateLoadCurrentException

 private static void GenerateLoadCurrentException(Compiler c, GPVar dst, GPVar threadDataVariable)
 {
     GenerateLoadThreadData(c, dst, threadDataVariable);
     c.Mov(dst, Mem.sysint_ptr(dst, ThreadData_ExceptionDataOffset));
 }
开发者ID:modulexcite,项目名称:nasmjit,代码行数:5,代码来源:TestExceptionHandling.cs

示例5: GenerateLoadThreadData

 private static void GenerateLoadThreadData(Compiler c, GPVar dst, GPVar threadDataVariable)
 {
     c.Mov(dst, threadDataVariable);
 }
开发者ID:modulexcite,项目名称:nasmjit,代码行数:4,代码来源:TestExceptionHandling.cs

示例6: GenerateNewException

 private static void GenerateNewException(Compiler c, GPVar dst, Imm code)
 {
     GPVar var = c.NewGP();
     c.Mov(var, code);
     CompilerFunctionCall call = c.Call(AllocateExceptionFunction, CallingConvention.Default, typeof(Func<int, IntPtr>));
     call.SetArgument(0, var);
     call.SetReturn(dst);
 }
开发者ID:modulexcite,项目名称:nasmjit,代码行数:8,代码来源:TestExceptionHandling.cs

示例7: GenerateWriteLine

 private static void GenerateWriteLine(Compiler c, Imm value)
 {
     GPVar var = c.NewGP();
     c.Mov(var, value);
     GenerateWriteLine(c, var);
 }
开发者ID:modulexcite,项目名称:nasmjit,代码行数:6,代码来源:TestExceptionHandling.cs

示例8: BuildCpuIdFunction

        private static CpuIdMethod BuildCpuIdFunction()
        {
            Compiler compiler = new Compiler();

            compiler.NewFunction(CallingConvention.Default, typeof(Action<IntPtr, IntPtr, IntPtr, IntPtr>));
            compiler.Function.SetHint(FunctionHints.Naked, true);

            GPVar eaxPtr = compiler.ArgGP(0);
            GPVar ebxPtr = compiler.ArgGP(1);
            GPVar ecxPtr = compiler.ArgGP(2);
            GPVar edxPtr = compiler.ArgGP(3);

            GPVar eax = compiler.NewGP();
            GPVar ebx = compiler.NewGP();
            GPVar ecx = compiler.NewGP();
            GPVar edx = compiler.NewGP();

            compiler.Mov(eax, Mem.dword_ptr(eaxPtr));
            compiler.Cpuid(eax, ebx, ecx, edx);
            compiler.Mov(Mem.dword_ptr(eaxPtr), eax);
            compiler.Mov(Mem.dword_ptr(ebxPtr), ebx);
            compiler.Mov(Mem.dword_ptr(ecxPtr), ecx);
            compiler.Mov(Mem.dword_ptr(edxPtr), edx);

            compiler.Ret();
            compiler.EndFunction();
            CpuIdMethod cpuId = (CpuIdMethod)Marshal.GetDelegateForFunctionPointer(compiler.Make(), typeof(CpuIdMethod));

            return cpuId;
        }
开发者ID:modulexcite,项目名称:nasmjit,代码行数:30,代码来源:CpuInfo.cs


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