On 4 May 2011 20:48, Blue Swirl <blauwir...@gmail.com> wrote: > On Wed, May 4, 2011 at 3:59 AM, Max Filippov <jcmvb...@gmail.com> wrote: >> Tensilica iss provides support for applications running in freestanding >> environment through SIMCALL command. It is used by Tensilica libc to >> access argc/argv, for file I/O, etc. >> >> Signed-off-by: Max Filippov <jcmvb...@gmail.com> >> --- >> target-xtensa/helpers.h | 1 + >> target-xtensa/op_helper.c | 7 ++ >> target-xtensa/simcall.c | 157 >> +++++++++++++++++++++++++++++++++++++++++++++
The existing simcall/semihosting implementations are in arm-semi.c and m68k-semi.c in the top level directory. I think xtensa should do the same (unless somebody wants to propose moving arm and m68k instead...) >> +void HELPER(simcall)(void) >> +{ >> + simcall(env->regs); > > Maybe this should be enabled only with -semihosting parameter, like > ARM and m68k. Consider for example what could happen if this would be > issued from userland when used with an OS. +1 for consistency with arm/m68k. This applies more generally: for example if there's any chance there might be a linux-user implementation for xtensa then you want to use the softmmu-semi.h helpers so the memory access will work in both setups. m68k and ARM also both funnel semihosting through the interrupt/ exception mechanisms; I haven't figured out if there's a good reason for that that would make it worth copying in xtensa :-) >> + SYS_exit = 1, > I think these names may easily conflict with system defines, please > use for example TARGET_SYS_exit etc. Renaming's safe, but as it happens arm-semi.c has been using SYS_EXIT &c with no problems, so I don't think it's a big deal either way. -- PMM