kernel: remove unused utsname_set_machine()
[unleashed.git] / usr / src / uts / sparc / v9 / ml / crt.s
blobd9dc6b61b666f37eff3778012ec2d0e8d45cc384
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright (c) 1988-1991 by Sun Microsystems, Inc.
26 #ident "%Z%%M% %I% %E% SMI" /* From SunOS 4.1 1.6 */
29 #include <sys/asm_linkage.h>
30 #include <sys/trap.h>
31 #include <sys/machtrap.h>
32 #include <sys/simulate.h>
35 * C run time subroutines.
37 * Those beginning in `.' are not callable from C and hence do not
38 * get lint prototypes.
43 * Structure return
45 #define UNIMP 0
46 #define MASK 0x00000fff
47 #define STRUCT_VAL_OFF (16*4)
49 RTENTRY(.stret4)
50 RTENTRY(.stret8)
52 ! see if key matches: if not, structure value not expected,
53 ! so just return
55 ld [%i7 + 8], %o3
56 and %o1, MASK, %o4
57 sethi %hi(UNIMP), %o5
58 or %o4, %o5, %o5
59 cmp %o5, %o3
60 be,a 0f
61 ld [%fp + STRUCT_VAL_OFF], %i0 ! set expected return value
62 ret
63 restore
64 0: ! copy the struct
65 subcc %o1, 4, %o1
66 ld [%o0 + %o1], %o4
67 bg 0b
68 st %o4, [%i0 + %o1] ! delay slot
69 add %i7, 0x4, %i7 ! bump return address
70 ret
71 restore
72 SET_SIZE(.stret4)
73 SET_SIZE(.stret8)
75 RTENTRY(.stret2)
77 ! see if key matches: if not, structure value not expected,
78 ! so just return
80 ld [%i7 + 8], %o3
81 and %o1, MASK, %o4
82 sethi %hi(UNIMP), %o5
83 or %o4, %o5, %o5
84 cmp %o5, %o3
85 be,a 0f
86 ld [%fp + STRUCT_VAL_OFF], %i0 ! set expected return value
87 ret
88 restore
89 0: ! copy the struct
90 subcc %o1, 2, %o1
91 lduh [%o0 + %o1], %o4
92 bg 0b
93 sth %o4, [%i0 + %o1] ! delay slot
94 add %i7, 0x4, %i7 ! bump return address
95 ret
96 restore
97 SET_SIZE(.stret2)
100 * Convert 32-bit arg pairs in %o0:o1 and %o2:%o3 to 64-bit args in %o1 and %o2
102 #define ARGS_TO_64 \
103 sllx %o0, 32, %o0; \
104 srl %o1, 0, %o1; \
105 sllx %o2, 32, %o2; \
106 srl %o3, 0, %o3; \
107 or %o0, %o1, %o1; \
108 or %o2, %o3, %o2
110 RTENTRY(__mul64)
111 ALTENTRY(__umul64)
112 ARGS_TO_64
113 sub %o1, %o2, %o0 ! %o0 = a - b
114 movrlz %o0, %g0, %o0 ! %o0 = (a < b) ? 0 : a - b
115 sub %o1, %o0, %o1 ! %o1 = (a < b) ? a : b = min(a, b)
116 add %o2, %o0, %o2 ! %o2 = (a < b) ? b : a = max(a, b)
117 mulx %o1, %o2, %o1 ! min(a, b) in "rs1" for early exit
118 retl
119 srax %o1, 32, %o0
120 SET_SIZE(__mul64)
121 SET_SIZE(__umul64)
123 RTENTRY(__div64)
124 ARGS_TO_64
125 sdivx %o1, %o2, %o1
126 retl
127 srax %o1, 32, %o0
128 SET_SIZE(__div64)
130 RTENTRY(__udiv64)
131 ARGS_TO_64
132 udivx %o1, %o2, %o1
133 retl
134 srax %o1, 32, %o0
135 SET_SIZE(__udiv64)
137 RTENTRY(__rem64)
138 ARGS_TO_64
139 sdivx %o1, %o2, %o3
140 mulx %o2, %o3, %o3
141 sub %o1, %o3, %o1
142 retl
143 srax %o1, 32, %o0
144 SET_SIZE(__rem64)
146 RTENTRY(__urem64)
147 ARGS_TO_64
148 udivx %o1, %o2, %o3
149 mulx %o2, %o3, %o3
150 sub %o1, %o3, %o1
151 retl
152 srax %o1, 32, %o0
153 SET_SIZE(__urem64)