comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
To: <comp.lang.ada@ada.eu.org>
Subject: Re: Accessing a register with a larger size from generic
Date: Thu, 27 Sep 2001 14:16:50 -0500
Date: 2001-09-27T14:16:50-05:00	[thread overview]
Message-ID: <mailman.1001618128.14641.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: slrn9r6s3u.pqt.lutz@belenus.iks-jena.de

Could it be that you need to use a 'Size clause on
the call_code type so as to make it 32 bits instead of 8 bits?

The friendly compiler probably thinks it's helping you by
making your enumeration type 8 bits wide (assuming there are
less than 256 enumerates).

----- Original Message -----
From: "Lutz Donnerhacke" <lutz@iks-jena.de>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: Thursday, September 27, 2001 1:31 PM
Subject: Accessing a register with a larger size from generic


>   ------------------------------
> [...with, use, package (body), ...]
> subtype long is Interfaces.C.long;
>
> type call_code is (KILL, FORK, EXIT, ...);
> for call_code use (KILL => 1, FORK => 2, ...);
>
> generic
>    call : call_code;
>    type type1 is private;
> function syscall1 (arg1 : type1) return long;
>
> function syscall1 (arg1 : type1) return long is
>    res : long;
> begin
>    Asm ("int $0x80",
>         Outputs => long'Asm_Output ("=a", res),
>         Inputs  => (call_code'Asm_Input ("0", call),
>                     type1'Asm_Input ("b", arg1)),
>         Volatile => True);
>    return res;
> end syscall1;
>   ------------------------------
>
> generates code (using GNAT 3.13p) like:
>   movb $2, %al
>   xorw %bx, %bx
>   int  0x80
> instead of
>   movl $2, %eax
>   xorl %ebx, %ebx
>   int  0x80
>
>
> How can I change the type of the generated RTL expression to SI independed
> of the generic type?
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada
>




  reply	other threads:[~2001-09-27 19:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-27 18:31 Accessing a register with a larger size from generic Lutz Donnerhacke
2001-09-27 19:16 ` David C. Hoos [this message]
2001-10-02  8:01   ` Lutz Donnerhacke
2001-09-28  8:53 ` Lutz Donnerhacke
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox