__sparc_utrap_setup.c revision 263763
1207753Smm/*- 2207753Smm * Copyright (c) 2001 Jake Burkholder. 3207753Smm * All rights reserved. 4207753Smm * 5207753Smm * Redistribution and use in source and binary forms, with or without 6207753Smm * modification, are permitted provided that the following conditions 7207753Smm * are met: 8207753Smm * 1. Redistributions of source code must retain the above copyright 9207753Smm * notice, this list of conditions and the following disclaimer. 10207753Smm * 2. Redistributions in binary form must reproduce the above copyright 11207753Smm * notice, this list of conditions and the following disclaimer in the 12207753Smm * documentation and/or other materials provided with the distribution. 13207753Smm * 14207753Smm * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15207753Smm * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16207753Smm * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17207753Smm * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18207753Smm * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19207753Smm * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20207753Smm * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21207753Smm * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22207753Smm * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23207753Smm * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24207753Smm * SUCH DAMAGE. 25207753Smm */ 26207753Smm 27207753Smm#include <sys/cdefs.h> 28207753Smm__FBSDID("$FreeBSD: stable/10/lib/libc/sparc64/sys/__sparc_utrap_setup.c 263763 2014-03-26 07:31:57Z dim $"); 29207753Smm 30207753Smm#include <sys/types.h> 31207753Smm 32215187Smm#include <machine/utrap.h> 33207753Smm#include <machine/sysarch.h> 34207753Smm 35207753Smm#include <stdlib.h> 36207753Smm 37207753Smm#include "__sparc_utrap_private.h" 38207753Smm 39207753Smmstatic const struct sparc_utrap_args ua[] = { 40207753Smm { UT_FP_DISABLED, __sparc_utrap_fp_disabled, NULL, NULL, NULL }, 41207753Smm { UT_FP_EXCEPTION_IEEE_754, __sparc_utrap_gen, NULL, NULL, NULL }, 42215187Smm { UT_FP_EXCEPTION_OTHER, __sparc_utrap_gen, NULL, NULL, NULL }, 43207753Smm { UT_ILLEGAL_INSTRUCTION, __sparc_utrap_gen, NULL, NULL, NULL }, 44207753Smm { UT_MEM_ADDRESS_NOT_ALIGNED, __sparc_utrap_gen, NULL, NULL, NULL }, 45207753Smm}; 46207753Smm 47207753Smmstatic const struct sparc_utrap_install_args uia[] = { 48207753Smm { sizeof (ua) / sizeof (*ua), ua } 49207753Smm}; 50207753Smm 51207753Smmvoid __sparc_utrap_setup(void) __attribute__((constructor)); 52207753Smm 53207753Smmvoid 54207753Smm__sparc_utrap_setup(void) 55215187Smm{ 56215187Smm 57215187Smm sysarch(SPARC_UTRAP_INSTALL, (void *)&uia); 58207753Smm} 59215187Smm