NASM - The Netwide Assembler

NASM Forum => Other Discussion => Topic started by: BalticMusicFan on February 19, 2018, 02:20:51 AM

Title: linux code inside windows binary?
Post by: BalticMusicFan on February 19, 2018, 02:20:51 AM
I have been thinking about how to add linux operating system support for own windows program. One way would be running it under Wine and fix any incompatibilities.
On the other hand 64 bit platform provides easy way to code position independent code. I guess NASM would compile same functional linux bytecode into windows binary. That would be more interesting way to prevent duplicating same program logic, where possible.
It would make sense to have three executable sections (one for windows, one for linux and one for code that works for both). I am looking for linux procedures that would be required to pick up latter two in memory.

Any bright ideas?
Title: Re: linux code inside windows binary?
Post by: Holmes on February 23, 2018, 11:20:59 AM
No bright ideas unfortunately, but I'm very interested to see if you can pull this off. You're not the first one to try though so good luck!
Title: Re: linux code inside windows binary?
Post by: Cyrill Gorcunov on February 23, 2018, 10:23:31 PM
This won't work: OS always figures out the executable from the program header, which of course is different between OS. That said you won't make it work inside one single binary (except of course if you write own windows/linux drivers).