Hi Folks ! So I started "porting" over (read: copying) the arm semihosting code to ppc to mimmic what Keith did for risv (mostly for picolibc support).
I noticed that the bulk of arm-semi.c (or riscv-semi.c) is trivially made completely generic by doing a couple of changes: - Make most functions take a CPUState instead of the architecture specific "env" - Provide arch helpers to retreive the op, set the result, do the flen bug hack and possibly a couple of others (I'm not done yet). There are other archs who do semihosting completely differently but at least those 3 can share code. Any objection/comment on the approach ? What I'll probably do is get things going first with my ppc version (which I made more/less generic but still located in target/ppc) at which point I can post an RFC so you get an idea, and we find a good location for it. >From thre we might consider fixing some of the worst crap in there doing backwards compatible extensions if we care enough :-) Cheers, Ben.