This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Using special calling conventions
- From: Tom Bachmann <e_mc_h2 at web dot de>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 01 Jun 2007 16:20:23 +0200
- Subject: Using special calling conventions
- Openpgp: id=AF495A1B; url=home.arcor.de/ness01/0xAF495A1B.asc
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
[please cc me, I'm not subscribed to the list]
I am writing a system call stub. A system call here is basically a
function call, with the exception that nearly all registers are used to
pass arguments. Specifically I'm on ia32e/amd64, except for rfl, rip and
rsp all registers are used to pass arguments to and from the kernel. Of
course I can write a asm routine that follows the normal (elf) calling
conventions and that pushes the arguments into the right registers and
saves the necessary registers, but that stops gcc from optimizing this code.
I wonder if I can specify a function prototype where the arguments are
passed in arbitrary registers (and gcc cares about the register saving
etc; that only does syscall in the asm implementation), or what the
otherwise recommended way to go here is?
thanks,
- --
- -ness-
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFGYCsnvD/ijq9JWhsRAmm5AJ4rY5A5BANOICH+jcOgQ5evwbbucgCeL/dg
u8ozkyNGnaXNWjDx/QSfAyY=
=HmpP
-----END PGP SIGNATURE-----