summaryrefslogtreecommitdiff
path: root/testasmcomp/power-elf.S
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1996-07-03 16:14:11 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1996-07-03 16:14:11 +0000
commit1130f59602f2d8b3ee1763e29d8a41b70150f572 (patch)
tree7929d461e33d5cb78424a7ea52c5d1245dfb4311 /testasmcomp/power-elf.S
parent984514f8917778a04be0ca0b92c038e9c7c6bd9b (diff)
downloadocaml-1130f59602f2d8b3ee1763e29d8a41b70150f572.tar.gz
Adaptation a MkLinux du portage PowerPC
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@916 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'testasmcomp/power-elf.S')
-rw-r--r--testasmcomp/power-elf.S130
1 files changed, 130 insertions, 0 deletions
diff --git a/testasmcomp/power-elf.S b/testasmcomp/power-elf.S
new file mode 100644
index 0000000000..f3f3ff02b5
--- /dev/null
+++ b/testasmcomp/power-elf.S
@@ -0,0 +1,130 @@
+/*********************************************************************/
+/* */
+/* Objective Caml */
+/* */
+/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
+/* */
+/* Copyright 1996 Institut National de Recherche en Informatique et */
+/* Automatique. Distributed only by permission. */
+/* */
+/*********************************************************************/
+
+/* $Id$ */
+
+/* Save and restore all callee-save registers */
+/* GPR 14 at sp+16 ... GPR 31 at sp+84
+ FPR 14 at sp+92 ... FPR 31 at sp+228 */
+
+#define Save_callee_save \
+ addic 11, 1, 16-4; \
+ stwu 14, 4(11); \
+ stwu 15, 4(11); \
+ stwu 16, 4(11); \
+ stwu 17, 4(11); \
+ stwu 18, 4(11); \
+ stwu 19, 4(11); \
+ stwu 20, 4(11); \
+ stwu 21, 4(11); \
+ stwu 22, 4(11); \
+ stwu 23, 4(11); \
+ stwu 24, 4(11); \
+ stwu 25, 4(11); \
+ stwu 26, 4(11); \
+ stwu 27, 4(11); \
+ stwu 28, 4(11); \
+ stwu 29, 4(11); \
+ stwu 30, 4(11); \
+ stwu 31, 4(11); \
+ stfdu 14, 8(11); \
+ stfdu 15, 8(11); \
+ stfdu 16, 8(11); \
+ stfdu 17, 8(11); \
+ stfdu 18, 8(11); \
+ stfdu 19, 8(11); \
+ stfdu 20, 8(11); \
+ stfdu 21, 8(11); \
+ stfdu 22, 8(11); \
+ stfdu 23, 8(11); \
+ stfdu 24, 8(11); \
+ stfdu 25, 8(11); \
+ stfdu 26, 8(11); \
+ stfdu 27, 8(11); \
+ stfdu 28, 8(11); \
+ stfdu 29, 8(11); \
+ stfdu 30, 8(11); \
+ stfdu 31, 8(11)
+
+#define Restore_callee_save \
+ addic 11, 1, 16-4; \
+ lwzu 14, 4(11); \
+ lwzu 15, 4(11); \
+ lwzu 16, 4(11); \
+ lwzu 17, 4(11); \
+ lwzu 18, 4(11); \
+ lwzu 19, 4(11); \
+ lwzu 20, 4(11); \
+ lwzu 21, 4(11); \
+ lwzu 22, 4(11); \
+ lwzu 23, 4(11); \
+ lwzu 24, 4(11); \
+ lwzu 25, 4(11); \
+ lwzu 26, 4(11); \
+ lwzu 27, 4(11); \
+ lwzu 28, 4(11); \
+ lwzu 29, 4(11); \
+ lwzu 30, 4(11); \
+ lwzu 31, 4(11); \
+ lfdu 14, 8(11); \
+ lfdu 15, 8(11); \
+ lfdu 16, 8(11); \
+ lfdu 17, 8(11); \
+ lfdu 18, 8(11); \
+ lfdu 19, 8(11); \
+ lfdu 20, 8(11); \
+ lfdu 21, 8(11); \
+ lfdu 22, 8(11); \
+ lfdu 23, 8(11); \
+ lfdu 24, 8(11); \
+ lfdu 25, 8(11); \
+ lfdu 26, 8(11); \
+ lfdu 27, 8(11); \
+ lfdu 28, 8(11); \
+ lfdu 29, 8(11); \
+ lfdu 30, 8(11); \
+ lfdu 31, 8(11)
+
+ .section "text"
+
+ .globl call_gen_code
+ .type call_gen_code, @function
+call_gen_code:
+ /* Allocate and link stack frame */
+ stwu 1, -256(1)
+ /* Save return address */
+ mflr 0
+ stw 0, 256+4(1)
+ /* Save all callee-save registers */
+ Save_callee_save
+ /* Shuffle arguments */
+ mtlr 3
+ mr 3, 4
+ mr 4, 5
+ mr 5, 6
+ mr 6, 7
+ /* Call the function */
+ blrl
+ /* Restore callee-save registers */
+ Restore_callee_save
+ /* Reload return address */
+ lwz 0, 256+4(1)
+ mtlr 0
+ /* Return */
+ addi 1, 1, 256
+ blr
+
+ .globl caml_c_call
+ .type caml_c_call, @function
+caml_c_call:
+ /* Jump to C function (address in 11) */
+ mtctr 11
+ bctr