Artifact a1ee37741df3ccff9c49be41860b9d9ce334281a:


0000: 2f 2a 20 54 72 61 6d 70 6f 6c 69 6e 65 20 66 6f  /* Trampoline fo
0010: 72 20 70 6f 77 65 72 70 63 20 43 50 55 20 77 69  r powerpc CPU wi
0020: 74 68 20 41 49 58 20 63 61 6c 6c 69 6e 67 20 63  th AIX calling c
0030: 6f 6e 76 65 6e 74 69 6f 6e 20 2a 2f 0a 0a 2f 2a  onvention */../*
0040: 0a 20 2a 20 43 6f 70 79 72 69 67 68 74 20 31 39  . * Copyright 19
0050: 39 35 2d 32 30 30 36 20 42 72 75 6e 6f 20 48 61  95-2006 Bruno Ha
0060: 69 62 6c 65 2c 20 3c 62 72 75 6e 6f 40 63 6c 69  ible, <bruno@cli
0070: 73 70 2e 6f 72 67 3e 0a 20 2a 0a 20 2a 20 54 68  sp.org>. *. * Th
0080: 69 73 20 69 73 20 66 72 65 65 20 73 6f 66 74 77  is is free softw
0090: 61 72 65 20 64 69 73 74 72 69 62 75 74 65 64 20  are distributed 
00a0: 75 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47 65  under the GNU Ge
00b0: 6e 65 72 61 6c 20 50 75 62 6c 69 63 20 4c 69 63  neral Public Lic
00c0: 65 6e 63 65 0a 20 2a 20 64 65 73 63 72 69 62 65  ence. * describe
00d0: 64 20 69 6e 20 74 68 65 20 66 69 6c 65 20 43 4f  d in the file CO
00e0: 50 59 49 4e 47 2e 20 43 6f 6e 74 61 63 74 20 74  PYING. Contact t
00f0: 68 65 20 61 75 74 68 6f 72 20 69 66 20 79 6f 75  he author if you
0100: 20 64 6f 6e 27 74 20 68 61 76 65 20 74 68 69 73   don't have this
0110: 0a 20 2a 20 6f 72 20 63 61 6e 27 74 20 6c 69 76  . * or can't liv
0120: 65 20 77 69 74 68 20 69 74 2e 20 54 68 65 72 65  e with it. There
0130: 20 69 73 20 41 42 53 4f 4c 55 54 45 4c 59 20 4e   is ABSOLUTELY N
0140: 4f 20 57 41 52 52 41 4e 54 59 2c 20 65 78 70 6c  O WARRANTY, expl
0150: 69 63 69 74 20 6f 72 20 69 6d 70 6c 69 65 64 2c  icit or implied,
0160: 0a 20 2a 20 6f 6e 20 74 68 69 73 20 73 6f 66 74  . * on this soft
0170: 77 61 72 65 2e 0a 20 2a 2f 0a 0a 2f 2a 20 41 76  ware.. */../* Av
0180: 61 69 6c 61 62 6c 65 20 72 65 67 69 73 74 65 72  ailable register
0190: 73 3a 20 72 30 2c 20 72 31 32 2c 20 72 31 31 2c  s: r0, r12, r11,
01a0: 20 72 31 30 2c 20 72 39 2c 20 72 38 2c 20 72 37   r10, r9, r8, r7
01b0: 2c 20 72 36 2c 20 72 35 2c 20 72 34 2c 20 72 33  , r6, r5, r4, r3
01c0: 2e 20 2a 2f 0a 2f 2a 20 48 6f 77 65 76 65 72 2c  . */./* However,
01d0: 20 72 30 20 69 73 20 73 70 65 63 69 61 6c 20 69   r0 is special i
01e0: 6e 20 74 68 61 74 20 69 74 20 63 61 6e 6e 6f 74  n that it cannot
01f0: 20 62 65 20 75 73 65 64 20 61 73 20 61 20 62 61   be used as a ba
0200: 73 65 20 72 65 67 69 73 74 65 72 2e 20 2a 2f 0a  se register. */.
0210: 2f 2a 20 41 6e 64 20 72 33 2e 2e 2e 72 31 30 20  /* And r3...r10 
0220: 73 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 63 6c  should not be cl
0230: 6f 62 62 65 72 65 64 20 62 65 63 61 75 73 65 20  obbered because 
0240: 74 68 65 79 20 63 6f 6e 74 61 69 6e 20 74 68 65  they contain the
0250: 20 66 69 72 73 74 20 38 0a 20 2a 20 69 6e 74 65   first 8. * inte
0260: 67 65 72 20 61 72 67 75 6d 65 6e 74 73 20 74 6f  ger arguments to
0270: 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 62 65   the function be
0280: 69 6e 67 20 63 61 6c 6c 65 64 2e 20 2a 2f 0a 0a  ing called. */..
0290: 09 2e 67 6c 6f 62 6c 20 74 72 61 6d 70 5f 72 0a  ..globl tramp_r.
02a0: 09 2e 67 6c 6f 62 6c 20 2e 74 72 61 6d 70 5f 72  ..globl .tramp_r
02b0: 0a 2e 63 73 65 63 74 20 74 72 61 6d 70 5f 72 5b  ..csect tramp_r[
02c0: 44 53 5d 0a 74 72 61 6d 70 5f 72 3a 0a 09 2e 6c  DS].tramp_r:...l
02d0: 6f 6e 67 20 2e 74 72 61 6d 70 5f 72 2c 20 30 2c  ong .tramp_r, 0,
02e0: 20 30 0a 2e 63 73 65 63 74 20 2e 74 65 78 74 5b   0..csect .text[
02f0: 50 52 5d 0a 2e 74 72 61 6d 70 5f 72 3a 0a 2f 2a  PR]..tramp_r:./*
0300: 20 4d 6f 76 65 20 3c 64 61 74 61 3e 20 69 6e 74   Move <data> int
0310: 6f 20 72 65 67 69 73 74 65 72 20 72 31 31 20 2a  o register r11 *
0320: 2f 0a 09 6c 77 7a 20 31 31 2c 30 28 32 29 09 2f  /..lwz 11,0(2)./
0330: 2a 20 67 65 74 20 3c 64 61 74 61 3e 20 2a 2f 0a  * get <data> */.
0340: 2f 2a 20 47 65 74 20 3c 66 75 6e 63 74 69 6f 6e  /* Get <function
0350: 3e 20 2a 2f 0a 09 6c 77 7a 20 31 32 2c 34 28 32  > */..lwz 12,4(2
0360: 29 0a 2f 2a 0a 20 2a 20 67 63 63 2d 32 2e 36 2e  )./*. * gcc-2.6.
0370: 33 20 73 6f 75 72 63 65 20 73 61 79 73 3a 0a 20  3 source says:. 
0380: 2a 20 41 20 66 75 6e 63 74 69 6f 6e 20 70 6f 69  * A function poi
0390: 6e 74 65 72 20 69 73 20 61 20 70 6f 69 6e 74 65  nter is a pointe
03a0: 72 20 74 6f 20 61 20 64 61 74 61 20 61 72 65 61  r to a data area
03b0: 20 77 68 6f 73 65 20 66 69 72 73 74 20 77 6f 72   whose first wor
03c0: 64 20 63 6f 6e 74 61 69 6e 73 0a 20 2a 20 74 68  d contains. * th
03d0: 65 20 61 63 74 75 61 6c 20 61 64 64 72 65 73 73  e actual address
03e0: 20 6f 66 20 74 68 65 20 66 75 6e 63 74 69 6f 6e   of the function
03f0: 2c 20 77 68 6f 73 65 20 73 65 63 6f 6e 64 20 77  , whose second w
0400: 6f 72 64 20 63 6f 6e 74 61 69 6e 73 20 61 20 70  ord contains a p
0410: 6f 69 6e 74 65 72 0a 20 2a 20 74 6f 20 69 74 73  ointer. * to its
0420: 20 54 4f 43 2c 20 61 6e 64 20 77 68 6f 73 65 20   TOC, and whose 
0430: 74 68 69 72 64 20 77 6f 72 64 20 63 6f 6e 74 61  third word conta
0440: 69 6e 73 20 61 20 76 61 6c 75 65 20 74 6f 20 70  ins a value to p
0450: 6c 61 63 65 20 69 6e 20 74 68 65 20 73 74 61 74  lace in the stat
0460: 69 63 0a 20 2a 20 63 68 61 69 6e 20 72 65 67 69  ic. * chain regi
0470: 73 74 65 72 20 28 72 31 31 29 2e 20 42 75 74 20  ster (r11). But 
0480: 77 65 20 68 61 76 65 20 61 6c 72 65 61 64 79 20  we have already 
0490: 70 6c 61 63 65 64 20 6f 75 72 20 69 6e 66 6f 72  placed our infor
04a0: 6d 61 74 69 6f 6e 20 69 6e 20 72 31 31 2e 0a 20  mation in r11.. 
04b0: 2a 2f 0a 2f 2a 09 6c 77 7a 20 31 31 2c 38 28 31  */./*.lwz 11,8(1
04c0: 32 29 09 20 20 20 70 61 73 73 20 73 74 61 74 69  2).   pass stati
04d0: 63 20 63 68 61 69 6e 20 69 6e 20 72 31 31 20 2a  c chain in r11 *
04e0: 2f 0a 09 6c 77 7a 20 32 2c 34 28 31 32 29 09 2f  /..lwz 2,4(12)./
04f0: 2a 20 70 61 73 73 20 54 4f 43 20 69 6e 20 72 32  * pass TOC in r2
0500: 20 2a 2f 0a 09 6c 77 7a 20 30 2c 30 28 31 32 29   */..lwz 0,0(12)
0510: 09 2f 2a 20 61 63 74 75 61 6c 20 63 6f 64 65 20  ./* actual code 
0520: 61 64 64 72 65 73 73 20 2a 2f 0a 09 6d 74 63 74  address */..mtct
0530: 72 20 30 0a 09 62 63 74 72 0a 0a 5f 73 65 63 74  r 0..bctr.._sect
0540: 69 6f 6e 5f 2e 74 65 78 74 3a 0a 2e 63 73 65 63  ion_.text:..csec
0550: 74 20 2e 64 61 74 61 5b 52 57 5d 0a 09 2e 6c 6f  t .data[RW]...lo
0560: 6e 67 20 5f 73 65 63 74 69 6f 6e 5f 2e 74 65 78  ng _section_.tex
0570: 74 0a                                            t.