This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Calling convention that gets frame pointer register clobbered
- From: Etienne Lorrain <etienne_lorrain at yahoo dot fr>
- To: Jim Wilson <wilson at specifixinc dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 22 Dec 2003 10:54:02 +0100 (CET)
- Subject: Re: Calling convention that gets frame pointer register clobbered
--- Jim Wilson wrote:
> Etienne Lorrain wrote:
> > You cannot compile the logical (%si containning the address of a
> > structure to be filled by the disk BIOS service int $0x13):
>
> I don't understand what the complaint is here. The example you gave
> doesn't compile because ebiosinfo_t is undefined. If I add a simple
> structure, then it does compiler. I don't get an error with gcc-3.3 or
> current mainline. I don't see anything obviously wrong with the
> resulting assembly code.
The code is compiling if the structure is small enough to fit in
a 32 bits register, not if it has to be in memory - I should have
said it. With the compiler I have nearby, this code is only
compiling if the line "// unsigned c, d, e, f;" is commented out:
---------------------------
typedef struct {
unsigned char a,b;
// unsigned c, d, e, f;
} ebiosinfo_t;
unsigned char
_EBIOSDISK_getparam (unsigned char disk, ebiosinfo_t *ebiosinfo,
unsigned char *status)
{
unsigned char carry;
asm (
" int $0x13 # _EBIOSDISK_getparam \n"
" mov %%ah,%1 \n"
" setc %0 \n"
: "=qm" (carry), "=qm" (*status)
: "a"((unsigned short)0x4800), "d" (disk), "S" (*ebiosinfo)
);
return carry;
}
---------------------------
$ gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs
Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld
--with-gnu-as --prefix=/usr --e
xec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libexecdir=/usr/sbin
--mandir=/usr/share/man -
-infodir=/usr/share/info --enable-languages=c,ada,c++,f77,pascal,java,objc
--enable-libgcj --enable-
threads=posix --with-system-zlib --enable-nls --without-included-gettext
--enable-interpreter --enab
le-sjlj-exceptions --disable-version-specific-runtime-libs --enable-shared
--disable-win32-registry
--enable-java-gc=boehm --disable-hash-synchronization --verbose
--target=i686-pc-cygwin --host=i686-
pc-cygwin --build=i686-pc-cygwin
Thread model: posix
gcc version 3.3.1 (cygming special)
$ gcc -O2 tmp.c
/usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../libcygwin.a(libcmain.o)(.text+0x7c):
undefined refere
nce to `_WinMain@16'
collect2: ld returned 1 exit status
$ vi tmp.c # to uncomment line 3:
$ gcc -O2 tmp.c
tmp.c: In function `_EBIOSDISK_getparam':
tmp.c:12: internal compiler error: in emit_move_insn, at expr.c:3159
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Note that I did not notice the change of message in later versions,
and cygwin is not my usual reference - but this code does not compile
since at least gcc-2.95.
Etienne.
_________________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com