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 Schultz__FBSDID("$FreeBSD$") 8a4ca7ca8SDavid Schultz 9a4ca7ca8SDavid SchultzENTRY(truncl) 10a4ca7ca8SDavid Schultz pushl %ebp 11a4ca7ca8SDavid Schultz movl %esp,%ebp 12a4ca7ca8SDavid Schultz subl $8,%esp 13a4ca7ca8SDavid Schultz 14a4ca7ca8SDavid Schultz fstcw -4(%ebp) /* store fpu control word */ 15a4ca7ca8SDavid Schultz movw -4(%ebp),%dx 16a4ca7ca8SDavid Schultz orw $0x0c00,%dx /* round towards -oo */ 17a4ca7ca8SDavid Schultz movw %dx,-8(%ebp) 18*a52f4499SGordon Bergling fldcw -8(%ebp) /* load modified control word */ 19a4ca7ca8SDavid Schultz 20a4ca7ca8SDavid Schultz fldt 8(%ebp) /* round */ 21a4ca7ca8SDavid Schultz frndint 22a4ca7ca8SDavid Schultz 23a4ca7ca8SDavid Schultz fldcw -4(%ebp) /* restore original control word */ 24a4ca7ca8SDavid Schultz 25a4ca7ca8SDavid Schultz leave 26a4ca7ca8SDavid Schultz ret 279235ed71SAttilio RaoEND(truncl) 288997563cSKonstantin Belousov 298997563cSKonstantin Belousov .section .note.GNU-stack,"",%progbits 30