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

> #include <stdio.h>
> volatile long foo;
> main()
> {
> foo++;
> printf("%ld\n", foo);
> }
>
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);
}
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);
}
gcc 2.7.2.3 gcc 2.95.2
---------------------------------- -----------------------------
.file "xxx.c" .file "x.c"
.version "01.01" .version "01.01"
gcc2_compiled.: gcc2_compiled.:
.section .rodata .section .rodata
.LC0: .LC0:
.string "%ld\n" .string "%ld\n"
.text .text
.align 4 .align 4
.globl main .globl main
.type main,@function .type main,@function
main: main:
movl foo,%eax
pushl %ebp subl $12,%esp ! Uh ..
movl %esp,%ebp
movl foo,%eax ! Get it
leal 1(%eax),%edx ! bump it by one incl %eax
addl $-8,%esp ! Uh ..
movl %eax,foo
movl %edx,foo ! write it back
movl foo,%eax ! Then something dumb movl foo,%eax
movl foo,%edx ! Then something dumb again
! actually just loading the parameter for printf()
pushl %edx pushl %eax
pushl $.LC0 pushl $.LC0
call printf call printf
addl $8,%esp addl $16,%esp
addl $12,%esp ! Waste
.L1:
leave
ret ret
.Lfe1: .Lfe1:
.size main,.Lfe1-main .size main,.Lfe1-main
.comm foo,4,4 .comm foo,4,4
.ident "GCC: (GNU) 2.7.2.3" .ident "GCC: (GNU) 2.95.2 19991024 (release)"

Dick, did you compile with the default kernel flags ?


Peter Kooiman | Voice : +27-12-547-2846
| Cell : +27-82-321-3339
Box 81214, DOORNPOORT, 0017, RSA | e-mail : pko@paradigm-sa.com



-
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:1.451 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site