/* 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*/3435#include <linux/export.h>3637/* These are predefined by new versions of GNU cpp. */3839#ifndef __USER_LABEL_PREFIX__40#define __USER_LABEL_PREFIX__ _41#endif4243#ifndef __REGISTER_PREFIX__44#define __REGISTER_PREFIX__45#endif4647#ifndef __IMMEDIATE_PREFIX__48#define __IMMEDIATE_PREFIX__ #49#endif5051/* ANSI concatenation macros. */5253#define CONCAT1(a, b) CONCAT2(a, b)54#define CONCAT2(a, b) a ## b5556/* Use the right prefix for global labels. */5758#define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)5960/* Use the right prefix for registers. */6162#define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)6364/* Use the right prefix for immediate values. */6566#define IMM(x) CONCAT1 (__IMMEDIATE_PREFIX__, x)6768#define d0 REG (d0)69#define d1 REG (d1)70#define d2 REG (d2)71#define d3 REG (d3)72#define d4 REG (d4)73#define d5 REG (d5)74#define d6 REG (d6)75#define d7 REG (d7)76#define a0 REG (a0)77#define a1 REG (a1)78#define a2 REG (a2)79#define a3 REG (a3)80#define a4 REG (a4)81#define a5 REG (a5)82#define a6 REG (a6)83#define fp REG (fp)84#define sp REG (sp)8586.text87.proc88.globl SYM (__modsi3)89SYM (__modsi3):90movel sp@(8), d1 /* d1 = divisor */91movel sp@(4), d0 /* d0 = dividend */92movel d1, sp@-93movel d0, sp@-94jbsr SYM (__divsi3)95addql IMM (8), sp96movel sp@(8), d1 /* d1 = divisor */97#if !(defined(__mcf5200__) || defined(__mcoldfire__))98movel d1, sp@-99movel d0, sp@-100jbsr SYM (__mulsi3) /* d0 = (a/b)*b */101addql IMM (8), sp102#else103mulsl d1,d0104#endif105movel sp@(4), d1 /* d1 = dividend */106subl d0, d1 /* d1 = a - (a/b)*b */107movel d1, d0108rts109110EXPORT_SYMBOL(__modsi3)111112113