Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6cc0735d authored by David S. Miller's avatar David S. Miller
Browse files

[SPARC32]: Add __cmpdi2() libcall implementation ala. MIPS.



Device mapper generates calls to this with recent versions
of gcc.

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6c8f5b90
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ lib-y := mul.o rem.o sdiv.o udiv.o umul.o urem.o ashrdi3.o memcpy.o memset.o \
         strlen.o checksum.o blockops.o memscan.o memcmp.o strncmp.o \
	 strncpy_from_user.o divdi3.o udivdi3.o strlen_user.o \
	 copy_user.o locks.o atomic.o \
	 lshrdi3.o ashldi3.o rwsem.o muldi3.o bitext.o
	 lshrdi3.o ashldi3.o rwsem.o muldi3.o bitext.o \
	 cmpdi2.o

obj-y += iomap.o atomic32.o
+27 −0
Original line number Diff line number Diff line
#include <linux/module.h>

#include "libgcc.h"

word_type __cmpdi2(long long a, long long b)
{
	const DWunion au = {
		.ll = a
	};
	const DWunion bu = {
		.ll = b
	};

	if (au.s.high < bu.s.high)
		return 0;
	else if (au.s.high > bu.s.high)
		return 2;

	if ((unsigned int) au.s.low < (unsigned int) bu.s.low)
		return 0;
	else if ((unsigned int) au.s.low > (unsigned int) bu.s.low)
		return 2;

	return 1;
}

EXPORT_SYMBOL(__cmpdi2);
+18 −0
Original line number Diff line number Diff line
#ifndef __ASM_LIBGCC_H
#define __ASM_LIBGCC_H

#include <asm/byteorder.h>

typedef int word_type __attribute__ ((mode (__word__)));

struct DWstruct {
	int high, low;
};

typedef union
{
	struct DWstruct s;
	long long ll;
} DWunion;

#endif /* __ASM_LIBGCC_H */