[PATCH] arm: add SDIV/UDIV emulation for ARMv7 processors

Russell King - ARM Linux linux at arm.linux.org.uk
Sat Sep 22 08:57:37 EDT 2012


On Sat, Sep 22, 2012 at 03:49:23PM +0400, Vladimir Murzin wrote:
> The Virtualization Extensions introduce the requirement for an ARMv7-A
> implementation to include SDIV and UDIV.  Any implementation of the
> Virtualization Extensions must include the SDIV and UDIV instructions
> in the Thumb and ARM instruction sets.
> 
> In an ARMv7-A implementation that does not include the Virtualization
> Extensions, it is IMPLEMENTATION DEFINED whether:
>  *  SDIV and UDIV are not implemented
>  *  SDIV and UDIV are implemented only in the Thumb instruction set
>  *  SDIV and UDIV are implemented in the Thumb and ARM instruction sets.

We don't want to do emulation of instructions in the kernel because it's
slow.  It's far better for userspace to figure this stuff out itself and
select appropriate libraries and instructions to use than to have the CPU
take an exception, have to save a lot of state, and then emulate the
instruction.

We learnt that with the old FPA emulation code.  We're not making the same
mistake again.

If there's a problem with that, the folk to complain to are at ARM Ltd
for this "implementation defined" madness when it comes to instructions.



More information about the linux-arm-kernel mailing list