System on PowerPC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a multi-part message in MIME format.

------=_NextPart_000_001C_01C1C8EC.13E31210
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Hi,=20
Can anyone explain syscallX() marco (in PowerPC) for me, especially mfcr =
instruction. I appreciate if anyone can give me one example (i.e. =
coversion from C code to assembly code of one system call):
#define _syscall1(type,name,type1,arg1)     \
type name(type1 arg1)       \
{         \
 unsigned long __sc_ret, __sc_err;    \
 {        \
  register unsigned long __sc_0 __asm__ ("r0");  \
  register unsigned long __sc_3 __asm__ ("r3");  \
         \
  __sc_3 =3D (unsigned long) (arg1);   \
  __sc_0 =3D __NR_##name;     \
  __asm__ __volatile__     \
   ("sc           \n\t"    \
    "mfcr %1      "    \
   : "=3D&r" (__sc_3), "=3D&r" (__sc_0)  \
   : "0"   (__sc_3), "1"   (__sc_0)  \
   : __syscall_clobbers);    \
  __sc_ret =3D __sc_3;     \
  __sc_err =3D __sc_0;     \
 }        \
 __syscall_return (type);     \
}
Thank you for help in advanced,
DANG NGUYEN DUC

------=_NextPart_000_001C_01C1C8EC.13E31210
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi, </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Can anyone explain syscallX() marco (in =
PowerPC)=20
for me, especially mfcr instruction. I appreciate if anyone can give me =
one=20
example (i.e. coversion from C code to assembly code&nbsp;of one system=20
call):</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>#define=20
_syscall1(type,name,type1,arg1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<BR>type=20
name(type1=20
arg1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<BR>{&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<BR>&nbsp;unsigned=20
long __sc_ret,=20
__sc_err;&nbsp;&nbsp;&nbsp;&nbsp;\<BR>&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;\<BR>&nbsp;&nbsp;register=20
unsigned long __sc_0 __asm__ =
("r0");&nbsp;&nbsp;\<BR>&nbsp;&nbsp;register=20
unsigned long __sc_3 __asm__=20
("r3");&nbsp;&nbsp;\<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;\<BR>&nbsp;&nbsp;__sc_3=20
=3D (unsigned long) (arg1);&nbsp;&nbsp;&nbsp;\<BR>&nbsp;&nbsp;__sc_0 =3D =

__NR_##name;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<BR>&nbsp;&nbsp;__asm__=20
__volatile__&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<BR>&nbsp;&nbsp;&nbsp;("sc&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
\n\t"&nbsp;&nbsp;&nbsp;&nbsp;\<BR>&nbsp;&nbsp;&nbsp; "mfcr=20
%1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
"&nbsp;&nbsp;&nbsp;&nbsp;\<BR>&nbsp;&nbsp;&nbsp;: "=3D&amp;r" (__sc_3), =
"=3D&amp;r"=20
(__sc_0)&nbsp;&nbsp;\<BR>&nbsp;&nbsp;&nbsp;: "0"&nbsp;&nbsp; (__sc_3),=20
"1"&nbsp;&nbsp; (__sc_0)&nbsp;&nbsp;\<BR>&nbsp;&nbsp;&nbsp;:=20
__syscall_clobbers);&nbsp;&nbsp;&nbsp;&nbsp;\<BR>&nbsp;&nbsp;__sc_ret =
=3D=20
__sc_3;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<BR>&nbsp;&nbsp;__sc_err =3D=20
__sc_0;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<BR>&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;\<BR>&nbsp;__syscall_return=20
(type);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\<BR>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thank you for help in =
advanced,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>DANG NGUYEN =
DUC</FONT></DIV></BODY></HTML>

------=_NextPart_000_001C_01C1C8EC.13E31210--





[Index of Archives]     [Kernel Newbies]     [Red Hat General]     [Fedora]     [Red Hat Install]     [Linux Kernel Development]     [Yosemite News]

  Powered by Linux