summaryrefslogtreecommitdiff
path: root/testasmcomp
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
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')
-rw-r--r--testasmcomp/Makefile5
-rw-r--r--testasmcomp/power-aix.asm (renamed from testasmcomp/power.asm)28
-rw-r--r--testasmcomp/power-elf.S130
3 files changed, 150 insertions, 13 deletions
diff --git a/testasmcomp/Makefile b/testasmcomp/Makefile
index 387f50df5f..1b01da3ee0 100644
--- a/testasmcomp/Makefile
+++ b/testasmcomp/Makefile
@@ -106,6 +106,11 @@ arith.out: mainarith.c arith.o $(ARCH).o
checkbound.out: main.c checkbound.o $(ARCH).o
$(CC) $(CFLAGS) -o checkbound.out -DCHECKBOUND main.c checkbound.o $(ARCH).o
+# The runtime environment
+
+power.o: power-$(SYS).o
+ ln -s power-$(SYS).o power.o
+
.SUFFIXES:
.SUFFIXES: .cmm .c .o .asm .S .ml .mli .cmo .cmi
diff --git a/testasmcomp/power.asm b/testasmcomp/power-aix.asm
index cde1d30a3e..b2acafb3c8 100644
--- a/testasmcomp/power.asm
+++ b/testasmcomp/power-aix.asm
@@ -11,16 +11,6 @@
# $Id$
- .globl call_gen_code
- .csect call_gen_code[DS]
-call_gen_code:
- .long .call_gen_code, TOC[tc0], 0
-
- .globl caml_c_call
- .csect caml_c_call[DS]
-caml_c_call:
- .long .caml_c_call, TOC[tc0], 0
-
.csect .text[PR]
.globl .call_gen_code
@@ -137,9 +127,9 @@ caml_c_call:
# Return address is in 25, RTOC is in 26
mflr 25
mr 26, 2
-# Call desired function (descriptor in r28)
- lwz 0, 0(28)
- lwz 2, 4(28)
+# Call desired function (descriptor in r11)
+ lwz 0, 0(11)
+ lwz 2, 4(11)
mtlr 0
blrl
# Restore return address and RTOC
@@ -148,3 +138,15 @@ caml_c_call:
# Return to caller
blr
+# Function closures
+
+ .globl call_gen_code
+ .csect call_gen_code[DS]
+call_gen_code:
+ .long .call_gen_code, TOC[tc0], 0
+
+ .globl caml_c_call
+ .csect caml_c_call[DS]
+caml_c_call:
+ .long .caml_c_call, TOC[tc0], 0
+
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