crtfm.c revision 1.1
11.1Smatt/*	$NetBSD: crtfm.c,v 1.1 2013/08/05 13:38:35 matt Exp $	*/
21.1Smatt
31.1Smatt/*
41.1Smatt * Copyright (c) 2002 Wasabi Systems, Inc.
51.1Smatt * All rights reserved.
61.1Smatt *
71.1Smatt * Written by Jason R. Thorpe for Wasabi Systems, Inc.
81.1Smatt *
91.1Smatt * Redistribution and use in source and binary forms, with or without
101.1Smatt * modification, are permitted provided that the following conditions
111.1Smatt * are met:
121.1Smatt * 1. Redistributions of source code must retain the above copyright
131.1Smatt *    notice, this list of conditions and the following disclaimer.
141.1Smatt * 2. Redistributions in binary form must reproduce the above copyright
151.1Smatt *    notice, this list of conditions and the following disclaimer in the
161.1Smatt *    documentation and/or other materials provided with the distribution.
171.1Smatt * 3. All advertising materials mentioning features or use of this software
181.1Smatt *    must display the following acknowledgement:
191.1Smatt *	This product includes software developed for the NetBSD Project by
201.1Smatt *	Wasabi Systems, Inc.
211.1Smatt * 4. The name of Wasabi Systems, Inc. may not be used to endorse
221.1Smatt *    or promote products derived from this software without specific prior
231.1Smatt *    written permission.
241.1Smatt *
251.1Smatt * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
261.1Smatt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
271.1Smatt * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
281.1Smatt * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
291.1Smatt * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
301.1Smatt * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
311.1Smatt * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
321.1Smatt * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
331.1Smatt * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
341.1Smatt * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
351.1Smatt * POSSIBILITY OF SUCH DAMAGE.
361.1Smatt */
371.1Smatt
381.1Smatt/*
391.1Smatt * Support for the GCC "-ffast-math" option on the Alpha.
401.1Smatt */
411.1Smatt
421.1Smatt#include <sys/types.h>
431.1Smatt
441.1Smatt#include <machine/fpu.h>
451.1Smatt#include <machine/sysarch.h>
461.1Smatt
471.1Smatt/*
481.1Smatt * Must provide this wrapper around sysarch(2) so that statically-linked
491.1Smatt * programs work properly.
501.1Smatt */
511.1Smatt
521.1Smattextern void __alpha_sysarch(int, void *);
531.1Smatt
541.1Smatt__asm(".ent __alpha_sysarch 0	;\n"
551.1Smatt"__alpha_sysarch:		;\n"
561.1Smatt"	ldiq	$0, 165		;\n" /* v0 = SYS_sysarch */
571.1Smatt"	call_pal 0x0083		;\n" /* PAL_OSF1_callsys */
581.1Smatt"	ret	$31,($26),1	;\n"
591.1Smatt".end __alpha_sysarch");
601.1Smatt
611.1Smattstatic void __attribute__((__constructor__))
621.1Smatt__alpha_set_fast_math(void)
631.1Smatt{
641.1Smatt	struct alpha_fp_c_args args;
651.1Smatt
661.1Smatt	args.fp_c = IEEE_MAP_DMZ|IEEE_MAP_UMZ;
671.1Smatt	__alpha_sysarch(ALPHA_SET_FP_C, &args);
681.1Smatt}
69