5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
25 */
26
27 /*
28 * Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.
29 * Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T
30 * All Rights Reserved
31 */
32
33 /*
34 * Copyright (c) 2009, Intel Corporation.
35 * All rights reserved.
36 */
37
38 /*
39 * General assembly language routines.
40 * It is the intent of this file to contain routines that are
41 * independent of the specific kernel architecture, and those that are
42 * common across kernel architectures.
43 * As architectures diverge, and implementations of specific
44 * architecture-dependent routines change, the routines should be moved
2828
2829 #if defined(__amd64)
2830
2831 ENTRY(highbit)
2832 movl $-1, %eax
2833 bsrq %rdi, %rax
2834 incl %eax
2835 ret
2836 SET_SIZE(highbit)
2837
2838 #elif defined(__i386)
2839
2840 ENTRY(highbit)
2841 movl $-1, %eax
2842 bsrl 4(%esp), %eax
2843 incl %eax
2844 ret
2845 SET_SIZE(highbit)
2846
2847 #endif /* __i386 */
2848 #endif /* __lint */
2849
2850 #if defined(__lint)
2851
2852 /*ARGSUSED*/
2853 uint64_t
2854 rdmsr(uint_t r)
2855 { return (0); }
2856
2857 /*ARGSUSED*/
2858 void
2859 wrmsr(uint_t r, const uint64_t val)
2860 {}
2861
2862 /*ARGSUSED*/
2863 uint64_t
2864 xrdmsr(uint_t r)
2865 { return (0); }
2866
2867 /*ARGSUSED*/
|
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
25 * Copyright (c) 2014 by Delphix. All rights reserved.
26 */
27
28 /*
29 * Copyright (c) 1990, 1991 UNIX System Laboratories, Inc.
30 * Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T
31 * All Rights Reserved
32 */
33
34 /*
35 * Copyright (c) 2009, Intel Corporation.
36 * All rights reserved.
37 */
38
39 /*
40 * General assembly language routines.
41 * It is the intent of this file to contain routines that are
42 * independent of the specific kernel architecture, and those that are
43 * common across kernel architectures.
44 * As architectures diverge, and implementations of specific
45 * architecture-dependent routines change, the routines should be moved
2829
2830 #if defined(__amd64)
2831
2832 ENTRY(highbit)
2833 movl $-1, %eax
2834 bsrq %rdi, %rax
2835 incl %eax
2836 ret
2837 SET_SIZE(highbit)
2838
2839 #elif defined(__i386)
2840
2841 ENTRY(highbit)
2842 movl $-1, %eax
2843 bsrl 4(%esp), %eax
2844 incl %eax
2845 ret
2846 SET_SIZE(highbit)
2847
2848 #endif /* __i386 */
2849 #endif /* __lint */
2850
2851 #if defined(__lint)
2852
2853 /*ARGSUSED*/
2854 int
2855 highbit64(uint64_t i)
2856 { return (0); }
2857
2858 #else /* __lint */
2859
2860 #if defined(__amd64)
2861
2862 ENTRY(highbit64)
2863 movl $-1, %eax
2864 bsrq %rdi, %rax
2865 incl %eax
2866 ret
2867 SET_SIZE(highbit64)
2868
2869 #elif defined(__i386)
2870
2871 ENTRY(highbit64)
2872 bsrl 8(%esp), %eax
2873 jz .lowbit
2874 addl $32, %eax
2875 jmp .done
2876
2877 .lowbit:
2878 movl $-1, %eax
2879 bsrl 4(%esp), %eax
2880 .done:
2881 incl %eax
2882 ret
2883 SET_SIZE(highbit64)
2884
2885 #endif /* __i386 */
2886 #endif /* __lint */
2887
2888 #if defined(__lint)
2889
2890 /*ARGSUSED*/
2891 uint64_t
2892 rdmsr(uint_t r)
2893 { return (0); }
2894
2895 /*ARGSUSED*/
2896 void
2897 wrmsr(uint_t r, const uint64_t val)
2898 {}
2899
2900 /*ARGSUSED*/
2901 uint64_t
2902 xrdmsr(uint_t r)
2903 { return (0); }
2904
2905 /*ARGSUSED*/
|