summaryrefslogtreecommitdiff
path: root/asmrun
diff options
context:
space:
mode:
authorJun FURUSE / 古瀬 淳 <jun.furuse@gmail.com>2004-06-18 05:04:14 +0000
committerJun FURUSE / 古瀬 淳 <jun.furuse@gmail.com>2004-06-18 05:04:14 +0000
commit5e1bf20850aaa9b1ceb86a971848609ee9e84c47 (patch)
treef3a6e5b5c38263fe527e6275ff95425f12637226 /asmrun
parent8ec769214e067da9ee8b33d05f4ef275e9269dd5 (diff)
downloadocaml-gcaml.tar.gz
port to the latest ocaml (2004/06/18)gcaml
git-svn-id: http://caml.inria.fr/svn/ocaml/branches/gcaml@6419 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'asmrun')
-rw-r--r--asmrun/Makefile7
-rw-r--r--asmrun/amd64.S2
-rw-r--r--asmrun/fail.c2
-rw-r--r--asmrun/hppa.S48
-rw-r--r--asmrun/i386nt.asm71
-rw-r--r--asmrun/signals.c20
6 files changed, 55 insertions, 95 deletions
diff --git a/asmrun/Makefile b/asmrun/Makefile
index 720e3cfbf9..b8034bab43 100644
--- a/asmrun/Makefile
+++ b/asmrun/Makefile
@@ -150,13 +150,6 @@ LINKEDFILES=misc.c freelist.c major_gc.c minor_gc.c memory.c alloc.c array.c \
clean::
rm -f $(LINKEDFILES)
-# For HPUX, we can't use gcc as ASPP because it may have been configured with
-# the vendor's assembler
-hppa.o: hppa.S
- gcc -traditional -E -DSYS_$(SYSTEM) -o hppa.s hppa.S
- gas -o hppa.o hppa.s || { rm -f hppa.s; exit 2; }
- rm -f hppa.s
-
.SUFFIXES: .S .d.o .p.o
.S.o:
diff --git a/asmrun/amd64.S b/asmrun/amd64.S
index eaa24153ee..1288e826a6 100644
--- a/asmrun/amd64.S
+++ b/asmrun/amd64.S
@@ -34,11 +34,11 @@ FUNCTION(caml_call_gc)
movq %rax, caml_last_return_address(%rip)
leaq 8(%rsp), %rax
movq %rax, caml_bottom_of_stack(%rip)
+.L105:
/* Save caml_young_ptr, caml_exception_pointer */
movq %r15, caml_young_ptr(%rip)
movq %r14, caml_exception_pointer(%rip)
/* Build array of registers, save it into caml_gc_regs */
-.L105:
pushq %r13
pushq %r12
pushq %rbp
diff --git a/asmrun/fail.c b/asmrun/fail.c
index 57146b64cb..d00014ef29 100644
--- a/asmrun/fail.c
+++ b/asmrun/fail.c
@@ -79,6 +79,7 @@ void caml_raise_constant(value tag)
bucket = caml_alloc_small (1, 0);
Field(bucket, 0) = tag;
caml_raise(bucket);
+ CAMLnoreturn;
}
void caml_raise_with_arg(value tag, value arg)
@@ -90,6 +91,7 @@ void caml_raise_with_arg(value tag, value arg)
Field(bucket, 0) = tag;
Field(bucket, 1) = arg;
caml_raise(bucket);
+ CAMLnoreturn;
}
void caml_raise_with_string(value tag, char *msg)
diff --git a/asmrun/hppa.S b/asmrun/hppa.S
index 713caea666..c8a265e203 100644
--- a/asmrun/hppa.S
+++ b/asmrun/hppa.S
@@ -30,18 +30,18 @@
#define LOWLABEL(x) RR%x
#endif
-#ifdef SYS_nextstep
-#define G(x) _##x
+#ifdef SYS_linux
+#define G(x) x
#define CODESPACE .text
-#define CODE_ALIGN 2
+#define CODE_ALIGN 8
#define EXPORT_CODE(x) .globl x
#define EXPORT_DATA(x) .globl x
#define STARTPROC
#define ENDPROC
-#define LOADHIGH(x) ldil L`x, %r1
-#define LOW(x) R`x
-#define LOADHIGHLABEL(x) ldil L`x, %r1
-#define LOWLABEL(x) R`x
+#define LOADHIGH(x) addil LR%x-$global$, %r27
+#define LOW(x) RR%x-$global$
+#define LOADHIGHLABEL(x) ldil LR%x, %r1
+#define LOWLABEL(x) RR%x
#endif
#ifdef SYS_hpux
@@ -69,14 +69,15 @@ caml_exception_pointer .comm 8
caml_required_size .comm 8
#endif
-#ifdef SYS_nextstep
- .comm G(caml_young_limit), 8
- .comm G(caml_young_ptr), 8
- .comm G(caml_bottom_of_stack), 8
- .comm G(caml_last_return_address), 8
- .comm G(caml_gc_regs), 8
- .comm G(caml_exception_pointer), 8
- .comm G(caml_required_size), 8
+#ifdef SYS_linux
+ .align 8
+ .comm G(young_limit), 4
+ .comm G(young_ptr), 4
+ .comm G(caml_bottom_of_stack), 4
+ .comm G(caml_last_return_address), 4
+ .comm G(caml_gc_regs), 4
+ .comm G(caml_exception_pointer), 4
+ .comm G(caml_required_size), 4
#endif
; Allocation functions
@@ -173,14 +174,8 @@ L100: ldo -(64 + 4*32)(%r30), %r31
fstds,ma %fr30, 8(%r1)
; Call the garbage collector
-#ifdef SYS_nextstep
- ldil L`G(caml_garbage_collection), %r1
- ble R`G(caml_garbage_collection)(4, %r1)
- copy %r31, %r2
-#else
bl G(caml_garbage_collection), %r2
nop
-#endif
; Restore all regs used by the code generator
ldo -(64 + 4*32)(%r30), %r1
@@ -452,14 +447,8 @@ L103:
; Re-raise the exception through caml_raise, to clean up local C roots
ldo 64(%r30), %r30
-#ifdef SYS_nextstep
- ldil L`G(caml_raise), %r1
- ble R`G(caml_raise)(4, %r1)
- copy %r31, %r2
-#else
bl G(caml_raise), %r2
nop
-#endif
ENDPROC
; Raise an exception from C
@@ -529,13 +518,8 @@ G(caml_callback3_exn):
G(caml_ml_array_bound_error):
STARTPROC
; Load address of [caml_array_bound_error] in %r22
-#ifdef SYS_hpux
ldil LR%caml_array_bound_error, %r22
ldo RR%caml_array_bound_error(%r22), %r22
-#else
- ldil L`_caml_array_bound_error, %r22
- ldo R`_caml_array_bound_error(%r22), %r22
-#endif
; Reserve 48 bytes of stack space and jump to caml_c_call
b G(caml_c_call)
ldo 48(%r30), %r30 /* in delay slot */
diff --git a/asmrun/i386nt.asm b/asmrun/i386nt.asm
index 9ef28aeffc..583feb7414 100644
--- a/asmrun/i386nt.asm
+++ b/asmrun/i386nt.asm
@@ -18,14 +18,13 @@
.386
.MODEL FLAT
- EXTERN _garbage_collection: PROC
- EXTERN _mlraise: PROC
+ EXTERN _caml_garbage_collection: PROC
EXTERN _caml_apply2: PROC
EXTERN _caml_apply3: PROC
EXTERN _caml_program: PROC
- EXTERN _array_bound_error: PROC
- EXTERN _young_limit: DWORD
- EXTERN _young_ptr: DWORD
+ EXTERN _caml_array_bound_error: PROC
+ EXTERN _caml_young_limit: DWORD
+ EXTERN _caml_young_ptr: DWORD
EXTERN _caml_bottom_of_stack: DWORD
EXTERN _caml_last_return_address: DWORD
EXTERN _caml_gc_regs: DWORD
@@ -37,7 +36,7 @@
PUBLIC _caml_alloc1
PUBLIC _caml_alloc2
PUBLIC _caml_alloc3
- PUBLIC _caml_alloc
+ PUBLIC _caml_allocN
PUBLIC _caml_call_gc
_caml_call_gc:
@@ -56,7 +55,7 @@ L105: push ebp
push eax
mov _caml_gc_regs, esp
; Call the garbage collector
- call _garbage_collection
+ call _caml_garbage_collection
; Restore all regs used by the code generator
pop eax
pop ebx
@@ -70,10 +69,10 @@ L105: push ebp
ALIGN 4
_caml_alloc1:
- mov eax, _young_ptr
+ mov eax, _caml_young_ptr
sub eax, 8
- mov _young_ptr, eax
- cmp eax, _young_limit
+ mov _caml_young_ptr, eax
+ cmp eax, _caml_young_limit
jb L100
ret
L100: mov eax, [esp]
@@ -85,10 +84,10 @@ L100: mov eax, [esp]
ALIGN 4
_caml_alloc2:
- mov eax, _young_ptr
+ mov eax, _caml_young_ptr
sub eax, 12
- mov _young_ptr, eax
- cmp eax, _young_limit
+ mov _caml_young_ptr, eax
+ cmp eax, _caml_young_limit
jb L101
ret
L101: mov eax, [esp]
@@ -100,10 +99,10 @@ L101: mov eax, [esp]
ALIGN 4
_caml_alloc3:
- mov eax, _young_ptr
+ mov eax, _caml_young_ptr
sub eax, 16
- mov _young_ptr, eax
- cmp eax, _young_limit
+ mov _caml_young_ptr, eax
+ cmp eax, _caml_young_limit
jb L102
ret
L102: mov eax, [esp]
@@ -114,24 +113,24 @@ L102: mov eax, [esp]
jmp _caml_alloc3
ALIGN 4
-_caml_alloc:
- sub eax, _young_ptr ; eax = size - young_ptr
+_caml_allocN:
+ sub eax, _caml_young_ptr ; eax = size - young_ptr
neg eax ; eax = young_ptr - size
- cmp eax, _young_limit
+ cmp eax, _caml_young_limit
jb L103
- mov _young_ptr, eax
+ mov _caml_young_ptr, eax
ret
-L103: sub eax, _young_ptr ; eax = - size
+L103: sub eax, _caml_young_ptr ; eax = - size
neg eax ; eax = size
push eax ; save desired size
- sub _young_ptr, eax ; must update young_ptr
+ sub _caml_young_ptr, eax ; must update young_ptr
mov eax, [esp+4]
mov _caml_last_return_address, eax
lea eax, [esp+8]
mov _caml_bottom_of_stack, eax
call L105
pop eax ; recover desired size
- jmp _caml_alloc
+ jmp _caml_allocN
; Call a C function from Caml
@@ -197,9 +196,9 @@ L108:
; Raise an exception from C
- PUBLIC _raise_caml_exception
+ PUBLIC _caml_raise_exception
ALIGN 4
-_raise_caml_exception:
+_caml_raise_exception:
mov eax, [esp+4]
mov esp, _caml_exception_pointer
pop _caml_exception_pointer
@@ -207,9 +206,9 @@ _raise_caml_exception:
; Callback from C to Caml
- PUBLIC _callback_exn
+ PUBLIC _caml_callback_exn
ALIGN 4
-_callback_exn:
+_caml_callback_exn:
; Save callee-save registers
push ebx
push esi
@@ -221,9 +220,9 @@ _callback_exn:
mov esi, [ebx] ; code pointer
jmp L106
- PUBLIC _callback2_exn
+ PUBLIC _caml_callback2_exn
ALIGN 4
-_callback2_exn:
+_caml_callback2_exn:
; Save callee-save registers
push ebx
push esi
@@ -236,9 +235,9 @@ _callback2_exn:
mov esi, offset _caml_apply2 ; code pointer
jmp L106
- PUBLIC _callback3_exn
+ PUBLIC _caml_callback3_exn
ALIGN 4
-_callback3_exn:
+_caml_callback3_exn:
; Save callee-save registers
push ebx
push esi
@@ -252,9 +251,9 @@ _callback3_exn:
mov esi, offset _caml_apply3 ; code pointer
jmp L106
- PUBLIC _caml_array_bound_error
+ PUBLIC _caml_ml_array_bound_error
ALIGN 4
-_caml_array_bound_error:
+_caml_ml_array_bound_error:
; Empty the floating-point stack
ffree st(0)
ffree st(1)
@@ -265,11 +264,11 @@ _caml_array_bound_error:
ffree st(6)
ffree st(7)
; Branch to array_bound_error
- jmp _array_bound_error
+ jmp _caml_array_bound_error
.DATA
- PUBLIC _system__frametable
-_system__frametable LABEL DWORD
+ PUBLIC _caml_system__frametable
+_caml_system__frametable LABEL DWORD
DWORD 1 ; one descriptor
DWORD L107 ; return address into callback
WORD -1 ; negative frame size => use callback link
diff --git a/asmrun/signals.c b/asmrun/signals.c
index 1074ec3acb..efc73ce7e9 100644
--- a/asmrun/signals.c
+++ b/asmrun/signals.c
@@ -41,7 +41,7 @@ extern char * caml_code_area_start, * caml_code_area_end;
#ifdef _WIN32
typedef void (*sighandler)(int sig);
extern sighandler caml_win32_signal(int sig, sighandler action);
-#define signal(sig,act) win32_signal(sig,act)
+#define signal(sig,act) caml_win32_signal(sig,act)
#endif
#if defined(TARGET_power) && defined(SYS_rhapsody)
@@ -224,24 +224,6 @@ void caml_leave_blocking_section(void)
caml_async_signal_mode = 0;
}
-#ifdef POSIX_SIGNALS
-static void reraise(int sig, int now)
-{
- struct sigaction sa;
- sa.sa_handler = 0;
- sa.sa_flags = 0;
- sigemptyset(&sa.sa_mask);
- sigaction(sig, &sa, 0);
- /* If the signal was sent using kill() (si_code == 0) or will
- not recur then raise it here. Otherwise return. The
- offending instruction will be reexecuted and the signal
- will recur. */
- if (now == 1)
- raise(sig);
- return;
-}
-#endif
-
#if defined(TARGET_alpha) || defined(TARGET_mips)
static void handle_signal(int sig, int code, struct sigcontext * context)
#elif defined(TARGET_power) && defined(SYS_aix)