Re: Breakage in arch/i386/kernel/time.c

Artur Skawina (skawina@geocities.com)
Fri, 03 Dec 1999 21:55:51 +0100


This is a multi-part message in MIME format.

--------------4380DC9978A7EEBC342A4C8F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Benjamin C.R. LaHaise wrote:
>
> On Fri, 3 Dec 1999, Richard Gooch wrote:
>
> > But do_gettimeofday() doesn't have any explicit asm code. Sure, it
> > does locking, but those lock functions shouldn't affect the C code
> > it's called from. If there's leakage from the lock functions, that
> > should be fixed.
>
> It's not from the lock functions, but from do_fast_gettimeoffset():
>
> register unsigned long eax asm("ax");
> register unsigned long edx asm("dx");
>
> The locking functions use eax for passing args in/out when calling the
> helper functions if the variable doesn't have a static address.
> Unfortunately, gcc 2.7.2 isn't getting the optimization correct

Does the attached patch solve the problem for gcc2.7?
i guess the explicit reg allocation was supposed to improve the
emitted code, but it doesn't work all that well...

w/ gcc2.95.2 this patch effectively means:

@@ -14781,8 +14781,7 @@ <do_settimeofday>:
sub 0XXXXXXXX,%eXX
mul 0XXXXXXXX,%eXX
mov XX(%eXX),%eXX
- mov 0XXXXXXXX,%eXX
- add %eXX,%eXX
+ add 0XXXXXXXX,%eXX
sub %eXX,%eXX
mov %eXX,XX(%eXX)
jns XXXXXXXX <do_settimeofday+0xXXX>

--------------4380DC9978A7EEBC342A4C8F
Content-Type: text/plain; charset=us-ascii; name="patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="patch"

--- /img/linux-2.3.30pre1/arch/i386/kernel/time.c Mon Oct 11 00:01:02 1999
+++ arch/i386/kernel/time.c Fri Dec 3 21:53:07 1999
@@ -80,8 +80,8 @@ extern rwlock_t xtime_lock;

static inline unsigned long do_fast_gettimeoffset(void)
{
- register unsigned long eax asm("ax");
- register unsigned long edx asm("dx");
+ register unsigned long eax;
+ register unsigned long edx;

/* Read the Time Stamp Counter */

--------------4380DC9978A7EEBC342A4C8F--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/