1 /* Copyright (C) 2004 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 /* Common bits for implementing software divide. */
23 # include <asm/gentrap.h>
26 # include <machine/pal.h>
29 /* These are not normal C functions. Argument registers are t10 and t11;
30 the result goes in t12; the return address is in t9. Only t12 and AT
37 /* The secureplt format does not allow the division routines to be called
38 via plt; there aren't enough registers free to be clobbered. Avoid
39 setting the symbol type to STT_FUNC, so that the linker won't be tempted
40 to create a plt entry. */
41 #define funcnoplt notype
43 /* None of these functions should use implicit anything. */
47 /* Code fragment to invoke _mcount for profiling. This should be invoked
48 directly after allocation of the stack frame. */
54 cfi_rel_offset (ra
, 0)
55 cfi_rel_offset (pv
, 8)
56 cfi_rel_offset (gp
, 16)
70 /* Realign subsequent code with what we'd have without this
71 macro at all. This means aligned with one arithmetic insn
72 used within the bundle. */
78 /* In order to make the below work, all top-level divide routines must
79 use the same frame size. */
82 /* Code fragment to generate an integer divide-by-zero fault. When
83 building libc.so, we arrange for there to be one copy of this code
84 placed late in the dso, such that all branches are forward. When
85 building libc.a, we use multiple copies to avoid having an out of
86 range branch. Users should jump to DIVBYZERO. */
90 #define DIVBYZERO __divbyzero
91 .section
.gnu
.linkonce
.t
.divbyzero
, "ax", @progbits
93 .type __divbyzero
, @function
94 .usepv __divbyzero
, no
97 #define DIVBYZERO $divbyzero
103 cfi_return_column (RA
)
104 cfi_def_cfa_offset (FRAME
)
114 cfi_def_cfa_offset (0)
118 .size DIVBYZERO
, .-DIVBYZERO
121 /* Like the ev6 instructions, but fall back to stack use on prior machines. */
125 .macro _ITOFS gr
, fr
, slot
134 .macro _ITOFT gr
, fr
, slot
143 .macro _FTOIT fr
, gr
, slot
152 /* Similarly, but move two registers. Schedules better for pre-ev6. */
154 .macro _ITOFT2 gr1
, fr1
, slot1
, gr2
, fr2
, slot2