From: Segher Boessenkool <segher@kernel.crashing.org>
To: William Tambe <tambewilliam@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Unconditional trap
Date: Sun, 13 Sep 2020 09:11:23 -0500 [thread overview]
Message-ID: <20200913141123.GU28786@gate.crashing.org> (raw)
In-Reply-To: <CAF8i9mMheO7_RpnuY=h+zMe1DTun90J=VuBjdnNdc0ozRSs2qA@mail.gmail.com>
Hi!
On Sat, Sep 12, 2020 at 03:17:03PM -0500, William Tambe via Gcc-help wrote:
> I am currently using following for trap instruction:
>
> (define_insn "trap"
> [(trap_if (const_int 1) (const_int 0))]
> ""
> "brk")
This looks fine.
> However it causes the compiler to generate a trap when address 0 is
> used; in the example below, I have a function that prints characters
> through the UART using address 0; but the resulting assembly generates
> a function that traps instead.
>
> #define UART_ADDR 0
> void uart_print (char *s) {
> while (*s) {
> *(volatile char *)UART_ADDR = *s;
> ++s;
> }
> }
>
> How can one implement unconditional trap ?
You should implement TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID to make 0 a
valid address.
Segher
prev parent reply other threads:[~2020-09-13 14:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-12 20:17 William Tambe
2020-09-12 20:26 ` Marc Glisse
2020-09-12 21:04 ` William Tambe
2020-09-12 21:24 ` Marc Glisse
2020-09-13 14:11 ` Segher Boessenkool [this message]
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=20200913141123.GU28786@gate.crashing.org \
--to=segher@kernel.crashing.org \
--cc=gcc-help@gcc.gnu.org \
--cc=tambewilliam@gmail.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).