From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:622a:1787:b0:304:e74c:ae47 with SMTP id s7-20020a05622a178700b00304e74cae47mr25479573qtk.285.1654864016948; Fri, 10 Jun 2022 05:26:56 -0700 (PDT) X-Received: by 2002:a25:8610:0:b0:664:5ccf:94af with SMTP id y16-20020a258610000000b006645ccf94afmr4021301ybk.379.1654864016775; Fri, 10 Jun 2022 05:26:56 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 10 Jun 2022 05:26:56 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=73.205.150.94; posting-account=Ru7E4QoAAAC_HiQ2D8LjZ7rh1mbTNcVn NNTP-Posting-Host: 73.205.150.94 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Using pointers with inline assembly in Ada From: NiGHTS Injection-Date: Fri, 10 Jun 2022 12:26:56 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2871 Xref: reader02.eternal-september.org comp.lang.ada:63963 List-Id: On Friday, June 10, 2022 at 7:18:03 AM UTC-4, Luke A. Guest wrote: > On 10/06/2022 06:24, Rod Kay wrote:=20 > > On 10/6/22 07:30, NiGHTS wrote:=20 > >> declare=20 > >> type ff is array (0 .. 10) of Unsigned_32;=20 > >> pragma Pack(ff);=20 > >> Flags : aliased ff :=3D (others =3D> 0);=20 > >> Flag_Address : System.Address :=3D Flags'Address;=20 > >> begin=20 > >> Asm ( "movl %0, %%eax" &=20 > >> "movl $1, (%%eax)" ,=20 > >> Inputs =3D> System.Address'Asm_Input ("g",=20 > >> Flag_Address),=20 > >> Clobber =3D> "eax",=20 > >> Volatile =3D> true=20 > >> );=20 > >> Put_Line ("Output:" & Flags(0)'Img);=20 > >> end;=20 > >>=20 > >=20 > > If you are on a 64 bit machine, then I expect 'pragma Pack' might be= =20 > > the problem, as 2 consecutive array elements will fir into a single=20 > > address.=20 > >=20 > >=20 > > Also, possibly use ...=20 > >=20 > > Flag_Address : System.Address :=3D Flags (Flags'First)'Address;=20 > >=20 > >=20 > > Regards. > Dump the xpanded (generated code) and the assembly from gnat. Though that wouldn't be a bad idea, I've decided to do this another way. I = have a limited time to work on this project and I'm just not feeling it. To= o risky to work on something this important with so little documentation. I= figured I'd give the problem the due-diligence of posting the question on = here but I've made up my mind that at least with the project I am working o= n that I write the code in C/Asm instead. Thank you for your help though.