[Rpcemu] Code review

Matthew Howkins rpcemu-list at howkins.me.uk
Tue Feb 21 11:30:39 PST 2012

> In function SWPWord() of ArmDynarecOps.h line 343
> is "addr=armregs[RN]&~3;"
> while the corresponding line 925 in arm.c is "addr=armregs[RN];".
> I think the dynamic version is the correct one.

I don't think either of those is correct, but they will be wrong only when
the address is not aligned. According to the ARM ARM unaligned addresses
should be rotated like LDR. I will look to incorporate this change in the
next version.

> I have also looked at the file codegen_x86.c.
> The function generateshiftflags() seems to be mishandling the C flag
> (at least if the comments match te actual opcodes used).
> According to te Acorn Assembler book and what I see in arm.c
> the flag C is left untouched if no shift occurs
> and flags NZV are always left untouched.
> This means that code should look like :
> /*MOVB *pcpsr,%cl*/
> if (no shift)
>    do nothing
> else
>     /*AND $ZFLAG+NFLAG,%cl*/
>     do shift
>     /*JNC nocarry*/
>    /*OR $CFLAG,%cl*/
> In the code it seems that flag C is always set to 0 if no shift occurs
> and when a shift occurs it is sometimes set to 1 but never reset to 0.
I agree, this looks wrong to me as well. The C flag is being modified in
situations when it should be preserved. Again, I will look to apply a fix
for this.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riscos.info/pipermail/rpcemu/attachments/20120221/48d3aab4/attachment.html>

More information about the Rpcemu mailing list