> [email protected] wrote:
> Richard Spencer wrote on Friday, September 02, 2011 4:35 PM
> > if (templ == 0x6f && (armregs[10] & 0xdffff) == 0x1c) templ=0x1c;
> > else if (templ == 0x71 && (armregs[12] & 0xdffff) == 0x1c) templ = 0x1c;
>
> > (NB. Untested.)
>
> That's what I thought as well at first, but the same bug will occur for any
> of the SWIs that RPCEmu intercepts so I
> believe it is better that the same is done for them all so RPCEmu can always
> process them if it wants to.
But, as I stated above, my reading of the code you wrote is that ALL SWI's
invoked by CallASWI(R12) are modified. Without your changes it is
OS_CallASWI(R12) that reaches the code at 'realswi:' calling
exception(SUPERVISOR, 0xc, 4); - with them it's the raw SWI number.
I agree with you that we want to avoid the same bug occurring with other SWI's
that are trapped by RPCEmu, but AFAICS it isn't just trapped SWI's that reach
the changed code. My if/else test above (written without looking at the code
in arm_common.c I'm afraid) would need to be extended to include the other
trapped SWI's to be useful, but I still think this approach is preferred over
disabling CallASWI completely.
uint32_t callaswi = 0xffffffff; // allow OS_WriteC
if (templ == 0x6f) callaswi = armregs[10];
else if (templ == 0x71) callaswi = armregs[12];
if (callaswi != 0xffffffff) {
switch (callaswi & 0xdffff) {
case 0x1c: templ = 0x1c; break;
case 0x7: if (armregs[0] == 0x15) templ = 0x7; break;
#ifdef RPCEMU_NETWORKING
case ARCEM_SWI_NETWORK: templ = ARCEM_SWI_NETWORK; break;
#endif
...etc...
default: break;
}
}
It's an important bug to fix though.
Regards,
Richard
_______________________________________________
Rpcemu mailing list
[email protected]
http://www.riscos.info/cgi-bin/mailman/listinfo/rpcemu