Artifact bb3c75ac98993cb7a4d1af1052851823e1ba62de:


0000: 2f 2a 20 54 72 61 6d 70 6f 6c 69 6e 65 20 66 6f  /* Trampoline fo
0010: 72 20 72 73 36 30 30 30 20 43 50 55 20 77 69 74  r rs6000 CPU wit
0020: 68 20 41 49 58 20 63 61 6c 6c 69 6e 67 20 63 6f  h AIX calling co
0030: 6e 76 65 6e 74 69 6f 6e 20 2a 2f 0a 0a 2f 2a 0a  nvention */../*.
0040: 20 2a 20 43 6f 70 79 72 69 67 68 74 20 31 39 39   * Copyright 199
0050: 35 2d 31 39 39 39 20 42 72 75 6e 6f 20 48 61 69  5-1999 Bruno Hai
0060: 62 6c 65 2c 20 3c 62 72 75 6e 6f 40 63 6c 69 73  ble, <bruno@clis
0070: 70 2e 6f 72 67 3e 0a 20 2a 0a 20 2a 20 54 68 69  p.org>. *. * Thi
0080: 73 20 69 73 20 66 72 65 65 20 73 6f 66 74 77 61  s is free softwa
0090: 72 65 20 64 69 73 74 72 69 62 75 74 65 64 20 75  re distributed u
00a0: 6e 64 65 72 20 74 68 65 20 47 4e 55 20 47 65 6e  nder the GNU Gen
00b0: 65 72 61 6c 20 50 75 62 6c 69 63 20 4c 69 63 65  eral Public Lice
00c0: 6e 63 65 0a 20 2a 20 64 65 73 63 72 69 62 65 64  nce. * described
00d0: 20 69 6e 20 74 68 65 20 66 69 6c 65 20 43 4f 50   in the file COP
00e0: 59 49 4e 47 2e 20 43 6f 6e 74 61 63 74 20 74 68  YING. Contact th
00f0: 65 20 61 75 74 68 6f 72 20 69 66 20 79 6f 75 20  e author if you 
0100: 64 6f 6e 27 74 20 68 61 76 65 20 74 68 69 73 0a  don't have this.
0110: 20 2a 20 6f 72 20 63 61 6e 27 74 20 6c 69 76 65   * or can't live
0120: 20 77 69 74 68 20 69 74 2e 20 54 68 65 72 65 20   with it. There 
0130: 69 73 20 41 42 53 4f 4c 55 54 45 4c 59 20 4e 4f  is ABSOLUTELY NO
0140: 20 57 41 52 52 41 4e 54 59 2c 20 65 78 70 6c 69   WARRANTY, expli
0150: 63 69 74 20 6f 72 20 69 6d 70 6c 69 65 64 2c 0a  cit or implied,.
0160: 20 2a 20 6f 6e 20 74 68 69 73 20 73 6f 66 74 77   * on this softw
0170: 61 72 65 2e 0a 20 2a 2f 0a 0a 2f 2a 20 41 76 61  are.. */../* Ava
0180: 69 6c 61 62 6c 65 20 72 65 67 69 73 74 65 72 73  ilable registers
0190: 3a 20 72 30 2c 20 72 31 32 2c 20 72 31 31 2c 20  : r0, r12, r11, 
01a0: 72 31 30 2c 20 72 39 2c 20 72 38 2c 20 72 37 2c  r10, r9, r8, r7,
01b0: 20 72 36 2c 20 72 35 2c 20 72 34 2c 20 72 33 2e   r6, r5, r4, r3.
01c0: 20 2a 2f 0a 2f 2a 20 48 6f 77 65 76 65 72 2c 20   */./* However, 
01d0: 72 30 20 69 73 20 73 70 65 63 69 61 6c 20 69 6e  r0 is special in
01e0: 20 74 68 61 74 20 69 74 20 63 61 6e 6e 6f 74 20   that it cannot 
01f0: 62 65 20 75 73 65 64 20 61 73 20 61 20 62 61 73  be used as a bas
0200: 65 20 72 65 67 69 73 74 65 72 2e 20 2a 2f 0a 2f  e register. */./
0210: 2a 20 41 6e 64 20 72 33 2e 2e 2e 72 31 30 20 73  * And r3...r10 s
0220: 68 6f 75 6c 64 20 6e 6f 74 20 62 65 20 63 6c 6f  hould not be clo
0230: 62 62 65 72 65 64 20 62 65 63 61 75 73 65 20 74  bbered because t
0240: 68 65 79 20 63 6f 6e 74 61 69 6e 20 74 68 65 20  hey contain the 
0250: 66 69 72 73 74 20 38 0a 20 2a 20 69 6e 74 65 67  first 8. * integ
0260: 65 72 20 61 72 67 75 6d 65 6e 74 73 20 74 6f 20  er arguments to 
0270: 74 68 65 20 66 75 6e 63 74 69 6f 6e 20 62 65 69  the function bei
0280: 6e 67 20 63 61 6c 6c 65 64 2e 20 2a 2f 0a 0a 09  ng called. */...
0290: 2e 67 6c 6f 62 6c 20 74 72 61 6d 70 5f 72 0a 09  .globl tramp_r..
02a0: 2e 67 6c 6f 62 6c 20 2e 74 72 61 6d 70 5f 72 0a  .globl .tramp_r.
02b0: 2e 63 73 65 63 74 20 74 72 61 6d 70 5f 72 5b 44  .csect tramp_r[D
02c0: 53 5d 0a 74 72 61 6d 70 5f 72 3a 0a 09 2e 6c 6f  S].tramp_r:...lo
02d0: 6e 67 20 2e 74 72 61 6d 70 5f 72 2c 20 30 2c 20  ng .tramp_r, 0, 
02e0: 30 0a 2e 63 73 65 63 74 20 2e 74 65 78 74 5b 50  0..csect .text[P
02f0: 52 5d 0a 2e 74 72 61 6d 70 5f 72 3a 0a 2f 2a 20  R]..tramp_r:./* 
0300: 4d 6f 76 65 20 3c 64 61 74 61 3e 20 69 6e 74 6f  Move <data> into
0310: 20 72 65 67 69 73 74 65 72 20 72 31 31 20 2a 2f   register r11 */
0320: 0a 09 6c 77 7a 20 31 31 2c 30 28 32 29 09 2f 2a  ..lwz 11,0(2)./*
0330: 20 67 65 74 20 3c 64 61 74 61 3e 20 2a 2f 0a 2f   get <data> */./
0340: 2a 20 47 65 74 20 3c 66 75 6e 63 74 69 6f 6e 3e  * Get <function>
0350: 20 2a 2f 0a 09 6c 77 7a 20 31 32 2c 34 28 32 29   */..lwz 12,4(2)
0360: 0a 2f 2a 0a 20 2a 20 67 63 63 2d 32 2e 36 2e 33  ./*. * gcc-2.6.3
0370: 20 73 6f 75 72 63 65 20 73 61 79 73 3a 0a 20 2a   source says:. *
0380: 20 41 20 66 75 6e 63 74 69 6f 6e 20 70 6f 69 6e   A function poin
0390: 74 65 72 20 69 73 20 61 20 70 6f 69 6e 74 65 72  ter is a pointer
03a0: 20 74 6f 20 61 20 64 61 74 61 20 61 72 65 61 20   to a data area 
03b0: 77 68 6f 73 65 20 66 69 72 73 74 20 77 6f 72 64  whose first word
03c0: 20 63 6f 6e 74 61 69 6e 73 0a 20 2a 20 74 68 65   contains. * the
03d0: 20 61 63 74 75 61 6c 20 61 64 64 72 65 73 73 20   actual address 
03e0: 6f 66 20 74 68 65 20 66 75 6e 63 74 69 6f 6e 2c  of the function,
03f0: 20 77 68 6f 73 65 20 73 65 63 6f 6e 64 20 77 6f   whose second wo
0400: 72 64 20 63 6f 6e 74 61 69 6e 73 20 61 20 70 6f  rd contains a po
0410: 69 6e 74 65 72 0a 20 2a 20 74 6f 20 69 74 73 20  inter. * to its 
0420: 54 4f 43 2c 20 61 6e 64 20 77 68 6f 73 65 20 74  TOC, and whose t
0430: 68 69 72 64 20 77 6f 72 64 20 63 6f 6e 74 61 69  hird word contai
0440: 6e 73 20 61 20 76 61 6c 75 65 20 74 6f 20 70 6c  ns a value to pl
0450: 61 63 65 20 69 6e 20 74 68 65 20 73 74 61 74 69  ace in the stati
0460: 63 0a 20 2a 20 63 68 61 69 6e 20 72 65 67 69 73  c. * chain regis
0470: 74 65 72 20 28 72 31 31 29 2e 20 42 75 74 20 77  ter (r11). But w
0480: 65 20 68 61 76 65 20 61 6c 72 65 61 64 79 20 70  e have already p
0490: 6c 61 63 65 64 20 6f 75 72 20 69 6e 66 6f 72 6d  laced our inform
04a0: 61 74 69 6f 6e 20 69 6e 20 72 31 31 2e 0a 20 2a  ation in r11.. *
04b0: 2f 0a 2f 2a 09 6c 77 7a 20 31 31 2c 38 28 31 32  /./*.lwz 11,8(12
04c0: 29 09 20 20 20 70 61 73 73 20 73 74 61 74 69 63  ).   pass static
04d0: 20 63 68 61 69 6e 20 69 6e 20 72 31 31 20 2a 2f   chain in r11 */
04e0: 0a 09 6c 77 7a 20 32 2c 34 28 31 32 29 09 2f 2a  ..lwz 2,4(12)./*
04f0: 20 70 61 73 73 20 54 4f 43 20 69 6e 20 72 32 20   pass TOC in r2 
0500: 2a 2f 0a 09 6c 77 7a 20 30 2c 30 28 31 32 29 09  */..lwz 0,0(12).
0510: 2f 2a 20 61 63 74 75 61 6c 20 63 6f 64 65 20 61  /* actual code a
0520: 64 64 72 65 73 73 20 2a 2f 0a 09 6d 74 63 74 72  ddress */..mtctr
0530: 20 30 0a 09 62 63 74 72 0a 0a 5f 73 65 63 74 69   0..bctr.._secti
0540: 6f 6e 5f 2e 74 65 78 74 3a 0a 2e 63 73 65 63 74  on_.text:..csect
0550: 20 2e 64 61 74 61 5b 52 57 5d 0a 09 2e 6c 6f 6e   .data[RW]...lon
0560: 67 20 5f 73 65 63 74 69 6f 6e 5f 2e 74 65 78 74  g _section_.text
0570: 0a                                               .