1 /* Copyright (C) 2004-2023 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, see
16 <https://www.gnu.org/licenses/>. */
18 /* Common bits for implementing software divide. */
22 # include <asm/gentrap.h>
25 # include <machine/pal.h>
28 /* These are not normal C functions. Argument registers are t10 and t11;
29 the result goes in t12; the return address is in t9. Only t12 and AT
36 /* The secureplt format does not allow the division routines to be called
37 via plt; there aren't enough registers free to be clobbered. Avoid
38 setting the symbol type to STT_FUNC, so that the linker won't be tempted
39 to create a plt entry. */
40 #define funcnoplt notype
42 /* None of these functions should use implicit anything. */
46 /* Code fragment to invoke _mcount for profiling. This should be invoked
47 directly after allocation of the stack frame. */
53 cfi_rel_offset (ra
, 0)
54 cfi_rel_offset (pv
, 8)
55 cfi_rel_offset (gp
, 16)
69 /* Realign subsequent code with what we'd have without this
70 macro at all. This means aligned with one arithmetic insn
71 used within the bundle. */
77 /* In order to make the below work, all top-level divide routines must
78 use the same frame size. */
81 /* Code fragment to generate an integer divide-by-zero fault. When
82 building libc.so, we arrange for there to be one copy of this code
83 placed late in the dso, such that all branches are forward. When
84 building libc.a, we use multiple copies to avoid having an out of
85 range branch. Users should jump to DIVBYZERO. */
89 #define DIVBYZERO __divbyzero
90 .section
.gnu
.linkonce
.t
.divbyzero
, "ax", @progbits
92 .type __divbyzero
, @function
93 .usepv __divbyzero
, no
96 #define DIVBYZERO $divbyzero
102 cfi_return_column (RA
)
103 cfi_def_cfa_offset (FRAME
)
113 cfi_def_cfa_offset (0)
117 .size DIVBYZERO
, .-DIVBYZERO
120 /* Like the ev6 instructions, but fall back to stack use on prior machines. */
124 .macro _ITOFS gr
, fr
, slot
133 .macro _ITOFT gr
, fr
, slot
142 .macro _FTOIT fr
, gr
, slot
151 /* Similarly, but move two registers. Schedules better for pre-ev6. */
153 .macro _ITOFT2 gr1
, fr1
, slot1
, gr2
, fr2
, slot2