forked from len0rd/rockbox
iPod: Fix endian bug with disk reads and writes to a non-aligned memory buffer.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8369 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4d83cb35f0
commit
cf0e3d355c
1 changed files with 2 additions and 2 deletions
|
|
@ -380,7 +380,7 @@ static void copy_read_sectors(unsigned char* buf, int wordcount)
|
||||||
{ /* loop compiles to 9 assembler instructions */
|
{ /* loop compiles to 9 assembler instructions */
|
||||||
/* takes 14 clock cycles (2 pipeline stalls, 1 wait) */
|
/* takes 14 clock cycles (2 pipeline stalls, 1 wait) */
|
||||||
tmp = ATA_DATA;
|
tmp = ATA_DATA;
|
||||||
#ifdef SWAP_WORDS
|
#if defined(SWAP_WORDS) || defined(ROCKBOX_LITTLE_ENDIAN)
|
||||||
*buf++ = tmp & 0xff; /* I assume big endian */
|
*buf++ = tmp & 0xff; /* I assume big endian */
|
||||||
*buf++ = tmp >> 8; /* and don't use the SWAB16 macro */
|
*buf++ = tmp >> 8; /* and don't use the SWAB16 macro */
|
||||||
#else
|
#else
|
||||||
|
|
@ -691,7 +691,7 @@ static void copy_write_sectors(const unsigned char* buf, int wordcount)
|
||||||
const unsigned char* bufend = buf + wordcount*2;
|
const unsigned char* bufend = buf + wordcount*2;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
#ifdef SWAP_WORDS
|
#if defined(SWAP_WORDS) || defined(ROCKBOX_LITTLE_ENDIAN)
|
||||||
/* SH1: loop compiles to 9 assembler instructions */
|
/* SH1: loop compiles to 9 assembler instructions */
|
||||||
/* takes 13 clock cycles (2 pipeline stalls) */
|
/* takes 13 clock cycles (2 pipeline stalls) */
|
||||||
tmp = (unsigned short) *buf++;
|
tmp = (unsigned short) *buf++;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue