Prevent these functions from using stack outside of their frame.

Reported by:	Marc Olzheim <marcolz at stack dot nl>
OK'd by:	das
This commit is contained in:
Daniel Eischen 2005-05-06 15:44:20 +00:00
parent 17a35ce727
commit 7f8fa2cf47
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=145969
3 changed files with 15 additions and 15 deletions

View file

@ -13,17 +13,17 @@ ENTRY(ceilf)
movl %esp,%ebp
subl $8,%esp
fstcw -12(%ebp) /* store fpu control word */
movw -12(%ebp),%dx
fstcw -4(%ebp) /* store fpu control word */
movw -4(%ebp),%dx
orw $0x0800,%dx /* round towards +oo */
andw $0xfbff,%dx
movw %dx,-16(%ebp)
fldcw -16(%ebp) /* load modfied control word */
movw %dx,-8(%ebp)
fldcw -8(%ebp) /* load modfied control word */
flds 8(%ebp); /* round */
frndint
fldcw -12(%ebp) /* restore original control word */
fldcw -4(%ebp) /* restore original control word */
leave
ret

View file

@ -13,17 +13,17 @@ ENTRY(floorf)
movl %esp,%ebp
subl $8,%esp
fstcw -12(%ebp) /* store fpu control word */
movw -12(%ebp),%dx
fstcw -4(%ebp) /* store fpu control word */
movw -4(%ebp),%dx
orw $0x0400,%dx /* round towards -oo */
andw $0xf7ff,%dx
movw %dx,-16(%ebp)
fldcw -16(%ebp) /* load modfied control word */
movw %dx,-8(%ebp)
fldcw -8(%ebp) /* load modfied control word */
flds 8(%ebp); /* round */
frndint
fldcw -12(%ebp) /* restore original control word */
fldcw -4(%ebp) /* restore original control word */
leave
ret

View file

@ -11,16 +11,16 @@ ENTRY(truncf)
movl %esp,%ebp
subl $8,%esp
fstcw -12(%ebp) /* store fpu control word */
movw -12(%ebp),%dx
fstcw -4(%ebp) /* store fpu control word */
movw -4(%ebp),%dx
orw $0x0c00,%dx /* round towards -oo */
movw %dx,-16(%ebp)
fldcw -16(%ebp) /* load modfied control word */
movw %dx,-8(%ebp)
fldcw -8(%ebp) /* load modfied control word */
flds 8(%ebp) /* round */
frndint
fldcw -12(%ebp) /* restore original control word */
fldcw -4(%ebp) /* restore original control word */
leave
ret