libext2fs: remove m68k-specific bitops code

The current m68k code was buggy for multiple reasons; first the bfset,
et. al commands interpret the bit number as a signed number, not an
unsigned number.  Secondly, there were missing memory clobbers.  Since
there is no real benefit in using explicit asm's at this point (gcc is
smart enough to optimize the generic C code to use the set/clear/test
bit m68k instruction) fix this bug by removing the m68k specific asm
versions of these functions.

Tested on m68k-linux with e2fsprogs-1.42.6 and gcc-4.6.3 as before.
All tests pass and the debug output looks sane.

I compared the e2fsck binaries from the previous build with this
one.  They had identical .text sizes, and almost the same number
of bit field instructions (obviously compiler-generated), so this
change should have no serious performance implications.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: Andreas Schwab <schwab@linux-m68k.org>
debian-1.42.9
Mikael Pettersson 2012-12-17 09:42:25 -05:00 committed by Theodore Ts'o
parent 4e0bb5eb74
commit dbe5c43b2e
1 changed files with 1 additions and 38 deletions

View File

@ -200,7 +200,7 @@ extern errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitma
*/
#ifdef NO_INLINE_FUNCS
#if (defined(__GNUC__) && (defined(__i386__) || defined(__i486__) || \
defined(__i586__) || defined(__mc68000__)))
defined(__i586__)))
/* This prevents bitops.c from trying to include the C */
/* function version of these functions */
#define _EXT2_HAVE_ASM_BITOPS_
@ -345,43 +345,6 @@ _INLINE_ __u16 ext2fs_swab16(__u16 val)
#endif /* i386 */
#if ((defined __GNUC__) && !defined(_EXT2_USE_C_VERSIONS_) && \
(defined(__mc68000__)))
#define _EXT2_HAVE_ASM_BITOPS_
_INLINE_ int ext2fs_set_bit(unsigned int nr,void * addr)
{
char retval;
__asm__ __volatile__ ("bfset %2@{%1:#1}; sne %0"
: "=d" (retval) : "d" (nr^7), "a" (addr));
return retval;
}
_INLINE_ int ext2fs_clear_bit(unsigned int nr, void * addr)
{
char retval;
__asm__ __volatile__ ("bfclr %2@{%1:#1}; sne %0"
: "=d" (retval) : "d" (nr^7), "a" (addr));
return retval;
}
_INLINE_ int ext2fs_test_bit(unsigned int nr, const void * addr)
{
char retval;
__asm__ __volatile__ ("bftst %2@{%1:#1}; sne %0"
: "=d" (retval) : "d" (nr^7), "a" (addr));
return retval;
}
#endif /* __mc68000__ */
#if !defined(_EXT2_HAVE_ASM_SWAB_)