/* libgcc1 routines for 68000 w/o floating-point hardware.1Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.23This file is part of GNU CC.45GNU CC is free software; you can redistribute it and/or modify it6under the terms of the GNU General Public License as published by the7Free Software Foundation; either version 2, or (at your option) any8later version.910In addition to the permissions in the GNU General Public License, the11Free Software Foundation gives you unlimited permission to link the12compiled version of this file with other programs, and to distribute13those programs without any restriction coming from the use of this14file. (The General Public License restrictions do apply in other15respects; for example, they cover modification of the file, and16distribution when not linked into another program.)1718This file is distributed in the hope that it will be useful, but19WITHOUT ANY WARRANTY; without even the implied warranty of20MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU21General Public License for more details. */2223/* As a special exception, if you link this library with files24compiled with GCC to produce an executable, this does not cause25the resulting executable to be covered by the GNU General Public License.26This exception does not however invalidate any other reasons why27the executable file might be covered by the GNU General Public License. */2829/* Use this one for any 680x0; assumes no floating point hardware.30The trailing " '" appearing on some lines is for ANSI preprocessors. Yuk.31Some of this code comes from MINIX, via the folks at ericsson.32D. V. Henkel-Wallace ([email protected]) Fete Bastille, 199233*/34#include <linux/export.h>35/* These are predefined by new versions of GNU cpp. */3637#ifndef __USER_LABEL_PREFIX__38#define __USER_LABEL_PREFIX__ _39#endif4041#ifndef __REGISTER_PREFIX__42#define __REGISTER_PREFIX__43#endif4445#ifndef __IMMEDIATE_PREFIX__46#define __IMMEDIATE_PREFIX__ #47#endif4849/* ANSI concatenation macros. */5051#define CONCAT1(a, b) CONCAT2(a, b)52#define CONCAT2(a, b) a ## b5354/* Use the right prefix for global labels. */5556#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)5758/* Use the right prefix for registers. */5960#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)6162/* Use the right prefix for immediate values. */6364#define IMM(x) CONCAT1 (__IMMEDIATE_PREFIX__, x)6566#define d0 REG (d0)67#define d1 REG (d1)68#define d2 REG (d2)69#define d3 REG (d3)70#define d4 REG (d4)71#define d5 REG (d5)72#define d6 REG (d6)73#define d7 REG (d7)74#define a0 REG (a0)75#define a1 REG (a1)76#define a2 REG (a2)77#define a3 REG (a3)78#define a4 REG (a4)79#define a5 REG (a5)80#define a6 REG (a6)81#define fp REG (fp)82#define sp REG (sp)8384.text85.proc86.globl SYM (__umodsi3)87SYM (__umodsi3):88movel sp@(8), d1 /* d1 = divisor */89movel sp@(4), d0 /* d0 = dividend */90movel d1, sp@-91movel d0, sp@-92jbsr SYM (__udivsi3)93addql IMM (8), sp94movel sp@(8), d1 /* d1 = divisor */95#if !(defined(__mcf5200__) || defined(__mcoldfire__))96movel d1, sp@-97movel d0, sp@-98jbsr SYM (__mulsi3) /* d0 = (a/b)*b */99addql IMM (8), sp100#else101mulsl d1,d0102#endif103movel sp@(4), d1 /* d1 = dividend */104subl d0, d1 /* d1 = a - (a/b)*b */105movel d1, d0106rts107EXPORT_SYMBOL(__umodsi3)108109110