Richard Spencer wrote on Fri, 2 Sep 2011:

> > [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.

I may have misread the code, but my understanding was the templ variable is 
only used
to check the SWI numbers in the subroutine and would not effect what was used
when the realswi was called. That is why I didn't think we needed extra code
to handle the special cases. The advantages of this is that if extra calls are
intercepted in future you won't need to change two places in the subroutine.
 
I'm quite happy for any code that does the job to be used though. So please
feel free to ignore my suggestion or use anything else that works. I will
just be pleased to be able to test SDL game ports under RPCEmu again.
 
Regards,
Alan                                      
_______________________________________________
Rpcemu mailing list
[email protected]
http://www.riscos.info/cgi-bin/mailman/listinfo/rpcemu

Reply via email to