comp.lang.ada
 help / color / mirror / Atom feed
From: "Luke A. Guest" <laguest@archeia.com>
Subject: Re: Using pointers with inline assembly in Ada
Date: Fri, 10 Jun 2022 12:16:27 +0100	[thread overview]
Message-ID: <t7v995$4lk$1@gioia.aioe.org> (raw)
In-Reply-To: t7ukpe$759$1@dont-email.me

On 10/06/2022 06:24, Rod Kay wrote:
> On 10/6/22 07: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;
>>
> 
>     If you are on a 64 bit machine, then I expect 'pragma Pack' might be 
> the problem, as 2 consecutive array elements will fir into a single 
> address.
> 
> 
>     Also, possibly use ...
> 
>     Flag_Address : System.Address := Flags (Flags'First)'Address;
> 
> 
> Regards.

Dump the xpanded (generated code) and the assembly from gnat.

  reply	other threads:[~2022-06-10 11:16 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 [this message]
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
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