public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel@vger.kernel.org
Subject: Re: copy to suer space
Date: 23 Nov 2001 15:53:54 -0800	[thread overview]
Message-ID: <9tmnii$8q4$1@cesium.transmeta.com> (raw)
In-Reply-To: <5.1.0.14.2.20011120165440.00a745b0@pop.cus.cam.ac.uk> <200111211057.fALAvi288566@criticalsoftware.com> <m2ofltljcl.fsf@trasno.mitica> <200111231440.fANEeh213167@criticalsoftware.com>

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>

  reply	other threads:[~2001-11-23 23:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.31.0111201637420.13674-100000@mail.deis.isec.pt >
2001-11-20 17:02 ` copy to suer space Anton Altaparmakov
2001-11-20 17:08   ` Luís Henriques
2001-11-20 18:41     ` Andreas Dilger
2001-11-20 18:44       ` Luís Henriques
2001-11-20 18:58         ` Hua Zhong
2001-11-20 19:39         ` Andreas Dilger
2001-11-21  0:06           ` Mike Fedyk
2001-11-21 10:52             ` Luís Henriques
2001-11-23 13:14               ` Juan Quintela
2001-11-23 14:35                 ` Luís Henriques
2001-11-23 23:53                   ` H. Peter Anvin [this message]
2001-11-20 17:37   ` Anton Altaparmakov
2001-11-20 17:53     ` Luís Henriques
2001-11-20 18:18       ` Nick LeRoy
2001-11-22 18:51       ` Andreas Bombe
2001-11-20 18:09   ` Luís Henriques
2001-11-21 14:37 Joerg Pommnitz
     [not found] <sbfa4d3a.051@MAIL-SMTP.uvsc.edu>
2001-11-21 10:49 ` Luís Henriques
  -- strict thread matches above, loose matches on Subject: below --
2001-11-20 16:40 Luis Miguel Correia Henriques

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='9tmnii$8q4$1@cesium.transmeta.com' \
    --to=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox