Artifact 1bb94b37a33abc959fe05c5fd0e45f641f8cb1e6:


0000: 23 69 66 6e 64 65 66 20 5f 61 76 63 61 6c 6c 5f  #ifndef _avcall_
0010: 61 72 6d 5f 63 09 09 09 09 2f 2a 2d 2a 2d 20 43  arm_c..../*-*- C
0020: 20 2d 2a 2d 2a 2f 0a 23 64 65 66 69 6e 65 20 5f   -*-*/.#define _
0030: 61 76 63 61 6c 6c 5f 61 72 6d 5f 63 0a 2f 2a 2a  avcall_arm_c./**
0040: 0a 20 20 43 6f 70 79 72 69 67 68 74 20 31 39 39  .  Copyright 199
0050: 33 20 42 69 6c 6c 20 54 72 69 67 67 73 2c 20 3c  3 Bill Triggs, <
0060: 42 69 6c 6c 2e 54 72 69 67 67 73 40 69 6e 72 69  Bill.Triggs@inri
0070: 61 6c 70 65 73 2e 66 72 3e 0a 20 20 43 6f 70 79  alpes.fr>.  Copy
0080: 72 69 67 68 74 20 31 39 39 35 2d 31 39 39 39 20  right 1995-1999 
0090: 42 72 75 6e 6f 20 48 61 69 62 6c 65 2c 20 3c 62  Bruno Haible, <b
00a0: 72 75 6e 6f 40 63 6c 69 73 70 2e 6f 72 67 3e 0a  runo@clisp.org>.
00b0: 0a 20 20 54 68 69 73 20 69 73 20 66 72 65 65 20  .  This is free 
00c0: 73 6f 66 74 77 61 72 65 20 64 69 73 74 72 69 62  software distrib
00d0: 75 74 65 64 20 75 6e 64 65 72 20 74 68 65 20 47  uted under the G
00e0: 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69  NU General Publi
00f0: 63 0a 20 20 4c 69 63 65 6e 63 65 20 64 65 73 63  c.  Licence desc
0100: 72 69 62 65 64 20 69 6e 20 74 68 65 20 66 69 6c  ribed in the fil
0110: 65 20 43 4f 50 59 49 4e 47 2e 20 43 6f 6e 74 61  e COPYING. Conta
0120: 63 74 20 74 68 65 20 61 75 74 68 6f 72 20 69 66  ct the author if
0130: 0a 20 20 79 6f 75 20 64 6f 6e 27 74 20 68 61 76  .  you don't hav
0140: 65 20 74 68 69 73 20 6f 72 20 63 61 6e 27 74 20  e this or can't 
0150: 6c 69 76 65 20 77 69 74 68 20 69 74 2e 20 54 68  live with it. Th
0160: 65 72 65 20 69 73 20 41 42 53 4f 4c 55 54 45 4c  ere is ABSOLUTEL
0170: 59 0a 20 20 4e 4f 20 57 41 52 52 41 4e 54 59 2c  Y.  NO WARRANTY,
0180: 20 65 78 70 6c 69 63 69 74 20 6f 72 20 69 6d 70   explicit or imp
0190: 6c 69 65 64 2c 20 6f 6e 20 74 68 69 73 20 73 6f  lied, on this so
01a0: 66 74 77 61 72 65 2e 0a 2a 2a 2f 0a 2f 2a 2d 2d  ftware..**/./*--
01b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
01c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
01d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
01e0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
01f0: 2d 2d 2d 2d 0a 20 20 21 21 21 20 54 48 49 53 20  ----.  !!! THIS 
0200: 52 4f 55 54 49 4e 45 20 4d 55 53 54 20 42 45 20  ROUTINE MUST BE 
0210: 43 4f 4d 50 49 4c 45 44 20 67 63 63 20 2d 4f 20  COMPILED gcc -O 
0220: 21 21 21 0a 0a 20 20 46 6f 72 65 69 67 6e 20 66  !!!..  Foreign f
0230: 75 6e 63 74 69 6f 6e 20 69 6e 74 65 72 66 61 63  unction interfac
0240: 65 20 66 6f 72 20 61 6e 20 41 63 6f 72 6e 20 52  e for an Acorn R
0250: 69 73 63 20 4d 61 73 63 68 69 6e 65 20 77 69 74  isc Maschine wit
0260: 68 20 67 63 63 2e 0a 0a 20 20 54 68 69 73 20 63  h gcc...  This c
0270: 61 6c 6c 73 20 61 20 43 20 66 75 6e 63 74 69 6f  alls a C functio
0280: 6e 20 77 69 74 68 20 61 6e 20 61 72 67 75 6d 65  n with an argume
0290: 6e 74 20 6c 69 73 74 20 62 75 69 6c 74 20 75 70  nt list built up
02a0: 20 75 73 69 6e 67 20 6d 61 63 72 6f 73 0a 20 20   using macros.  
02b0: 64 65 66 69 6e 65 64 20 69 6e 20 61 76 5f 63 61  defined in av_ca
02c0: 6c 6c 2e 68 2e 0a 0a 20 20 41 52 4d 20 41 72 67  ll.h...  ARM Arg
02d0: 75 6d 65 6e 74 20 50 61 73 73 69 6e 67 20 43 6f  ument Passing Co
02e0: 6e 76 65 6e 74 69 6f 6e 73 3a 0a 0a 20 20 41 6c  nventions:..  Al
02f0: 6c 20 61 72 67 75 6d 65 6e 74 73 2c 20 65 78 63  l arguments, exc
0300: 65 70 74 20 74 68 65 20 66 69 72 73 74 20 34 20  ept the first 4 
0310: 77 6f 72 64 73 2c 20 61 72 65 20 70 61 73 73 65  words, are passe
0320: 64 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 20 77  d on the stack w
0330: 69 74 68 0a 20 20 77 6f 72 64 20 61 6c 69 67 6e  ith.  word align
0340: 6d 65 6e 74 2e 20 44 6f 75 62 6c 65 73 20 74 61  ment. Doubles ta
0350: 6b 65 20 74 77 6f 20 77 6f 72 64 73 2e 20 53 74  ke two words. St
0360: 72 75 63 74 75 72 65 20 61 72 67 73 20 61 72 65  ructure args are
0370: 20 70 61 73 73 65 64 20 61 73 0a 20 20 74 72 75   passed as.  tru
0380: 65 20 73 74 72 75 63 74 75 72 65 73 20 65 6d 62  e structures emb
0390: 65 64 64 65 64 20 69 6e 20 74 68 65 20 61 72 67  edded in the arg
03a0: 75 6d 65 6e 74 20 73 74 61 63 6b 2e 20 54 6f 20  ument stack. To 
03b0: 72 65 74 75 72 6e 20 61 20 73 74 72 75 63 74 75  return a structu
03c0: 72 65 2c 0a 20 20 74 68 65 20 63 61 6c 6c 65 64  re,.  the called
03d0: 20 66 75 6e 63 74 69 6f 6e 20 63 6f 70 69 65 73   function copies
03e0: 20 74 68 65 20 72 65 74 75 72 6e 20 76 61 6c 75   the return valu
03f0: 65 20 74 6f 20 74 68 65 20 61 64 64 72 65 73 73  e to the address
0400: 20 73 75 70 70 6c 69 65 64 0a 20 20 69 6e 20 72   supplied.  in r
0410: 65 67 69 73 74 65 72 20 22 25 72 30 22 2e 0a 0a  egister "%r0"...
0420: 20 20 43 6f 6d 70 69 6c 65 20 74 68 69 73 20 72    Compile this r
0430: 6f 75 74 69 6e 65 20 77 69 74 68 20 67 63 63 20  outine with gcc 
0440: 2d 4f 20 28 6f 72 20 2d 4f 32 20 6f 72 20 2d 67  -O (or -O2 or -g
0450: 20 2d 4f 29 20 74 6f 20 67 65 74 20 74 68 65 20   -O) to get the 
0460: 72 69 67 68 74 0a 20 20 72 65 67 69 73 74 65 72  right.  register
0470: 20 76 61 72 69 61 62 6c 65 73 2c 20 6f 72 20 75   variables, or u
0480: 73 65 20 74 68 65 20 61 73 73 65 6d 62 6c 65 72  se the assembler
0490: 20 76 65 72 73 69 6f 6e 2e 0a 20 20 2d 2d 2d 2d   version..  ----
04a0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
04b0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
04c0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
04d0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d  ----------------
04e0: 2d 2d 2a 2f 0a 23 69 6e 63 6c 75 64 65 20 22 61  --*/.#include "a
04f0: 76 63 61 6c 6c 2e 68 2e 69 6e 22 0a 0a 23 64 65  vcall.h.in"..#de
0500: 66 69 6e 65 20 52 45 54 55 52 4e 28 54 59 50 45  fine RETURN(TYPE
0510: 2c 56 41 4c 29 09 28 2a 28 54 59 50 45 2a 29 6c  ,VAL).(*(TYPE*)l
0520: 2d 3e 72 61 64 64 72 20 3d 20 28 54 59 50 45 29  ->raddr = (TYPE)
0530: 28 56 41 4c 29 29 0a 0a 69 6e 74 0a 5f 5f 62 75  (VAL))..int.__bu
0540: 69 6c 74 69 6e 5f 61 76 63 61 6c 6c 28 61 76 5f  iltin_avcall(av_
0550: 61 6c 69 73 74 2a 20 6c 29 0a 7b 0a 20 20 72 65  alist* l).{.  re
0560: 67 69 73 74 65 72 20 5f 5f 61 76 77 6f 72 64 2a  gister __avword*
0570: 09 73 70 09 5f 5f 61 73 6d 5f 5f 28 22 72 31 33  .sp.__asm__("r13
0580: 22 29 3b 20 20 2f 2a 20 43 20 6e 61 6d 65 73 20  ");  /* C names 
0590: 66 6f 72 20 72 65 67 69 73 74 65 72 73 20 2a 2f  for registers */
05a0: 0a 2f 2a 72 65 67 69 73 74 65 72 20 5f 5f 61 76  ./*register __av
05b0: 77 6f 72 64 09 69 72 65 74 09 5f 5f 61 73 6d 5f  word.iret.__asm_
05c0: 5f 28 22 72 30 22 29 3b 20 2a 2f 0a 20 20 72 65  _("r0"); */.  re
05d0: 67 69 73 74 65 72 20 5f 5f 61 76 77 6f 72 64 09  gister __avword.
05e0: 69 72 65 74 32 09 5f 5f 61 73 6d 5f 5f 28 22 72  iret2.__asm__("r
05f0: 31 22 29 3b 0a 20 20 72 65 67 69 73 74 65 72 20  1");.  register 
0600: 66 6c 6f 61 74 09 66 72 65 74 09 5f 5f 61 73 6d  float.fret.__asm
0610: 5f 5f 28 22 72 30 22 29 3b 09 2f 2a 20 72 30 20  __("r0");./* r0 
0620: 2a 2f 0a 20 20 72 65 67 69 73 74 65 72 20 64 6f  */.  register do
0630: 75 62 6c 65 09 64 72 65 74 09 5f 5f 61 73 6d 5f  uble.dret.__asm_
0640: 5f 28 22 72 30 22 29 3b 09 2f 2a 20 72 30 2c 72  _("r0");./* r0,r
0650: 31 20 2a 2f 0a 0a 20 20 5f 5f 61 76 77 6f 72 64  1 */..  __avword
0660: 20 73 70 61 63 65 5b 5f 5f 41 56 5f 41 4c 49 53   space[__AV_ALIS
0670: 54 5f 57 4f 52 44 53 5d 3b 09 2f 2a 20 73 70 61  T_WORDS];./* spa
0680: 63 65 20 66 6f 72 20 63 61 6c 6c 65 65 27 73 20  ce for callee's 
0690: 73 74 61 63 6b 20 66 72 61 6d 65 20 2a 2f 0a 20  stack frame */. 
06a0: 20 5f 5f 61 76 77 6f 72 64 2a 20 61 72 67 66 72   __avword* argfr
06b0: 61 6d 65 20 3d 20 73 70 3b 09 09 2f 2a 20 73 74  ame = sp;../* st
06c0: 61 63 6b 20 6f 66 66 73 65 74 20 66 6f 72 20 61  ack offset for a
06d0: 72 67 75 6d 65 6e 74 20 6c 69 73 74 20 2a 2f 0a  rgument list */.
06e0: 20 20 69 6e 74 20 61 72 67 6c 65 6e 20 3d 20 6c    int arglen = l
06f0: 2d 3e 61 70 74 72 20 2d 20 6c 2d 3e 61 72 67 73  ->aptr - l->args
0700: 3b 0a 20 20 5f 5f 61 76 77 6f 72 64 20 69 3b 0a  ;.  __avword i;.
0710: 0a 20 20 66 6f 72 20 28 69 20 3d 20 34 3b 20 69  .  for (i = 4; i
0720: 20 3c 20 61 72 67 6c 65 6e 3b 20 69 2b 2b 29 09   < arglen; i++).
0730: 09 2f 2a 20 70 75 73 68 20 66 75 6e 63 74 69 6f  ./* push functio
0740: 6e 20 61 72 67 73 20 6f 6e 74 6f 20 73 74 61 63  n args onto stac
0750: 6b 20 2a 2f 0a 20 20 20 20 61 72 67 66 72 61 6d  k */.    argfram
0760: 65 5b 69 2d 34 5d 20 3d 20 6c 2d 3e 61 72 67 73  e[i-4] = l->args
0770: 5b 69 5d 3b 0a 0a 09 09 09 09 2f 2a 20 63 61 6c  [i];....../* cal
0780: 6c 20 66 75 6e 63 74 69 6f 6e 2c 20 70 61 73 73  l function, pass
0790: 20 34 20 61 72 67 73 20 69 6e 20 72 65 67 69 73   4 args in regis
07a0: 74 65 72 73 20 2a 2f 0a 20 20 69 20 3d 20 28 2a  ters */.  i = (*
07b0: 6c 2d 3e 66 75 6e 63 29 28 6c 2d 3e 61 72 67 73  l->func)(l->args
07c0: 5b 30 5d 2c 20 6c 2d 3e 61 72 67 73 5b 31 5d 2c  [0], l->args[1],
07d0: 20 6c 2d 3e 61 72 67 73 5b 32 5d 2c 20 6c 2d 3e   l->args[2], l->
07e0: 61 72 67 73 5b 33 5d 29 3b 0a 0a 20 20 2f 2a 20  args[3]);..  /* 
07f0: 73 61 76 65 20 72 65 74 75 72 6e 20 76 61 6c 75  save return valu
0800: 65 20 2a 2f 0a 20 20 69 66 20 28 6c 2d 3e 72 74  e */.  if (l->rt
0810: 79 70 65 20 3d 3d 20 5f 5f 41 56 76 6f 69 64 29  ype == __AVvoid)
0820: 20 7b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66   {.  } else.  if
0830: 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f   (l->rtype == __
0840: 41 56 77 6f 72 64 29 20 7b 0a 20 20 20 20 52 45  AVword) {.    RE
0850: 54 55 52 4e 28 5f 5f 61 76 77 6f 72 64 2c 20 69  TURN(__avword, i
0860: 29 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66  );.  } else.  if
0870: 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f   (l->rtype == __
0880: 41 56 63 68 61 72 29 20 7b 0a 20 20 20 20 52 45  AVchar) {.    RE
0890: 54 55 52 4e 28 63 68 61 72 2c 20 69 29 3b 0a 20  TURN(char, i);. 
08a0: 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 2d   } else.  if (l-
08b0: 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 73 63  >rtype == __AVsc
08c0: 68 61 72 29 20 7b 0a 20 20 20 20 52 45 54 55 52  har) {.    RETUR
08d0: 4e 28 73 69 67 6e 65 64 20 63 68 61 72 2c 20 69  N(signed char, i
08e0: 29 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66  );.  } else.  if
08f0: 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f   (l->rtype == __
0900: 41 56 75 63 68 61 72 29 20 7b 0a 20 20 20 20 52  AVuchar) {.    R
0910: 45 54 55 52 4e 28 75 6e 73 69 67 6e 65 64 20 63  ETURN(unsigned c
0920: 68 61 72 2c 20 69 29 3b 0a 20 20 7d 20 65 6c 73  har, i);.  } els
0930: 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 70 65  e.  if (l->rtype
0940: 20 3d 3d 20 5f 5f 41 56 73 68 6f 72 74 29 20 7b   == __AVshort) {
0950: 0a 20 20 20 20 52 45 54 55 52 4e 28 73 68 6f 72  .    RETURN(shor
0960: 74 2c 20 69 29 3b 0a 20 20 7d 20 65 6c 73 65 0a  t, i);.  } else.
0970: 20 20 69 66 20 28 6c 2d 3e 72 74 79 70 65 20 3d    if (l->rtype =
0980: 3d 20 5f 5f 41 56 75 73 68 6f 72 74 29 20 7b 0a  = __AVushort) {.
0990: 20 20 20 20 52 45 54 55 52 4e 28 75 6e 73 69 67      RETURN(unsig
09a0: 6e 65 64 20 73 68 6f 72 74 2c 20 69 29 3b 0a 20  ned short, i);. 
09b0: 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 2d   } else.  if (l-
09c0: 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 69 6e  >rtype == __AVin
09d0: 74 29 20 7b 0a 20 20 20 20 52 45 54 55 52 4e 28  t) {.    RETURN(
09e0: 69 6e 74 2c 20 69 29 3b 0a 20 20 7d 20 65 6c 73  int, i);.  } els
09f0: 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 70 65  e.  if (l->rtype
0a00: 20 3d 3d 20 5f 5f 41 56 75 69 6e 74 29 20 7b 0a   == __AVuint) {.
0a10: 20 20 20 20 52 45 54 55 52 4e 28 75 6e 73 69 67      RETURN(unsig
0a20: 6e 65 64 20 69 6e 74 2c 20 69 29 3b 0a 20 20 7d  ned int, i);.  }
0a30: 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 2d 3e 72   else.  if (l->r
0a40: 74 79 70 65 20 3d 3d 20 5f 5f 41 56 6c 6f 6e 67  type == __AVlong
0a50: 29 20 7b 0a 20 20 20 20 52 45 54 55 52 4e 28 6c  ) {.    RETURN(l
0a60: 6f 6e 67 2c 20 69 29 3b 0a 20 20 7d 20 65 6c 73  ong, i);.  } els
0a70: 65 0a 20 20 69 66 20 28 6c 2d 3e 72 74 79 70 65  e.  if (l->rtype
0a80: 20 3d 3d 20 5f 5f 41 56 75 6c 6f 6e 67 29 20 7b   == __AVulong) {
0a90: 0a 20 20 20 20 52 45 54 55 52 4e 28 75 6e 73 69  .    RETURN(unsi
0aa0: 67 6e 65 64 20 6c 6f 6e 67 2c 20 69 29 3b 0a 20  gned long, i);. 
0ab0: 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 2d   } else.  if (l-
0ac0: 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 6c 6f  >rtype == __AVlo
0ad0: 6e 67 6c 6f 6e 67 20 7c 7c 20 6c 2d 3e 72 74 79  nglong || l->rty
0ae0: 70 65 20 3d 3d 20 5f 5f 41 56 75 6c 6f 6e 67 6c  pe == __AVulongl
0af0: 6f 6e 67 29 20 7b 0a 20 20 20 20 28 28 5f 5f 61  ong) {.    ((__a
0b00: 76 77 6f 72 64 2a 29 6c 2d 3e 72 61 64 64 72 29  vword*)l->raddr)
0b10: 5b 30 5d 20 3d 20 69 3b 0a 20 20 20 20 28 28 5f  [0] = i;.    ((_
0b20: 5f 61 76 77 6f 72 64 2a 29 6c 2d 3e 72 61 64 64  _avword*)l->radd
0b30: 72 29 5b 31 5d 20 3d 20 69 72 65 74 32 3b 0a 20  r)[1] = iret2;. 
0b40: 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c 2d   } else.  if (l-
0b50: 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 66 6c  >rtype == __AVfl
0b60: 6f 61 74 29 20 7b 0a 20 20 20 20 52 45 54 55 52  oat) {.    RETUR
0b70: 4e 28 66 6c 6f 61 74 2c 20 66 72 65 74 29 3b 0a  N(float, fret);.
0b80: 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28 6c    } else.  if (l
0b90: 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56 64  ->rtype == __AVd
0ba0: 6f 75 62 6c 65 29 20 7b 0a 20 20 20 20 52 45 54  ouble) {.    RET
0bb0: 55 52 4e 28 64 6f 75 62 6c 65 2c 20 64 72 65 74  URN(double, dret
0bc0: 29 3b 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66  );.  } else.  if
0bd0: 20 28 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f   (l->rtype == __
0be0: 41 56 76 6f 69 64 70 29 20 7b 0a 20 20 20 20 52  AVvoidp) {.    R
0bf0: 45 54 55 52 4e 28 76 6f 69 64 2a 2c 20 69 29 3b  ETURN(void*, i);
0c00: 0a 20 20 7d 20 65 6c 73 65 0a 20 20 69 66 20 28  .  } else.  if (
0c10: 6c 2d 3e 72 74 79 70 65 20 3d 3d 20 5f 5f 41 56  l->rtype == __AV
0c20: 73 74 72 75 63 74 29 20 7b 0a 20 20 20 20 2f 2a  struct) {.    /*
0c30: 20 50 43 53 20 66 6f 72 20 41 52 4d 20 28 68 74   PCS for ARM (ht
0c40: 74 70 3a 2f 2f 69 6e 66 6f 63 65 6e 74 65 72 2e  tp://infocenter.
0c50: 61 72 6d 2e 63 6f 6d 2f 68 65 6c 70 2f 74 6f 70  arm.com/help/top
0c60: 69 63 2f 63 6f 6d 2e 61 72 6d 2e 64 6f 63 2e 69  ic/com.arm.doc.i
0c70: 68 69 30 30 34 32 62 2f 49 48 49 30 30 34 32 42  hi0042b/IHI0042B
0c80: 5f 61 61 70 63 73 2e 70 64 66 29 3a 0a 20 20 20  _aapcs.pdf):.   
0c90: 20 20 20 20 70 61 67 65 20 31 39 3a 20 22 41 20      page 19: "A 
0ca0: 43 6f 6d 70 6f 73 69 74 65 20 54 79 70 65 20 6e  Composite Type n
0cb0: 6f 74 20 6c 61 72 67 65 72 20 74 68 61 6e 20 34  ot larger than 4
0cc0: 20 62 79 74 65 73 20 69 73 20 72 65 74 75 72 6e   bytes is return
0cd0: 65 64 20 69 6e 20 72 30 2e 22 0a 20 20 20 20 20  ed in r0.".     
0ce0: 20 20 73 69 7a 65 6f 66 28 7b 63 68 61 72 20 61    sizeof({char a
0cf0: 5b 33 5d 3b 7d 29 20 3d 20 33 2c 20 73 6f 20 77  [3];}) = 3, so w
0d00: 65 20 68 61 76 65 20 74 6f 20 75 73 65 20 3c 3d  e have to use <=
0d10: 20 73 69 7a 65 6f 66 20 62 65 6c 6f 77 20 2a 2f   sizeof below */
0d20: 0a 20 20 20 20 69 66 20 28 6c 2d 3e 66 6c 61 67  .    if (l->flag
0d30: 73 20 26 20 5f 5f 41 56 5f 50 43 43 5f 53 54 52  s & __AV_PCC_STR
0d40: 55 43 54 5f 52 45 54 55 52 4e 29 20 7b 0a 20 20  UCT_RETURN) {.  
0d50: 20 20 20 20 2f 2a 20 70 63 63 20 73 74 72 75 63      /* pcc struc
0d60: 74 20 72 65 74 75 72 6e 20 63 6f 6e 76 65 6e 74  t return convent
0d70: 69 6f 6e 3a 20 6e 65 65 64 20 61 20 20 2a 28 54  ion: need a  *(T
0d80: 59 50 45 2a 29 6c 2d 3e 72 61 64 64 72 20 3d 20  YPE*)l->raddr = 
0d90: 2a 28 54 59 50 45 2a 29 69 3b 20 20 2a 2f 0a 20  *(TYPE*)i;  */. 
0da0: 20 20 20 20 20 69 66 20 28 6c 2d 3e 72 73 69 7a       if (l->rsiz
0db0: 65 20 3d 3d 20 73 69 7a 65 6f 66 28 63 68 61 72  e == sizeof(char
0dc0: 29 29 20 7b 20 2f 2a 20 63 61 6e 27 74 20 6f 63  )) { /* can't oc
0dd0: 63 75 72 20 2a 2f 0a 20 20 20 20 20 20 20 20 52  cur */.        R
0de0: 45 54 55 52 4e 28 63 68 61 72 2c 20 2a 28 63 68  ETURN(char, *(ch
0df0: 61 72 2a 29 69 29 3b 0a 20 20 20 20 20 20 7d 20  ar*)i);.      } 
0e00: 65 6c 73 65 0a 20 20 20 20 20 20 69 66 20 28 6c  else.      if (l
0e10: 2d 3e 72 73 69 7a 65 20 3d 3d 20 73 69 7a 65 6f  ->rsize == sizeo
0e20: 66 28 73 68 6f 72 74 29 29 20 7b 20 2f 2a 20 63  f(short)) { /* c
0e30: 61 6e 27 74 20 6f 63 63 75 72 20 2a 2f 0a 20 20  an't occur */.  
0e40: 20 20 20 20 20 20 52 45 54 55 52 4e 28 73 68 6f        RETURN(sho
0e50: 72 74 2c 20 2a 28 73 68 6f 72 74 2a 29 69 29 3b  rt, *(short*)i);
0e60: 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 0a 20 20  .      } else.  
0e70: 20 20 20 20 69 66 20 28 6c 2d 3e 72 73 69 7a 65      if (l->rsize
0e80: 20 3c 3d 20 73 69 7a 65 6f 66 28 69 6e 74 29 29   <= sizeof(int))
0e90: 20 7b 20 2f 2a 20 73 74 72 75 63 74 73 20 6f 66   { /* structs of
0ea0: 20 73 69 7a 65 20 33 20 61 6c 73 6f 20 72 65 74   size 3 also ret
0eb0: 75 72 6e 65 64 20 69 6e 20 72 65 67 69 73 74 65  urned in registe
0ec0: 72 73 20 2a 2f 0a 20 20 20 20 20 20 20 20 52 45  rs */.        RE
0ed0: 54 55 52 4e 28 69 6e 74 2c 20 2a 28 69 6e 74 2a  TURN(int, *(int*
0ee0: 29 69 29 3b 0a 20 20 20 20 20 20 7d 20 65 6c 73  )i);.      } els
0ef0: 65 0a 20 20 20 20 20 20 69 66 20 28 6c 2d 3e 72  e.      if (l->r
0f00: 73 69 7a 65 20 3d 3d 20 73 69 7a 65 6f 66 28 64  size == sizeof(d
0f10: 6f 75 62 6c 65 29 29 20 7b 0a 20 20 20 20 20 20  ouble)) {.      
0f20: 20 20 28 28 69 6e 74 2a 29 6c 2d 3e 72 61 64 64    ((int*)l->radd
0f30: 72 29 5b 30 5d 20 3d 20 28 28 69 6e 74 2a 29 69  r)[0] = ((int*)i
0f40: 29 5b 30 5d 3b 0a 20 20 20 20 20 20 20 20 28 28  )[0];.        ((
0f50: 69 6e 74 2a 29 6c 2d 3e 72 61 64 64 72 29 5b 31  int*)l->raddr)[1
0f60: 5d 20 3d 20 28 28 69 6e 74 2a 29 69 29 5b 31 5d  ] = ((int*)i)[1]
0f70: 3b 0a 20 20 20 20 20 20 7d 20 65 6c 73 65 20 7b  ;.      } else {
0f80: 0a 20 20 20 20 20 20 20 20 69 6e 74 20 6e 20 3d  .        int n =
0f90: 20 28 6c 2d 3e 72 73 69 7a 65 2b 33 29 2f 34 3b   (l->rsize+3)/4;
0fa0: 0a 20 20 20 20 20 20 20 20 77 68 69 6c 65 20 28  .        while (
0fb0: 2d 2d 6e 20 3e 3d 20 30 29 0a 20 20 20 20 20 20  --n >= 0).      
0fc0: 20 20 20 20 28 28 5f 5f 61 76 77 6f 72 64 2a 29      ((__avword*)
0fd0: 6c 2d 3e 72 61 64 64 72 29 5b 6e 5d 20 3d 20 28  l->raddr)[n] = (
0fe0: 28 5f 5f 61 76 77 6f 72 64 2a 29 69 29 5b 6e 5d  (__avword*)i)[n]
0ff0: 3b 0a 20 20 20 20 20 20 7d 0a 20 20 20 20 7d 20  ;.      }.    } 
1000: 65 6c 73 65 20 7b 0a 20 20 20 20 20 20 2f 2a 20  else {.      /* 
1010: 6e 6f 72 6d 61 6c 20 73 74 72 75 63 74 20 72 65  normal struct re
1020: 74 75 72 6e 20 63 6f 6e 76 65 6e 74 69 6f 6e 20  turn convention 
1030: 2a 2f 0a 20 20 20 20 20 20 69 66 20 28 6c 2d 3e  */.      if (l->
1040: 66 6c 61 67 73 20 26 20 5f 5f 41 56 5f 52 45 47  flags & __AV_REG
1050: 49 53 54 45 52 5f 53 54 52 55 43 54 5f 52 45 54  ISTER_STRUCT_RET
1060: 55 52 4e 29 20 7b 0a 20 20 20 20 20 20 20 20 69  URN) {.        i
1070: 66 20 28 6c 2d 3e 72 73 69 7a 65 20 3d 3d 20 73  f (l->rsize == s
1080: 69 7a 65 6f 66 28 63 68 61 72 29 29 20 7b 20 2f  izeof(char)) { /
1090: 2a 20 63 61 6e 27 74 20 6f 63 63 75 72 20 2a 2f  * can't occur */
10a0: 0a 20 20 20 20 20 20 20 20 20 20 52 45 54 55 52  .          RETUR
10b0: 4e 28 63 68 61 72 2c 20 69 29 3b 0a 20 20 20 20  N(char, i);.    
10c0: 20 20 20 20 7d 20 65 6c 73 65 0a 20 20 20 20 20      } else.     
10d0: 20 20 20 69 66 20 28 6c 2d 3e 72 73 69 7a 65 20     if (l->rsize 
10e0: 3d 3d 20 73 69 7a 65 6f 66 28 73 68 6f 72 74 29  == sizeof(short)
10f0: 29 20 7b 20 2f 2a 20 63 61 6e 27 74 20 6f 63 63  ) { /* can't occ
1100: 75 72 20 2a 2f 0a 20 20 20 20 20 20 20 20 20 20  ur */.          
1110: 52 45 54 55 52 4e 28 73 68 6f 72 74 2c 20 69 29  RETURN(short, i)
1120: 3b 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65  ;.        } else
1130: 0a 20 20 20 20 20 20 20 20 69 66 20 28 6c 2d 3e  .        if (l->
1140: 72 73 69 7a 65 20 3c 3d 20 73 69 7a 65 6f 66 28  rsize <= sizeof(
1150: 69 6e 74 29 29 20 7b 0a 20 20 20 20 20 20 20 20  int)) {.        
1160: 20 20 52 45 54 55 52 4e 28 69 6e 74 2c 20 69 29    RETURN(int, i)
1170: 3b 0a 20 20 20 20 20 20 20 20 7d 20 65 6c 73 65  ;.        } else
1180: 0a 20 20 20 20 20 20 20 20 69 66 20 28 6c 2d 3e  .        if (l->
1190: 72 73 69 7a 65 20 3d 3d 20 32 2a 73 69 7a 65 6f  rsize == 2*sizeo
11a0: 66 28 5f 5f 61 76 77 6f 72 64 29 29 20 7b 0a 20  f(__avword)) {. 
11b0: 20 20 20 20 20 20 20 20 20 28 28 5f 5f 61 76 77           ((__avw
11c0: 6f 72 64 2a 29 6c 2d 3e 72 61 64 64 72 29 5b 30  ord*)l->raddr)[0
11d0: 5d 20 3d 20 69 3b 0a 20 20 20 20 20 20 20 20 20  ] = i;.         
11e0: 20 28 28 5f 5f 61 76 77 6f 72 64 2a 29 6c 2d 3e   ((__avword*)l->
11f0: 72 61 64 64 72 29 5b 31 5d 20 3d 20 69 72 65 74  raddr)[1] = iret
1200: 32 3b 0a 20 20 20 20 20 20 20 20 7d 0a 20 20 20  2;.        }.   
1210: 20 20 20 7d 0a 20 20 20 20 7d 0a 20 20 7d 0a 20     }.    }.  }. 
1220: 20 72 65 74 75 72 6e 20 30 3b 0a 7d 0a 0a 23 65   return 0;.}..#e
1230: 6e 64 69 66 20 2f 2a 5f 61 76 63 61 6c 6c 5f 61  ndif /*_avcall_a
1240: 72 6d 5f 63 20 2a 2f 0a                          rm_c */.