Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libkern/arch/i386 Rename jump label to something a l...



details:   https://anonhg.NetBSD.org/src/rev/689a0f687edd
branches:  trunk
changeset: 757617:689a0f687edd
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Sep 07 20:35:50 2010 +0000

description:
Rename jump label to something a little more negative.  No, I'm
not doing it for cosmetic value or out of angst.  See, PIC_PROLOGUE
on i386 uses the "1" label internally.  Now, everything would be
fine and dandy for the first 551245 calls to random.  After that
p+q is negative and the jump is taken.  However, it is taken into
the middle of PIC_PROLOGUE instead of where upon superficial
examination we assumed we are jumping.  This causes wrong(tm) things
to happen and "ret" triggers a jump into hyperspace.

(no, I did not see that coming)

diffstat:

 sys/lib/libkern/arch/i386/random.S |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (24 lines):

diff -r 0fb1ff6758b6 -r 689a0f687edd sys/lib/libkern/arch/i386/random.S
--- a/sys/lib/libkern/arch/i386/random.S        Tue Sep 07 18:47:24 2010 +0000
+++ b/sys/lib/libkern/arch/i386/random.S        Tue Sep 07 20:35:50 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: random.S,v 1.5 2009/01/04 17:10:46 pooka Exp $ */
+/*     $NetBSD: random.S,v 1.6 2010/09/07 20:35:50 pooka Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -83,12 +83,12 @@
        shld    $1,%eax,%edx
        andl    $0x7fffffff,%eax
        addl    %edx,%eax
-       js      1f
+       js      neg
        PIC_PROLOGUE
        movl    %eax,PIC_GOTOFF(randseed)
        PIC_EPILOGUE
        ret
-1:
+neg:
        subl    $0x7fffffff,%eax
        PIC_PROLOGUE
        movl    %eax,PIC_GOTOFF(randseed)



Home | Main Index | Thread Index | Old Index