mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-21 18:27:22 +00:00
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:
parent
17a35ce727
commit
7f8fa2cf47
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=145969
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue