2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A#pragma weak _getisax = getisax
2N/A
2N/A#include "lint.h"
2N/A#include <sys/types.h>
2N/A#include <sys/auxv.h>
2N/A
2N/Aextern long ___getauxval(int type);
2N/A
2N/A/*
2N/A * Return the hw cap vector of bits in the AT_SUN_CAP_HW* aux vector entries
2N/A *
2N/A * Note: The use of an arbitrary length array of 32-bit words provides
2N/A * the ability to add additional capability masks (HW2, HW3, ...) as needed.
2N/A *
2N/A * As a convenience, the routine returns the maximum number of array alements
2N/A * that may contain non-zero values.
2N/A */
2N/Auint_t
2N/Agetisax(uint32_t *array, uint_t n)
2N/A{
2N/A int i;
2N/A int rv = 0;
2N/A static uint32_t auxv_cap_hw[AT_SUN_CAP_HW_MAX];
2N/A static boolean_t initialized = B_FALSE;
2N/A
2N/A if (initialized == B_FALSE) {
2N/A auxv_cap_hw[AV_HW1_IDX] =
2N/A (uint32_t)___getauxval(AT_SUN_CAP_HW1);
2N/A auxv_cap_hw[AV_HW2_IDX] =
2N/A (uint32_t)___getauxval(AT_SUN_CAP_HW2);
2N/A initialized = B_TRUE;
2N/A }
2N/A
2N/A if (n > 0) {
2N/A if (n >= 1)
2N/A array[0] = auxv_cap_hw[AV_HW1_IDX];
2N/A if (n >= 2)
2N/A array[1] = auxv_cap_hw[AV_HW2_IDX];
2N/A
2N/A for (i = 2; i < n; i++)
2N/A array[i] = 0;
2N/A }
2N/A
2N/A if (auxv_cap_hw[AV_HW1_IDX])
2N/A rv = 1;
2N/A if (auxv_cap_hw[AV_HW2_IDX])
2N/A rv = 2;
2N/A return (rv);
2N/A}