Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Sep 1998 12:06:34 -0400 (EDT)
From:      Charles Youse <cyouse@artemis.syncom.net>
To:        Mikael Karpberg <karpen@ocean.campus.luth.se>
Cc:        Konrad Heuer <kheuer@gwdu60.gwdg.de>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Catching SIGSEGV
Message-ID:  <Pine.NEB.3.96.980915120310.27342A-100000@artemis.syncom.net>
In-Reply-To: <199809151330.PAA00371@ocean.campus.luth.se>

next in thread | previous in thread | raw e-mail | index | archive | help


On Tue, 15 Sep 1998, Mikael Karpberg wrote:

> My guess is that you would want to declare things like this:
> 
> volatile int nsegv = 0;
> volatile int *ptr;
> int zero = 0;
> 
> Then the restarted "buf = *ptr;" line will not use a buffered value for ptr
> but read it from memory. I think.

Unfortunately, because the value of ptr is most likely read from a
register in the instruction that faults, declaring it volatile does not
help.  Volatile prevents optimization, but loading a value into a register
to perform indirection is not an optimization, and in most cases (and on
most architectures) this load is *required*.

Restarting the instruction, despite the changed value of ptr, will not
change the value in the register, and so the fault will occur again.

Chuck Youse
cyouse@syncom.net



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96.980915120310.27342A-100000>