delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/11/26/15:51:01

From: Chris Matrakidis <cmatraki AT eleceng DOT ucl DOT ac DOT uk>
Date: Tue, 26 Nov 96 20:41:43 GMT
Message-Id: <11991.9611262041@lupus>
To: djgpp-workers AT delorie DOT com
Subject: Patch for libm

This is a patch that fixes the stack problems with libm and interrupts
or fpu emulation.
Apply in src/libm/src.

*** old/s_ceil.s        Tue Nov 26 20:19:04 1996
--- new/s_ceil.s        Tue Nov 26 20:19:11 1996
***************
*** 43,59 ****
        movl    %esp,%ebp
        subl    $8,%esp
  
!       fstcw   -12(%ebp)               /* store fpu control word */
!       movw    -12(%ebp),%dx
        orw     $0x0800,%dx             /* round towards +oo */
        andw    $0xfbff,%dx
!       movw    %dx,-16(%ebp)
!       fldcw   -16(%ebp)               /* load modfied control word */
  
        fldl    8(%ebp);                /* round */
        frndint
  
!       fldcw   -12(%ebp)               /* restore original control word */
  
        leave
        ret
--- 43,60 ----
        movl    %esp,%ebp
        subl    $8,%esp
  
!       fstcw   -4(%ebp)                /* store fpu control word */
!       movw    -4(%ebp),%dx
        orw     $0x0800,%dx             /* round towards +oo */
        andw    $0xfbff,%dx
!       movw    %dx,-8(%ebp)
!       fldcw   -8(%ebp)                /* load modfied control word */
  
        fldl    8(%ebp);                /* round */
        frndint
  
!       fldcw   -4(%ebp)                /* restore original control word */
  
        leave
        ret
+ 
diff -c old/s_floor.s new/s_floor.s
*** old/s_floor.s       Tue Nov 26 20:19:04 1996
--- new/s_floor.s       Tue Nov 26 20:19:11 1996
***************
*** 43,59 ****
        movl    %esp,%ebp
        subl    $8,%esp
  
!       fstcw   -12(%ebp)               /* store fpu control word */
!       movw    -12(%ebp),%dx
        orw     $0x0400,%dx             /* round towards -oo */
        andw    $0xf7ff,%dx
!       movw    %dx,-16(%ebp)
!       fldcw   -16(%ebp)               /* load modfied control word */
  
        fldl    8(%ebp);                /* round */
        frndint
  
!       fldcw   -12(%ebp)               /* restore original control word */
  
        leave
        ret
--- 43,59 ----
        movl    %esp,%ebp
        subl    $8,%esp
  
!       fstcw   -4(%ebp)                /* store fpu control word */
!       movw    -4(%ebp),%dx
        orw     $0x0400,%dx             /* round towards -oo */
        andw    $0xf7ff,%dx
!       movw    %dx,-8(%ebp)
!       fldcw   -8(%ebp)                /* load modfied control word */
  
        fldl    8(%ebp);                /* round */
        frndint
  
!       fldcw   -4(%ebp)                /* restore original control word */
  
        leave
        ret
diff -c old/sf_ceil.s new/sf_ceil.s
*** old/sf_ceil.s       Tue Nov 26 20:19:04 1996
--- new/sf_ceil.s       Tue Nov 26 20:19:11 1996
***************
*** 43,59 ****
        movl    %esp,%ebp
        subl    $8,%esp
  
!       fstcw   -12(%ebp)               /* store fpu control word */
!       movw    -12(%ebp),%dx
        orw     $0x0800,%dx             /* round towards +oo */
        andw    $0xfbff,%dx
!       movw    %dx,-16(%ebp)
!       fldcw   -16(%ebp)               /* load modfied control word */
  
        flds    8(%ebp);                /* round */
        frndint
  
!       fldcw   -12(%ebp)               /* restore original control word */
  
        leave
        ret
--- 43,59 ----
        movl    %esp,%ebp
        subl    $8,%esp
  
!       fstcw   -4(%ebp)                /* store fpu control word */
!       movw    -4(%ebp),%dx
        orw     $0x0800,%dx             /* round towards +oo */
        andw    $0xfbff,%dx
!       movw    %dx,-8(%ebp)
!       fldcw   -8(%ebp)                /* load modfied control word */
  
        flds    8(%ebp);                /* round */
        frndint
  
!       fldcw   -4(%ebp)                /* restore original control word */
  
        leave
        ret
diff -c old/sf_floor.s new/sf_floor.s
*** old/sf_floor.s      Tue Nov 26 20:19:04 1996
--- new/sf_floor.s      Tue Nov 26 20:19:11 1996
***************
*** 43,59 ****
        movl    %esp,%ebp
        subl    $8,%esp
  
!       fstcw   -12(%ebp)               /* store fpu control word */
!       movw    -12(%ebp),%dx
        orw     $0x0400,%dx             /* round towards -oo */
        andw    $0xf7ff,%dx
!       movw    %dx,-16(%ebp)
!       fldcw   -16(%ebp)               /* load modfied control word */
  
        flds    8(%ebp);                /* round */
        frndint
  
!       fldcw   -12(%ebp)               /* restore original control word */
  
        leave
        ret
--- 43,59 ----
        movl    %esp,%ebp
        subl    $8,%esp
  
!       fstcw   -4(%ebp)                /* store fpu control word */
!       movw    -4(%ebp),%dx
        orw     $0x0400,%dx             /* round towards -oo */
        andw    $0xf7ff,%dx
!       movw    %dx,-8(%ebp)
!       fldcw   -8(%ebp)                /* load modfied control word */
  
        flds    8(%ebp);                /* round */
        frndint
  
!       fldcw   -4(%ebp)                /* restore original control word */
  
        leave
        ret

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019