home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Misc / CLISP-2.LHA / CLISP960530-ki.lha / ffcall / trampoline / tramp-alpha.s < prev    next >
Encoding:
Text File  |  1996-04-15  |  1.0 KB  |  46 lines

  1. /* Trampoline for alpha CPU */
  2.  
  3. /*
  4.  * Copyright 1995 Bruno Haible, <haible@ma2s2.mathematik.uni-karlsruhe.de>
  5.  *
  6.  * This is free software distributed under the GNU General Public Licence
  7.  * described in the file COPYING. Contact the author if you don't have this
  8.  * or can't live with it. There is ABSOLUTELY NO WARRANTY, explicit or implied,
  9.  * on this software.
  10.  */
  11.  
  12. /* Available registers: $1, $2, $3, $4, $5, $6, $7, $8. */
  13.  
  14.     .set noreorder
  15.     .set noat
  16. .text
  17.     .align 3
  18.  
  19.     .globl tramp
  20.     .ent tramp
  21. tramp:
  22.     br $1,tramp1        /* $1 := address of tramp1 */
  23. tramp1:    /* Load everything relative to $1. If we were to use "lda" instructions
  24.      * we would have to do the usual  ldgp $29,0($27)
  25.      */
  26.     ldq $2,20($1)        /* data */
  27.     ldq $3,28($1)        /* variable */
  28.     ldq $27,36($1)        /* function */
  29.     stq $2,0($3)
  30.     /* The called function expects to see its own address in $27. */
  31.     jmp $31,($27),0        /* jump to function */
  32.  
  33.     .align 3
  34. data:
  35.     .quad 0x73554711
  36.  
  37.     .align 3
  38. variable:
  39.     .quad 0x12345678
  40.  
  41.     .align 3
  42. function:
  43.     .quad 0xbabebec0
  44.  
  45.     .end tramp
  46.