This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: bounds checking and traps
- From: "Jan Beulich" <JBeulich at novell dot com>
- To: <rth at redhat dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Fri, 13 Aug 2004 08:40:12 +0200
- Subject: Re: bounds checking and traps
Not necessarily - if the gate for int 5 has a dpl less than 3, then an
int 5 will raise a gp fault (which will normally still terminate the
app, but it's inconsistent). If you want a #BR, then you need to use
bound. Additionally, for x86-64 (in 64-bit mode) there is no bound (and
hence no #BR), and hence there can't be a requirement for the OS to
handle int 5 (in a way other than how it would handle any other unknown
exception) when it doesn't support 32-bit code.
Jan
>>> Richard Henderson <rth@redhat.com> 13.08.04 02:49:39 >>>
On Thu, Aug 12, 2004 at 04:42:48PM -0700, James E Wilson wrote:
> Jan Beulich wrote:
> >When I came across the x86 backend emitting int 5 instructions I
> >wondered what that would be good for
>
> These are standard named patterns. Grep for "gen_trap", and note
where
> it is called.
>
> Yes, this may need to be OS dependent.
I'm pretty sure that "int 5" is the same exception as "#BR"
as would be raised by the "bound" instruction. And thus all
x86 operating systems should map it to something reasonable
that kills the process.
r~