From: Rod Kay <rodakay5@gmail.com>
Subject: Re: Using pointers with inline assembly in Ada
Date: Fri, 10 Jun 2022 15:24:35 +1000 [thread overview]
Message-ID: <t7ukpe$759$1@dont-email.me> (raw)
In-Reply-To: <db04b8e7-ba96-4f4a-afb1-575e446ace64n@googlegroups.com>
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.
next prev parent reply other threads:[~2022-06-10 5:24 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 [this message]
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
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