Subject: port-i386/21558: cpu_switch() allways returns value 0
To: None <>
From: None <>
List: netbsd-bugs
Date: 05/13/2003 01:28:31
>Number:         21558
>Category:       port-i386
>Synopsis:       cpu_switch() allways returns value 0
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 13 01:29:00 UTC 2003
>Originator:     Stephan Uphoff
>Release:        1.6T
NetBSD giant 1.6T NetBSD 1.6T (GIANT) #0: Mon May 12 20:17:34 EDT 2003  ups@giant:/usr/home/ups/sources/build/makeobjectdirprefix/usr/home/ups/sources/src/sys/arch/i386/compile/GIANT i386

The return value is written too early to the eax register.
The register is overwritten by function calls later in the code.
( The last function called is Xspllower() which sets the eax register to 0)

Use the ebx register to hold the value until
it is save to store it to the eax register. 

RCS file: /cvsroot/src/sys/arch/i386/i386/locore.S,v
retrieving revision 1.8
diff -r1.8 locore.S
<       movl    $1, %eax
>       movl    $1, %ebx
<       xor     %eax,%eax
>       xorl    %ebx,%ebx
>       movl    %ebx,%eax