1a4ca7ca8SDavid Schultz/* 2a4ca7ca8SDavid Schultz * Based on code written by J.T. Conklin <jtc@NetBSD.org>. 3a4ca7ca8SDavid Schultz * Public domain. 4a4ca7ca8SDavid Schultz */ 5a4ca7ca8SDavid Schultz 6a4ca7ca8SDavid Schultz#include <machine/asm.h> 7a4ca7ca8SDavid SchultzENTRY(ceill) 8a4ca7ca8SDavid Schultz pushl %ebp 9a4ca7ca8SDavid Schultz movl %esp,%ebp 10a4ca7ca8SDavid Schultz subl $8,%esp 11a4ca7ca8SDavid Schultz 12a4ca7ca8SDavid Schultz fstcw -4(%ebp) /* store fpu control word */ 13a4ca7ca8SDavid Schultz movw -4(%ebp),%dx 14a4ca7ca8SDavid Schultz orw $0x0800,%dx /* round towards +oo */ 15a4ca7ca8SDavid Schultz andw $0xfbff,%dx 16a4ca7ca8SDavid Schultz movw %dx,-8(%ebp) 17*a52f4499SGordon Bergling fldcw -8(%ebp) /* load modified control word */ 18a4ca7ca8SDavid Schultz 19a4ca7ca8SDavid Schultz fldt 8(%ebp) /* round */ 20a4ca7ca8SDavid Schultz frndint 21a4ca7ca8SDavid Schultz 22a4ca7ca8SDavid Schultz fldcw -4(%ebp) /* restore original control word */ 23a4ca7ca8SDavid Schultz 24a4ca7ca8SDavid Schultz leave 25a4ca7ca8SDavid Schultz ret 269235ed71SAttilio RaoEND(ceill) 278997563cSKonstantin Belousov 288997563cSKonstantin Belousov .section .note.GNU-stack,"",%progbits 29