Yes. The boot loader would need to be able to load the exe the same way as windows would by parsing its header and correctly allocating/unpacking the correct regions. This is easier with 64bit PIC code. The tricky part from the C++ side is the dependencies - you will have to either compile without stdlib/win API or implement your own replacements (Some VC libraries are standalone asm and can be used e.g. string.h memset/memcpy). In either case you will have to define some OS-specific layer to interact with the underlying core/system; this can be done by defining your C API in a header then implementing you code in an external asm COFF file that you link during your C build.
EDIT: I forgot to add for C++ specifically you will also have to provide the runtime handling for constructs such as new/delete operators (if you use them), try/catch and others [including runtime checks] but I suggest you avoid using these except for new/delete.
|