lkml.org 
[lkml]   [1999]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: Breakage in arch/i386/kernel/time.c
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>
--- /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 */
\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.032 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site