简体   繁体   English

用于.NET的轻量级x86仿真器/在托管环境中执行x86代码

[英]Lightweight x86 Emulator for .NET / Executing x86 code in a managed environment

Our company is migrating its entire product line from a C++ codebase to the .NET Framework. 我们公司正在将其整个产品线从C ++代码库迁移到.NET Framework。 We have a very large codebase, and this migration is being done incrementally over the course of many years. 我们有一个非常大的代码库,这个迁移在多年的过程中逐步完成。

We would like to enjoy some of the benefits of pure managed code, such as Silverlight, but there are many legacy C++/x86 modules that will take time for us to port to .NET. 我们希望享受纯托管代码的一些好处,例如Silverlight,但是有许多遗留的C ++ / x86模块需要时间来移植到.NET。

One solution would be for us to load these modules into a lightweight x86 emulator running in a small memory sandbox in the .NET Framework. 一种解决方案是我们将这些模块加载到.NET Framework中的小内存沙箱中运行的轻量级x86模拟器中。 This would allow us to call into legacy x86 DLL code while maintaining a pure managed application. 这将允许我们在维护纯托管应用程序的同时调用遗留x86 DLL代码。

Does anyone know of such a project? 有谁知道这样的项目?

Sincerely, 此致

Dan

I don't know of a project that would allow this. 我不知道一个允许这个的项目。

That being said, I don't think this is a realistic expectation in any case. 话虽如此,我认为这无论如何都不是一个现实的期望。 Using native code isn't just about being able to run x86 instructions. 使用本机代码不仅仅是能够运行x86指令。

The larger issue will be about utilization of library code. 更大的问题是关于图书馆代码的利用。 This isn't going to be portable into an emulator, since the emulator would probably not just need to implement x86 instructions, but also simulate the Windows API, etc. 这不可能移植到模拟器中,因为模拟器可能不仅需要实现x86指令,还可以模拟Windows API等。

If the native code is just pure numeric code, porting it is probably easier than testing it under an emulator. 如果本机代码只是纯数字代码,移植它可能比在模拟器下测试它更容易。 If it's complex code using libraries, I don't see this working practically, even if such an emulator existed. 如果它是使用库的复杂代码,我不认为这实际上是有效的,即使存在这样的仿真器。

I would just focus on the functionality you need to truly be purely managed, and try to get it migrated. 我只关注真正纯粹管理所需的功能,并尝试将其迁移。 C++/CLI makes this simpler (provided your native code was in C++), since you can always try compiling one file at a time with /clr:pure enabled, and just fix errors as needed. C ++ / CLI使这更简单(假设您的本机代码使用C ++),因为您始终可以尝试使用/clr:pure启用一次编译一个文件,并根据需要修复错误。

For things that don't require 100% managed, the interop in C++/CLI is a good stepping stone until you can port your code base across. 对于不需要100%托管的东西,C ++ / CLI中的互操作是一个很好的垫脚石,直到您可以移植代码库。

Change for Java instead of .net. 更改Java而不是.net。 Then you can use this: 然后你可以使用这个:

http://jpc.sourceforge.net http://jpc.sourceforge.net

to run existing code 运行现有代码

or compile to Java B-code from C++ using LLJVM or something similar. 或使用LLJVM或类似方法从C ++编译为Java B代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM