lkml.org 
[lkml]   [2000]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: (*(unsigned long *)&jiffies)++;
On Thu, 6 Jan 2000, Andrea Arcangeli wrote:

> On Thu, 6 Jan 2000, Tigran Aivazian wrote:
>
> >Hi,
> >
> >Why does do_timer() do:
> >
> >(*(unsigned long *)&jiffies)++;
> >
> >why not just jiffies++; ? It works fine with jiffies++ but I assume there
> >is a reason...
>
> No reason. It won't make any difference.
>
> You could as well do jiffies++. jiffies is volatile so it can't be
> reodered across other `;' and it won't be cached into registers.
>
[SNIPPED]


Well it __is__ cached into registers on this compiler (2.7.2.3)!

#include <stdio.h>
volatile long foo;
main()
{
foo++;
printf("%ld\n", foo);
}

.file "xxx.c"
.version "01.01"
gcc2_compiled.:
.section .rodata
.LC0:
.string "%ld\n"
.text
.align 4
.globl main
.type main,@function
main:
pushl %ebp
movl %esp,%ebp
movl foo,%eax ! Get it
leal 1(%eax),%edx ! bump it by one
movl %edx,foo ! write it back
movl foo,%eax ! Then do something dumb
movl foo,%edx ! Then do something dumb again
pushl %edx
pushl $.LC0
call printf
addl $8,%esp
.L1:
leave
ret
.Lfe1:
.size main,.Lfe1-main
.comm foo,4,4
.ident "GCC: (GNU) 2.7.2.3"


Cheers,
Dick Johnson

Penguin : Linux version 2.3.35 on an i686 machine (400.59 BogoMips).


-
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/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.102 / U:0.368 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site