12116Sjkh/*
22116Sjkh * Copyright (c) 1993,94 Winning Strategies, Inc.
32116Sjkh * All rights reserved.
42116Sjkh *
52116Sjkh * Redistribution and use in source and binary forms, with or without
62116Sjkh * modification, are permitted provided that the following conditions
72116Sjkh * are met:
82116Sjkh * 1. Redistributions of source code must retain the above copyright
92116Sjkh *    notice, this list of conditions and the following disclaimer.
102116Sjkh * 2. Redistributions in binary form must reproduce the above copyright
112116Sjkh *    notice, this list of conditions and the following disclaimer in the
122116Sjkh *    documentation and/or other materials provided with the distribution.
132116Sjkh * 3. All advertising materials mentioning features or use of this software
142116Sjkh *    must display the following acknowledgement:
152116Sjkh *      This product includes software developed by Winning Strategies, Inc.
162116Sjkh * 4. The name of the author may not be used to endorse or promote products
172116Sjkh *    derived from this software without specific prior written permission.
182116Sjkh *
192116Sjkh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
202116Sjkh * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
212116Sjkh * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
222116Sjkh * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
232116Sjkh * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
242116Sjkh * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
252116Sjkh * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
262116Sjkh * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
272116Sjkh * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
282116Sjkh * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
292116Sjkh */
302116Sjkh
312116Sjkh/*
322116Sjkh * Written by:
332116Sjkh *	J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
342116Sjkh */
352116Sjkh
3623577Sbde#include <machine/asm.h>
37213337Sdim__FBSDID("$FreeBSD$")
382116Sjkh
392116SjkhENTRY(ceil)
402116Sjkh	pushl	%ebp
412116Sjkh	movl	%esp,%ebp
422116Sjkh	subl	$8,%esp
432116Sjkh
4420447Sbde	fstcw	-4(%ebp)		/* store fpu control word */
4520447Sbde	movw	-4(%ebp),%dx
462116Sjkh	orw	$0x0800,%dx		/* round towards +oo */
472116Sjkh	andw	$0xfbff,%dx
4820447Sbde	movw	%dx,-8(%ebp)
4920447Sbde	fldcw	-8(%ebp)		/* load modfied control word */
502116Sjkh
512116Sjkh	fldl	8(%ebp);		/* round */
522116Sjkh	frndint
532116Sjkh
5420447Sbde	fldcw	-4(%ebp)		/* restore original control word */
552116Sjkh
562116Sjkh	leave
572116Sjkh	ret
58192760SattilioEND(ceil)
59217108Skib
60217108Skib	.section .note.GNU-stack,"",%progbits
61