Calling conventions/register use?

Calling conventions/register use?

Post by Georg Ach » Thu, 09 Jul 1998 04:00:00



Hi,
is there any description, how (exactly!) subroutines are called on Alpha-Linux
and what registers have to saved etc.? I've looked through the egcs-code, but
that was not very informative. I've also examined the 'gcc -S' output, but that
helps only for the obvious things (r16-r21 calling parameters...). Since I have
to do some just-in-time-compilation, this information is of some importance ;-)
--
        Bye

         http://www.informatik.tu-muenchen.de/~acher/
          "Oh no, not again !" The bowl of petunias          

 
 
 

Calling conventions/register use?

Post by Robert Harle » Thu, 09 Jul 1998 04:00:00



>is there any description, how (exactly!) subroutines are called on Alpha-Linux
>and what registers have to saved etc.?

As far as I know it's the same as for Digital Unix, but what do I
know?  Presumably Linus himself (grovel) would be able to fill you in
with a more authoritative answer.

Anyway, browse around:

http://www.partner.digital.com/www-swdev/pages/Home/TECH/documents/os...

There's an "Assembly Language Programmer's Guide", with the wonderful
name of AA-PS31C-TET1.ps, and a "Calling Standard for AXP Systems",
AA-PY8AB-TET1.ps, and plenty of other stuff.

Rob.

 
 
 

1. do_fork() and i386 Register Conventions

Hello All:

I'm trying to determine how to access:
 1) the executable file name,
 2) the command line arguments
 3) and if possible the environment variables
of a recently forked process/thread in the linux kernel.
I am using a linux kernel 2.5.43 with the Linux Trace Toolkit (LTT)
0.9.6pre2
patch, with the i386 architecture (AMD Athlon) target.

Using the very helpful Linux Kernel Cross Reference for
the 2.5.46 kernel (sans LTT patch), I've noticed that the code for
kernel_thread function in kernel/process.c

216 regs.ebx = (unsigned long) fn;
217 regs.edx = (unsigned long) arg;

So I thought that regs.ebx held a pointer to the name of the
executable
being forked, and regs.edx held a pointer to the command line
arguments
list.  However, when I tried to take strlen((unsigned char *)
regs.ebx)
it failed (and in the redhat 7.3 boot sequence, that the message
scrolls
away pretty quickly).

Is ((unsigned char *) regs.ebx) a pointer to the executable name, if
so, is there some memory protection issue here?
Do I need to do something to get at the memory where it resides?

Regarding the command line arguments, is ((unsigned char **) regs.edx)
the command line arguments corresponding to the argv parameter, as in
int main(int argc, char **argv)?

If so, is there a safe way to figure out the number of command line
arguments?

Thanks:

Bill M. (last name witheld to prevent spamming)

2. Fatal error opening RPM database (followed by sig 11's)

3. Register conventions for SPARC

4. Network Server Installation

5. CALL FOR PAPERS for the O'REILLY OPEN SOURCE CONVENTION 2000

6. Can't compile ipv[46] with ipsec (2.5.69)

7. compaq ap400 onboard nic

8. LINUX CALL FOR PAPERS for the O'REILLY OPEN SOURCE CONVENTION 2001

9. linux alpha calling convention

10. PASCAL calling convention in C++

11. CALL FOR PAPERS for the O'REILLY OPEN SOURCE CONVENTION 2000