This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Undocumented and used behaviour (was: Re: GCC-only software)
- From: Etienne Lorrain <etienne_lorrain at yahoo dot fr>
- To: gcc at gcc dot gnu dot org
- Cc: lopezibanez at gmail dot com
- Date: Wed, 11 Mar 2009 16:26:45 +0000 (GMT)
- Subject: Undocumented and used behaviour (was: Re: GCC-only software)
- Reply-to: etienne_lorrain at yahoo dot fr
Manuel López-Ibáñez <lopezibanez at gmail dot com> wrote:
> Anything not documented there is likely to change or be removed in the
> future, so you should not rely on it. On the other hand, if you find
> some behaviour that you feel should be documented and it is not,
> please submit a documentation patch (or at least open a bug report).
Well, do I have any chance to have the 'asm (" %c0 ": : "" );' and
'asm (" %a0 ": : "" );' documented if I submit a bug report?
I am using the %c when I want to access a field of a complex global
structure in assembly, like (to put in a non inlined function):
asm volatile (" go_msg = %c0 " : : "p" (gujin_param.go_msg) );
then "go_msg" can be used like any other symbol in a 50 lines 'asm ("");'
I am using the %a in such two functions:
typedef farptr unsigned;
extern inline unsigned char
EMM386_get_state (farptr entrypoint)
{
unsigned short ax = 0x0000;
#if 0 /* doesn't work */
asm ASMREAD (" lcallw *%1 # EMM386_entry_point, EMM386_get_state "
: "+a" (ax)
: "m" (entrypoint)
);
#else
asm ASMREAD (" lcallw *%a1 # EMM386_entry_point, EMM386_get_state "
: "+a" (ax)
: "pr" (&entrypoint)
);
#endif
return ax >> 8;
}
extern inline unsigned short
_XMS_global_enable_A20 (farptr entrypoint, unsigned char *error)
{
unsigned short result;
asm volatile (" lcallw *%a3 # XMS entry point, _XMS_global_enable_A20 "
: "=a" (result), "=b" (*error)
: "a" (0x0300), "pr" (&entrypoint), "m" (entrypoint)
);
if (result == 1)
return 0; /* success */
else
return 1;
}
I did not find any other working way to do it...
Regards,
Etienne.