tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: 4byte aligned com(4) and PCI_MAPREG_TYPE_MEM



On Tue, Feb 11, 2014 at 04:19:26PM +0000, Eduardo Horvath wrote:
> 
> We really should enhance the bus_dma framework to add bus_space-like 
> accessor routines so we can implement something like this.  Using bswap is 
> a lousy way to implement byte swapping.  Yes, on x86 you have byte swap 
> instructions that allow you to work on register contents.  But most RISC 
> CPUs do the byte swapping in the load/store path.  That really doesn't 
> map well to the bswap API.  Instead of one load or store operation to 
> swap a 64-bit value, you need a load/store plus another dozen shift and 
> mask operations.  
> 
> I proposed such an extension years ago.  Someone might want to resurrect 
> it.

What you don't want to have is an API that swaps data in memory
(unless that is really what you want to do).

IIRC modern gcc detects uses of its internal byteswap function
that are related to memory read/write and uses the appropriate
byte-swapping memory access.

I can see the advantage of being able to do byteswap in the load/store
path, but sometimes that can't be arranged and a byteswap instruction
is very useful.
I really can't imagine implementing it being a big problem!

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index