diff options
author | bde <bde@FreeBSD.org> | 1996-06-25 19:25:25 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-06-25 19:25:25 +0000 |
commit | 3d80cb8e5e226da61878d59c56b97b2aca43c535 (patch) | |
tree | ae828c78e861b0a94f0821f6cb04c906114d9f42 /sys/amd64 | |
parent | 5d0acb6cc2e0fa07c2940cd57e41faee5617918d (diff) | |
download | FreeBSD-src-3d80cb8e5e226da61878d59c56b97b2aca43c535.zip FreeBSD-src-3d80cb8e5e226da61878d59c56b97b2aca43c535.tar.gz |
Save John Polstra's initial fix for profiling for reference. The
multiplication in addupc() overflowed for addresses >= 256K, assuming
the usual profil(2) scale parameter of 0x8000. addupc() will go away
soon.
Submitted by: John Polstra <jdp@polstra.com>
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/cpu_switch.S | 9 | ||||
-rw-r--r-- | sys/amd64/amd64/swtch.s | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S index ee4be15..22faea8 100644 --- a/sys/amd64/amd64/cpu_switch.S +++ b/sys/amd64/amd64/cpu_switch.S @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: swtch.s,v 1.34 1996/04/25 06:20:08 phk Exp $ + * $Id: swtch.s,v 1.35 1996/05/01 03:46:15 bde Exp $ */ #include "apm.h" @@ -533,9 +533,10 @@ ENTRY(addupc) subl PR_OFF(%edx),%eax /* pc -= up->pr_off */ jb L1 /* if (pc was < off) return */ - shrl $1,%eax /* praddr = pc >> 1 */ - imull PR_SCALE(%edx),%eax /* praddr *= up->pr_scale */ - shrl $15,%eax /* praddr = praddr << 15 */ + pushl %edx + mull PR_SCALE(%edx) /* praddr = pc * up->pr_scale */ + shrdl $16,%edx,%eax /* praddr >>= 16 */ + popl %edx andl $-2,%eax /* praddr &= ~1 */ cmpl PR_SIZE(%edx),%eax /* if (praddr > up->pr_size) return */ diff --git a/sys/amd64/amd64/swtch.s b/sys/amd64/amd64/swtch.s index ee4be15..22faea8 100644 --- a/sys/amd64/amd64/swtch.s +++ b/sys/amd64/amd64/swtch.s @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: swtch.s,v 1.34 1996/04/25 06:20:08 phk Exp $ + * $Id: swtch.s,v 1.35 1996/05/01 03:46:15 bde Exp $ */ #include "apm.h" @@ -533,9 +533,10 @@ ENTRY(addupc) subl PR_OFF(%edx),%eax /* pc -= up->pr_off */ jb L1 /* if (pc was < off) return */ - shrl $1,%eax /* praddr = pc >> 1 */ - imull PR_SCALE(%edx),%eax /* praddr *= up->pr_scale */ - shrl $15,%eax /* praddr = praddr << 15 */ + pushl %edx + mull PR_SCALE(%edx) /* praddr = pc * up->pr_scale */ + shrdl $16,%edx,%eax /* praddr >>= 16 */ + popl %edx andl $-2,%eax /* praddr &= ~1 */ cmpl PR_SIZE(%edx),%eax /* if (praddr > up->pr_size) return */ |