Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Mar 1996 12:32:21 -0700
From:      nate@sneezy.sri.com (Nate Williams)
To:        hackers%FreeBSD.org@sri.com
Subject:   GAS question
Message-ID:  <199603151932.MAA11752@rocky.sri.MT.net>

next in thread | raw e-mail | index | archive | help
[
  I'm bouncing this through sri.com in hopes that it gets to the mailing
  lists due to Sprintnet problems.  Please respond to
  'nate@sneezy.sri.com' (it should be setup to do that).
]

Can someone explain to me the following piece of code please?  I can't
find *any* documentation on it, and I've stared at it long enough but
still can't answer what it does definitively.

Thanks!


Nate
--------
inline int
apm_int(u_long *eax, u_long *ebx, u_long *ecx)
{
	u_long cf;
	__asm ("pushl	%%ebp
		pushl	%%edx
		pushl	%%esi
		xorl	%3,%3
		movl	%3,%%esi
		lcall	_apm_addr
		jnc	1f
		incl	%3
	1:
		popl	%%esi
		popl	%%edx
		popl	%%ebp"
		: "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=D" (cf)
		: "0" (*eax),  "1" (*ebx),  "2" (*ecx)
		);
	apm_errno = ((*eax) >> 8) & 0xff;
	return cf;
}


Most of this is obvious, but these two lines completely baffle me.

: "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=D" (cf)
: "0" (*eax),  "1" (*ebx),  "2" (*ecx)

Obviously it sets up some sort of mapping between the variables &
parameters and the assembly level registers, and some comments I've read
on similar code implies that it also says something regarding
optimizations (similar to volatile and const?).

Please help me oh gas gurus. :)


Nate




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603151932.MAA11752>