From: NiGHTS <nights@unku.us>
Subject: Re: Using pointers with inline assembly in Ada
Date: Fri, 10 Jun 2022 18:51:02 -0700 (PDT) [thread overview]
Message-ID: <c1f740b6-4dfe-4904-a73d-1957d6fb98c5n@googlegroups.com> (raw)
In-Reply-To: <t7vhit$ar$1@dont-email.me>
On Friday, June 10, 2022 at 9:39:44 AM UTC-4, Jeffrey R.Carter wrote:
> On 2022-06-09 23:30, NiGHTS wrote:
> >
> > declare
> > type ff is array (0 .. 10) of Unsigned_32;
> > pragma Pack(ff);
> > Flags : aliased ff := (others => 0);
> > Flag_Address : System.Address := Flags'Address;
> > begin
> > Asm ( "movl %0, %%eax" &
> > "movl $1, (%%eax)" ,
> > Inputs => System.Address'Asm_Input ("g", Flag_Address),
> > Clobber => "eax",
> > Volatile => true
> > );
> > Put_Line ("Output:" & Flags(0)'Img);
> > end;
> Have you looked at the GNAT User's Guide section on this
> (https://docs.adacore.com/live/wave/gnat_ugn/html/gnat_ugn/gnat_ugn/inline_assembler.html)?
> I have never used this, but the first thing I notice is that the examples in the
> User's Guide put an LF-HT pair between statements:
>
> Asm ("pushfl" & LF & HT & -- push flags on stack
> "popl %%eax" & LF & HT & -- load eax with flags
> "movl %%eax, %0", -- store flags in variable
> Outputs => Unsigned_32'Asm_Output ("=g", Flags));
>
> It is also legal to separate the statements with spaces, but what you have would
> seem to be
>
> movl %0, %%eaxmovl $1, (%%eax)
>
> which may be a problem.
> --
> Jeff Carter
> "I'm a lumberjack and I'm OK."
> Monty Python's Flying Circus
> 54
On my side I had the LF HT characters. I copied the code badly to this posting. So though you are right, my post lied a little bit by accident. This didn't end up being the main problem.
next prev parent reply other threads:[~2022-06-11 1:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-09 21:30 Using pointers with inline assembly in Ada NiGHTS
2022-06-10 5:24 ` Rod Kay
2022-06-10 11:16 ` Luke A. Guest
2022-06-10 12:26 ` NiGHTS
2022-06-10 12:16 ` NiGHTS
2022-06-10 13:19 ` Jeffrey R.Carter
[not found] ` <nnd$727405a5$1c8a5b81@aedbf58048bf777d>
2022-06-10 12:23 ` NiGHTS
2022-06-11 1:43 ` Rod Kay
2022-06-10 13:39 ` Jeffrey R.Carter
2022-06-11 1:51 ` NiGHTS [this message]
2022-06-11 12:28 ` Simon Wright
2022-06-11 12:32 ` NiGHTS
2022-06-13 20:33 ` Gabriele Galeotti
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox