From: NIIBE Y. <gn...@m1...> - 2001-12-20 01:29:17
|
Jeremy Siegel wrote: > Is there a reason not to apply the following patches for these? Not at all. Please do commit. > /* > * handle an instruction that does an unaligned memory access > * - have to be careful of branch delay-slot instructions that fault > + * SH3: > * - if the branch would be taken PC points to the branch > * - if the branch would not be taken, PC points to delay-slot > + * SH4: > + * - PC always points to delayed branch > * - return 0 if handled, -EFAULT if failed (may not return if in kernel) > */ I think that SH-4 was not on the focus at that time. I have a comment on the expressions calculating PC. It's OK, but it would be good if we can improve the implementation. > + regs->pc += ((signed char)(instruction&0x00FF))*2 + 4; [...] > + regs->pc += ((signed char)(instruction&0x00FF))*2 + 4; [...] > + regs->pc += (((signed short)(instruction<<4))>>3) + 4; [...] > + regs->pc += (((signed short)(instruction<<4))>>3) + 4; We want something like "ext.b" or "ext.w" (of SuperH assembler) here. In general, it's not good practice using type coercion to do the calculation. -- |