On Sun, Mar 17, 2013 at 7:52 AM, Nathan K. Ladwig (Netham45) <netham45@xxxxxxxxx> wrote: > I would like to begin work on getting GCC to target Windows RT (Windows on ARM) > > Here are the current relevant known details of the target: > Uses PEs > PEs seem to use the same header values as the x86 counterparts, except > with the 'Machine type' field set to 0x01C4, instead of 0x014C (See > http://i.imgur.com/KMjNuUF.png for more header information) > Can use ARM code, but interrupt handlers will (incorrectly) throw the > CPU back into THUMB mode upon return, therefore ARM code is highly > unstable > Because of this, THUMB2 is the preferred code format > > I admittedly have done very little work with GCC and I'm not 100% sure > where I would start on porting it to target Windows RT. My main > interest is to support desktop applications, which can be achieved > with the jailbreak tool I maintain. My main goal is to get GCC running > to aid development on the platform, I don't have a specific > application in mind (though, I suppose that X-Chat would make a good > test case, due to it's complexity). > > I've looked at 'cegcc', and I believe that CE is too far removed from > Windows RT to be of any use, I believe that a better starting point > would be to get the same GCC that targets x86/x64 Windows to target > Windows on ARM. > > So, my main question is: Where do I start doing this? There's lots of goodies in winnt.h. You might start by looking through the header and getting a feel for the platform. Below is from my copy of <winnt.h> located in C:\Program Files (x86)\Windows Kits\8.0\Include\um\winnt.h (near line 14150). 0x01c4 is defined. I might have got it with my Visual Studio 2012 install; or from the Windows Phone {7|8} SDK install. I did not check between installations a few months back. Jeff #define IMAGE_FILE_MACHINE_UNKNOWN 0 #define IMAGE_FILE_MACHINE_I386 0x014c // Intel 386. #define IMAGE_FILE_MACHINE_R3000 0x0162 // MIPS little-endian, 0x160 big-endian #define IMAGE_FILE_MACHINE_R4000 0x0166 // MIPS little-endian #define IMAGE_FILE_MACHINE_R10000 0x0168 // MIPS little-endian #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169 // MIPS little-endian WCE v2 #define IMAGE_FILE_MACHINE_ALPHA 0x0184 // Alpha_AXP #define IMAGE_FILE_MACHINE_SH3 0x01a2 // SH3 little-endian #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3 #define IMAGE_FILE_MACHINE_SH3E 0x01a4 // SH3E little-endian #define IMAGE_FILE_MACHINE_SH4 0x01a6 // SH4 little-endian #define IMAGE_FILE_MACHINE_SH5 0x01a8 // SH5 #define IMAGE_FILE_MACHINE_ARM 0x01c0 // ARM Little-Endian #define IMAGE_FILE_MACHINE_THUMB 0x01c2 // ARM Thumb/Thumb-2 Little-Endian #define IMAGE_FILE_MACHINE_ARMNT 0x01c4 // ARM Thumb-2 Little-Endian #define IMAGE_FILE_MACHINE_AM33 0x01d3 #define IMAGE_FILE_MACHINE_POWERPC 0x01F0 // IBM PowerPC Little-Endian #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1 #define IMAGE_FILE_MACHINE_IA64 0x0200 // Intel 64 #define IMAGE_FILE_MACHINE_MIPS16 0x0266 // MIPS #define IMAGE_FILE_MACHINE_ALPHA64 0x0284 // ALPHA64 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366 // MIPS #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466 // MIPS #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64 #define IMAGE_FILE_MACHINE_TRICORE 0x0520 // Infineon #define IMAGE_FILE_MACHINE_CEF 0x0CEF #define IMAGE_FILE_MACHINE_EBC 0x0EBC // EFI Byte Code #define IMAGE_FILE_MACHINE_AMD64 0x8664 // AMD64 (K8) #define IMAGE_FILE_MACHINE_M32R 0x9041 // M32R little-endian #define IMAGE_FILE_MACHINE_CEE 0xC0EE