[lkml]   [2001]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: copy to suer space
Followup to:  <>
By author: =?iso-8859-1?q?Lu=EDs=20Henriques?=
In newsgroup:
> When I read the timestamp («rdtsc»), a value is returned to edx:eax. This
> code works just fine when I put it in the process stack. The problem is when
> I want to compare %edx instead of %eax, that is:
> rdtsc
> movl %edx, %ecx
> addl $0x1, %ecx
> loop:
> rdtsc
> cmp %ecx, %edx
> jb loop
> This is supposed to take much more time than the other loop. When I write
> this code to the stack of my process, a segmentation fault occurs after some
> time. Why? I'm not changing the stack at any moment! (By the way, the stack
> pointer is pointing to the end of my code...)

Did you remember to restore all the registers, including %eax and
%eflags, before you return?

<> at work, <> in private!
"Unix gives you enough rope to shoot yourself in the foot." <>
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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