![]() | |||||||||||||
Messages in this thread |
Followup to: <200111231440.fANEeh213167@criticalsoftware.com> By author: =?iso-8859-1?q?Lu=EDs=20Henriques?= <lhenriques@criticalsoftware.com> In newsgroup: linux.dev.kernel > > 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? -hpa -- <hpa@transmeta.com> at work, <hpa@zytor.com> in private! "Unix gives you enough rope to shoot yourself in the foot." http://www.zytor.com/~hpa/puzzle.txt <amsp@zytor.com> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ | ||||||||||||
| Last update: 2005-03-22 12:13 [from the cache] ©2003-2008 | |||||||||||||