summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1996-06-24 13:24:38 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1996-06-24 13:24:38 +0000
commitfc52ff530a9dacf3be48a1d16fc7038476f7ca49 (patch)
tree0eb41c66a58b7f2dcd02808e72adb23fde7e3677
parent77ff668587d42dcc3d9bf165954c5f1e35ed23f7 (diff)
Portage HPUX, fin
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@898 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r--asmcomp/emit_hppa.mlp18
-rw-r--r--asmrun/hppa.S8
2 files changed, 23 insertions, 3 deletions
diff --git a/asmcomp/emit_hppa.mlp b/asmcomp/emit_hppa.mlp
index 3f4432a87..7bae574fd 100644
--- a/asmcomp/emit_hppa.mlp
+++ b/asmcomp/emit_hppa.mlp
@@ -320,6 +320,22 @@ let emit_stubs () =
emit_align 4;
Hashtbl.iter emit_stub stub_label_table
+(* Describe the registers used to pass arguments to a C function *)
+
+let describe_call arg =
+ ` .CALL RTNVAL=NO`;
+ let pos = ref 0 in
+ for i = 0 to Array.length arg - 1 do
+ if !pos < 4 then begin
+ match arg.(i).typ with
+ Float -> `, ARGW{emit_int !pos}=FR, ARGW{emit_int(!pos + 1)}=FU`;
+ pos := !pos + 2
+ | _ -> `, ARGW{emit_int !pos}=GR`;
+ pos := !pos + 1
+ end
+ done;
+ `\n`
+
(* Output a function call *)
let emit_call s retreg =
@@ -472,6 +488,7 @@ let rec emit_instr i dslot =
call_symbol s;
if hpux then begin
` ldil LP'{emit_symbol s}, %r22\n`;
+ describe_call i.arg;
emit_call "caml_c_call" "%r2";
` ldo RP'{emit_symbol s}(%r22), %r22\n` (* in delay slot *)
end else begin
@@ -481,6 +498,7 @@ let rec emit_instr i dslot =
end;
record_frame i.live
end else begin
+ if hpux then describe_call i.arg;
emit_call s "%r2";
fill_delay_slot dslot
end
diff --git a/asmrun/hppa.S b/asmrun/hppa.S
index 486799143..9155762ac 100644
--- a/asmrun/hppa.S
+++ b/asmrun/hppa.S
@@ -24,7 +24,7 @@
#define ENDPROC .exit ! .procend
#define LOADHIGH(x) addil LR%x-$global$, %r27
#define LOW(x) RR%x-$global$
-#define LOADHIGHLABEL(x) addil LR%x, %r27
+#define LOADHIGHLABEL(x) ldil LR%x, %r1
#define LOWLABEL(x) RR%x
#define CALL(x) bl x, %r2 ! nop
#endif
@@ -42,8 +42,6 @@
#define LOADHIGHLABEL(x) ldil L`x, %r1
#define LOWLABEL(x) R`x
#define CALL(x) ldil L`x, %r1; ble R`x(4, %r1); copy %r31, %r2
-#define WORD .long
-#define HALF .short
#endif
#ifdef SYS_hpux
@@ -253,7 +251,11 @@ G(caml_call_gc):
; Function to call is in %r22
.align CODE_ALIGN
+#ifdef SYS_hpux
+ .export G(caml_c_call), ENTRY, ARGW0=GR, ARGW1=GR, ARGW2=GR, ARGW3=GR
+#else
EXPORT_CODE(G(caml_c_call))
+#endif
G(caml_c_call):
STARTPROC
; Record lowest stack address