I got an interesting question via fediverse DM from @tsia_@chaos.social and I wanted to share it and my response with the world, so that other beings may have a way to Google it.
Please always feel free to ask me things like this, I really love sharing knowledge and am happy to answer interesting questions - and most questions are interesting :)
Original question
@littlefox since you seem to know a lot of things and also a lot of weird things, here is a thought experiment: I guess it would be possible to develop a CPU that could switch between ARM and x86 at boot but is in conceivable to build one that could run both architectures at the same time? Would OSes even be able to handle that?
My reply
@tsia_ CPU that selects ARM and x86 at boot: definitely - both at the same time though.. define at the same time
- I can run a process with x86 instruction set and a process with ARM instruction set “at the same time” like in preemptive multitasking
- I can have a program that mixes x86 and ARM instructions
For the first case: definitely, with OS support. When scheduling a process, the OS would also have to set a register to select the instruction set to use. The OS would also have to support the various data structures of this multi-CPU, since instruction set is only a small part of what differentiates those CPU architectures - things like virtual memory mapping, the GDT and co come to mind. And those things would have to be abstracted from the userspace process - you most likely would not want to have a CPU that understands both ARM and x86 memory mapping data structures at the same time and have every mapping described in BOTH formats at once
Oh and … this is already done! ARM does this with normal ARM and Thumb instruction sets, amd64 (aka x86-64) does this for 64 or 32 bit code (via properties in the GDT, select the correct segment to switch it to either 32 or 64 bit mode) and i386 also did that for running 16 bit code alongside 32 bit code - see VM86 mode