开发者

Convert OMF16 to OBJ32

开发者 https://www.devze.com 2023-02-28 06:11 出处:网络
Is there a way to convert from OMF 16 bit 开发者_如何转开发object file format to COFF 32 bit object file format?I seriously doubt there would exist one. Code designed to be ran in 16 bit environment i

Is there a way to convert from OMF 16 bit 开发者_如何转开发object file format to COFF 32 bit object file format?


I seriously doubt there would exist one. Code designed to be ran in 16 bit environment is binary incompatible with 32 bit mode. For example there's an instruction that tells the CPU to flip bit sizes for the upcoming instruction. In 16 bit mode such an instruction is needed to use 32 bit instructions. However the same opcode is needed to use 16 bit instructions in 32 bit mode.

Whether a series of opcodes are to be assumed to be 16 or 32 bits is specified in the segment descriptor.

Anyway, if you have 16 bit code that you'd like to use in 32 bit mode, that has no OS dependencies, you can use that by disaassembling it using IDA, then recompile it with a 32bit assembler. Of course only if that's permitted by its license. (although this could be fair use, but IANAL).

If the code is also tied to the underlying OS, this could be a lot more difficult, and would require to rewrite perhaps significant portions of the code.


Presumably the OMF16 code targets 16 bit x86 real-mode or 286 protected mode? That being the case, the object file format is not really your issue, the code itself is entirely incompatible since it uses different register sizes and a different addressing scheme.

Moreover if the code is targetted for DOS, Win16 or OS/2 (i.e. systems that used OMF16), then targeting it to a 32 bit target is not just a case of converting the object file format.

You need to rebuild from the source which give the tags to the question is either C or C++? Either that or you have a significant reverse engineering task on your hands!


I've searched on the net, and found these links: The first one is a collection of tools:

http://sourceware.org/binutils/

The second one is a tool I think you need: http://sourceware.org/binutils/docs/binutils/objcopy.html

They are not work in all cases(bazsi77 above), just test it.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号