diff options
Diffstat (limited to 'asmrun')
| -rw-r--r-- | asmrun/.cvsignore | 33 | ||||
| -rw-r--r-- | asmrun/.depend | 498 | ||||
| -rw-r--r-- | asmrun/Makefile | 195 | ||||
| -rw-r--r-- | asmrun/Makefile.nt | 77 | ||||
| -rw-r--r-- | asmrun/alpha.S | 440 | ||||
| -rw-r--r-- | asmrun/amd64.S | 335 | ||||
| -rw-r--r-- | asmrun/arm.S | 339 | ||||
| -rw-r--r-- | asmrun/fail.c | 172 | ||||
| -rw-r--r-- | asmrun/hppa.S | 550 | ||||
| -rw-r--r-- | asmrun/i386.S | 326 | ||||
| -rw-r--r-- | asmrun/i386nt.asm | 278 | ||||
| -rw-r--r-- | asmrun/ia64.S | 530 | ||||
| -rw-r--r-- | asmrun/m68k.S | 244 | ||||
| -rw-r--r-- | asmrun/mips.s | 386 | ||||
| -rw-r--r-- | asmrun/power-aix.S | 513 | ||||
| -rw-r--r-- | asmrun/power-elf.S | 421 | ||||
| -rw-r--r-- | asmrun/power-rhapsody.S | 416 | ||||
| -rw-r--r-- | asmrun/roots.c | 297 | ||||
| -rw-r--r-- | asmrun/signals.c | 677 | ||||
| -rw-r--r-- | asmrun/sparc.S | 398 | ||||
| -rw-r--r-- | asmrun/stack.h | 105 | ||||
| -rw-r--r-- | asmrun/startup.c | 158 |
22 files changed, 0 insertions, 7388 deletions
diff --git a/asmrun/.cvsignore b/asmrun/.cvsignore deleted file mode 100644 index ee21b35990..0000000000 --- a/asmrun/.cvsignore +++ /dev/null @@ -1,33 +0,0 @@ -main.c -misc.c -freelist.c -major_gc.c -minor_gc.c -memory.c -alloc.c -array.c -compare.c -ints.c -floats.c -str.c -io.c -extern.c -intern.c -hash.c -sys.c -parsing.c -gc_ctrl.c -terminfo.c -md5.c -obj.c -lexing.c -printexc.c -callback.c -weak.c -compact.c -finalise.c -custom.c -meta.c -globroots.c -unix.c -dynlink.c diff --git a/asmrun/.depend b/asmrun/.depend deleted file mode 100644 index 63c99b5b41..0000000000 --- a/asmrun/.depend +++ /dev/null @@ -1,498 +0,0 @@ -alloc.o: alloc.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/custom.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/minor_gc.h ../byterun/stacks.h -array.o: array.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h -callback.o: callback.c ../byterun/callback.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/fail.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h -compact.o: compact.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/finalise.h ../byterun/roots.h ../byterun/misc.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/mlvalues.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/gc_ctrl.h ../byterun/weak.h -compare.o: compare.c ../byterun/custom.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/fail.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h -custom.o: custom.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h -dynlink.o: dynlink.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/alloc.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/dynlink.h ../byterun/fail.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/osdeps.h ../byterun/prims.h -extern.o: extern.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/gc.h \ - ../byterun/intext.h ../byterun/io.h ../byterun/memory.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/reverse.h -fail.o: fail.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/io.h ../byterun/gc.h ../byterun/memory.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/printexc.h ../byterun/signals.h stack.h ../byterun/roots.h -finalise.o: finalise.c ../byterun/callback.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/fail.h ../byterun/roots.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/signals.h -floats.o: floats.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/fail.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/reverse.h ../byterun/stacks.h -freelist.o: freelist.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/freelist.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/gc.h ../byterun/gc_ctrl.h ../byterun/major_gc.h -gc_ctrl.o: gc_ctrl.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/compact.h ../byterun/custom.h ../byterun/finalise.h \ - ../byterun/roots.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/gc_ctrl.h ../byterun/stacks.h -globroots.o: globroots.c ../byterun/memory.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/gc.h ../byterun/mlvalues.h \ - ../byterun/misc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/globroots.h -hash.o: hash.c ../byterun/mlvalues.h ../byterun/config.h ../config/m.h \ - ../config/s.h ../byterun/misc.h ../byterun/custom.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h -intern.o: intern.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/gc.h \ - ../byterun/intext.h ../byterun/io.h ../byterun/memory.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/reverse.h ../byterun/md5.h -ints.o: ints.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/custom.h \ - ../byterun/fail.h ../byterun/intext.h ../byterun/io.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/int64_native.h -io.o: io.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/alloc.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/io.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/signals.h \ - ../byterun/sys.h -lexing.o: lexing.c ../byterun/fail.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/stacks.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h -main.o: main.c ../byterun/misc.h ../byterun/config.h ../config/m.h \ - ../config/s.h ../byterun/mlvalues.h ../byterun/sys.h -major_gc.o: major_gc.c ../byterun/compact.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/misc.h ../byterun/custom.h \ - ../byterun/mlvalues.h ../byterun/fail.h ../byterun/finalise.h \ - ../byterun/roots.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/gc_ctrl.h ../byterun/weak.h -md5.o: md5.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/md5.h ../byterun/io.h ../byterun/reverse.h -memory.o: memory.c ../byterun/fail.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/freelist.h ../byterun/gc.h ../byterun/gc_ctrl.h \ - ../byterun/major_gc.h ../byterun/memory.h ../byterun/minor_gc.h \ - ../byterun/signals.h -meta.o: meta.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/fix_code.h ../byterun/interp.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/minor_gc.h ../byterun/prims.h ../byterun/stacks.h -minor_gc.o: minor_gc.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/fail.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/finalise.h ../byterun/roots.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/gc_ctrl.h ../byterun/signals.h -misc.o: misc.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/misc.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/mlvalues.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h -obj.o: obj.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/memory.h ../byterun/minor_gc.h ../byterun/prims.h -parsing.o: parsing.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/mlvalues.h ../byterun/misc.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/alloc.h -printexc.o: printexc.c ../byterun/backtrace.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/callback.h ../byterun/debugger.h ../byterun/fail.h \ - ../byterun/printexc.h -roots.o: roots.c ../byterun/finalise.h ../byterun/roots.h \ - ../byterun/misc.h ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/mlvalues.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/globroots.h stack.h -signals.o: signals.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/callback.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/fail.h ../byterun/signals.h stack.h ../byterun/sys.h -startup.o: startup.c ../byterun/callback.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/gc.h \ - ../byterun/gc_ctrl.h ../byterun/osdeps.h ../byterun/printexc.h \ - ../byterun/sys.h -str.o: str.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h -sys.o: sys.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/alloc.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/debugger.h ../byterun/fail.h ../byterun/instruct.h \ - ../byterun/osdeps.h ../byterun/signals.h ../byterun/stacks.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/sys.h -terminfo.o: terminfo.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/alloc.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/fail.h ../byterun/io.h -unix.o: unix.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/mlvalues.h \ - ../byterun/misc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/osdeps.h -weak.o: weak.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h -alloc.d.o: alloc.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/custom.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/minor_gc.h ../byterun/stacks.h -array.d.o: array.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h -callback.d.o: callback.c ../byterun/callback.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/fail.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h -compact.d.o: compact.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/finalise.h ../byterun/roots.h ../byterun/misc.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/mlvalues.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/gc_ctrl.h ../byterun/weak.h -compare.d.o: compare.c ../byterun/custom.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/fail.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h -custom.d.o: custom.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h -dynlink.d.o: dynlink.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/alloc.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/dynlink.h ../byterun/fail.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/osdeps.h ../byterun/prims.h -extern.d.o: extern.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/gc.h \ - ../byterun/intext.h ../byterun/io.h ../byterun/memory.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/reverse.h -fail.d.o: fail.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/io.h ../byterun/gc.h ../byterun/memory.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/printexc.h ../byterun/signals.h stack.h ../byterun/roots.h -finalise.d.o: finalise.c ../byterun/callback.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/fail.h ../byterun/roots.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/signals.h -floats.d.o: floats.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/fail.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/reverse.h ../byterun/stacks.h -freelist.d.o: freelist.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/freelist.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/gc.h ../byterun/gc_ctrl.h ../byterun/major_gc.h -gc_ctrl.d.o: gc_ctrl.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/compact.h ../byterun/custom.h ../byterun/finalise.h \ - ../byterun/roots.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/gc_ctrl.h ../byterun/stacks.h -globroots.d.o: globroots.c ../byterun/memory.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/gc.h ../byterun/mlvalues.h \ - ../byterun/misc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/globroots.h -hash.d.o: hash.c ../byterun/mlvalues.h ../byterun/config.h ../config/m.h \ - ../config/s.h ../byterun/misc.h ../byterun/custom.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h -intern.d.o: intern.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/gc.h \ - ../byterun/intext.h ../byterun/io.h ../byterun/memory.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/reverse.h ../byterun/md5.h -ints.d.o: ints.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/custom.h \ - ../byterun/fail.h ../byterun/intext.h ../byterun/io.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/int64_native.h -io.d.o: io.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/alloc.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/io.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/signals.h \ - ../byterun/sys.h -lexing.d.o: lexing.c ../byterun/fail.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/stacks.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h -main.d.o: main.c ../byterun/misc.h ../byterun/config.h ../config/m.h \ - ../config/s.h ../byterun/mlvalues.h ../byterun/sys.h -major_gc.d.o: major_gc.c ../byterun/compact.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/misc.h ../byterun/custom.h \ - ../byterun/mlvalues.h ../byterun/fail.h ../byterun/finalise.h \ - ../byterun/roots.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/gc_ctrl.h ../byterun/weak.h -md5.d.o: md5.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/md5.h ../byterun/io.h ../byterun/reverse.h -memory.d.o: memory.c ../byterun/fail.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/freelist.h ../byterun/gc.h ../byterun/gc_ctrl.h \ - ../byterun/major_gc.h ../byterun/memory.h ../byterun/minor_gc.h \ - ../byterun/signals.h -meta.d.o: meta.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/fix_code.h ../byterun/interp.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/minor_gc.h ../byterun/prims.h ../byterun/stacks.h -minor_gc.d.o: minor_gc.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/fail.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/finalise.h ../byterun/roots.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/gc_ctrl.h ../byterun/signals.h -misc.d.o: misc.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/misc.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/mlvalues.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h -obj.d.o: obj.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/memory.h ../byterun/minor_gc.h ../byterun/prims.h -parsing.d.o: parsing.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/mlvalues.h ../byterun/misc.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/alloc.h -printexc.d.o: printexc.c ../byterun/backtrace.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/callback.h ../byterun/debugger.h ../byterun/fail.h \ - ../byterun/printexc.h -roots.d.o: roots.c ../byterun/finalise.h ../byterun/roots.h \ - ../byterun/misc.h ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/mlvalues.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/globroots.h stack.h -signals.d.o: signals.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/callback.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/fail.h ../byterun/signals.h stack.h ../byterun/sys.h -startup.d.o: startup.c ../byterun/callback.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/gc.h \ - ../byterun/gc_ctrl.h ../byterun/osdeps.h ../byterun/printexc.h \ - ../byterun/sys.h -str.d.o: str.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h -sys.d.o: sys.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/alloc.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/debugger.h ../byterun/fail.h ../byterun/instruct.h \ - ../byterun/osdeps.h ../byterun/signals.h ../byterun/stacks.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/sys.h -terminfo.d.o: terminfo.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/alloc.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/fail.h ../byterun/io.h -unix.d.o: unix.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/mlvalues.h \ - ../byterun/misc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/osdeps.h -weak.d.o: weak.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h -alloc.p.o: alloc.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/custom.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/minor_gc.h ../byterun/stacks.h -array.p.o: array.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h -callback.p.o: callback.c ../byterun/callback.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/fail.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h -compact.p.o: compact.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/finalise.h ../byterun/roots.h ../byterun/misc.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/mlvalues.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/gc_ctrl.h ../byterun/weak.h -compare.p.o: compare.c ../byterun/custom.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/fail.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h -custom.p.o: custom.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h -dynlink.p.o: dynlink.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/alloc.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/dynlink.h ../byterun/fail.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/osdeps.h ../byterun/prims.h -extern.p.o: extern.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/gc.h \ - ../byterun/intext.h ../byterun/io.h ../byterun/memory.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/reverse.h -fail.p.o: fail.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/io.h ../byterun/gc.h ../byterun/memory.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/printexc.h ../byterun/signals.h stack.h ../byterun/roots.h -finalise.p.o: finalise.c ../byterun/callback.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/fail.h ../byterun/roots.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/signals.h -floats.p.o: floats.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/fail.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/reverse.h ../byterun/stacks.h -freelist.p.o: freelist.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/freelist.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/gc.h ../byterun/gc_ctrl.h ../byterun/major_gc.h -gc_ctrl.p.o: gc_ctrl.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/compact.h ../byterun/custom.h ../byterun/finalise.h \ - ../byterun/roots.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/gc_ctrl.h ../byterun/stacks.h -globroots.p.o: globroots.c ../byterun/memory.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/gc.h ../byterun/mlvalues.h \ - ../byterun/misc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/globroots.h -hash.p.o: hash.c ../byterun/mlvalues.h ../byterun/config.h ../config/m.h \ - ../config/s.h ../byterun/misc.h ../byterun/custom.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h -intern.p.o: intern.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/gc.h \ - ../byterun/intext.h ../byterun/io.h ../byterun/memory.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/reverse.h ../byterun/md5.h -ints.p.o: ints.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/custom.h \ - ../byterun/fail.h ../byterun/intext.h ../byterun/io.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/int64_native.h -io.p.o: io.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/alloc.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/io.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/signals.h \ - ../byterun/sys.h -lexing.p.o: lexing.c ../byterun/fail.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/stacks.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h -main.p.o: main.c ../byterun/misc.h ../byterun/config.h ../config/m.h \ - ../config/s.h ../byterun/mlvalues.h ../byterun/sys.h -major_gc.p.o: major_gc.c ../byterun/compact.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/misc.h ../byterun/custom.h \ - ../byterun/mlvalues.h ../byterun/fail.h ../byterun/finalise.h \ - ../byterun/roots.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/gc_ctrl.h ../byterun/weak.h -md5.p.o: md5.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/md5.h ../byterun/io.h ../byterun/reverse.h -memory.p.o: memory.c ../byterun/fail.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/freelist.h ../byterun/gc.h ../byterun/gc_ctrl.h \ - ../byterun/major_gc.h ../byterun/memory.h ../byterun/minor_gc.h \ - ../byterun/signals.h -meta.p.o: meta.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/fix_code.h ../byterun/interp.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/minor_gc.h ../byterun/prims.h ../byterun/stacks.h -minor_gc.p.o: minor_gc.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/fail.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/finalise.h ../byterun/roots.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/gc_ctrl.h ../byterun/signals.h -misc.p.o: misc.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/misc.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/mlvalues.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h -obj.p.o: obj.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/memory.h ../byterun/minor_gc.h ../byterun/prims.h -parsing.p.o: parsing.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/mlvalues.h ../byterun/misc.h ../byterun/memory.h \ - ../byterun/gc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/alloc.h -printexc.p.o: printexc.c ../byterun/backtrace.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/callback.h ../byterun/debugger.h ../byterun/fail.h \ - ../byterun/printexc.h -roots.p.o: roots.c ../byterun/finalise.h ../byterun/roots.h \ - ../byterun/misc.h ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/mlvalues.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/globroots.h stack.h -signals.p.o: signals.c ../byterun/alloc.h ../byterun/misc.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/mlvalues.h \ - ../byterun/callback.h ../byterun/memory.h ../byterun/gc.h \ - ../byterun/major_gc.h ../byterun/freelist.h ../byterun/minor_gc.h \ - ../byterun/fail.h ../byterun/signals.h stack.h ../byterun/sys.h -startup.p.o: startup.c ../byterun/callback.h ../byterun/mlvalues.h \ - ../byterun/config.h ../config/m.h ../config/s.h ../byterun/misc.h \ - ../byterun/custom.h ../byterun/fail.h ../byterun/gc.h \ - ../byterun/gc_ctrl.h ../byterun/osdeps.h ../byterun/printexc.h \ - ../byterun/sys.h -str.p.o: str.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h -sys.p.o: sys.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/alloc.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/debugger.h ../byterun/fail.h ../byterun/instruct.h \ - ../byterun/osdeps.h ../byterun/signals.h ../byterun/stacks.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h ../byterun/sys.h -terminfo.p.o: terminfo.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/alloc.h ../byterun/misc.h ../byterun/mlvalues.h \ - ../byterun/fail.h ../byterun/io.h -unix.p.o: unix.c ../byterun/config.h ../config/m.h ../config/s.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/mlvalues.h \ - ../byterun/misc.h ../byterun/major_gc.h ../byterun/freelist.h \ - ../byterun/minor_gc.h ../byterun/osdeps.h -weak.p.o: weak.c ../byterun/alloc.h ../byterun/misc.h ../byterun/config.h \ - ../config/m.h ../config/s.h ../byterun/mlvalues.h ../byterun/fail.h \ - ../byterun/memory.h ../byterun/gc.h ../byterun/major_gc.h \ - ../byterun/freelist.h ../byterun/minor_gc.h diff --git a/asmrun/Makefile b/asmrun/Makefile deleted file mode 100644 index ee94d50ed7..0000000000 --- a/asmrun/Makefile +++ /dev/null @@ -1,195 +0,0 @@ -######################################################################### -# # -# Objective Caml # -# # -# Xavier Leroy, projet Cristal, INRIA Rocquencourt # -# # -# Copyright 1999 Institut National de Recherche en Informatique et # -# en Automatique. All rights reserved. This file is distributed # -# under the terms of the GNU Library General Public License, with # -# the special exception on linking described in file ../LICENSE. # -# # -######################################################################### - -# $Id$ - -include ../config/Makefile - -CC=$(NATIVECC) -FLAGS=-I../byterun -DNATIVE_CODE -DTARGET_$(ARCH) -DSYS_$(SYSTEM) -CFLAGS=$(FLAGS) -O $(NATIVECCCOMPOPTS) -DFLAGS=$(FLAGS) -g -DDEBUG $(NATIVECCCOMPOPTS) -PFLAGS=$(FLAGS) -pg -O -DPROFILING $(NATIVECCPROFOPTS) - -COBJS=startup.o main.o fail.o roots.o globroots.o signals.o \ - misc.o freelist.o major_gc.o minor_gc.o memory.o alloc.o compare.o ints.o \ - floats.o str.o array.o io.o extern.o intern.o hash.o sys.o parsing.o \ - gc_ctrl.o terminfo.o md5.o obj.o lexing.o printexc.o callback.o weak.o \ - compact.o finalise.o custom.o unix.o - -ASMOBJS=$(ARCH).o - -OBJS=$(COBJS) $(ASMOBJS) -DOBJS=$(COBJS:.o=.d.o) $(ASMOBJS) -POBJS=$(COBJS:.o=.p.o) $(ASMOBJS:.o=.p.o) - -all: libasmrun.a all-$(PROFILING) - -libasmrun.a: $(OBJS) - rm -f libasmrun.a - ar rc libasmrun.a $(OBJS) - $(RANLIB) libasmrun.a - -libasmrund.a: $(DOBJS) - rm -f libasmrund.a - ar rc libasmrund.a $(DOBJS) - $(RANLIB) libasmrund.a - -all-noprof: - -all-prof: libasmrunp.a - -libasmrunp.a: $(POBJS) - rm -f libasmrunp.a - ar rc libasmrunp.a $(POBJS) - $(RANLIB) libasmrunp.a - -install: install-default install-$(PROFILING) - -install-default: - cp libasmrun.a $(LIBDIR)/libasmrun.a - cd $(LIBDIR); $(RANLIB) libasmrun.a - -install-noprof: - rm -f $(LIBDIR)/libasmrunp.a; ln -s libasmrun.a $(LIBDIR)/libasmrunp.a - -install-prof: - cp libasmrunp.a $(LIBDIR)/libasmrunp.a - cd $(LIBDIR); $(RANLIB) libasmrunp.a - -power.o: power-$(SYSTEM).o - cp power-$(SYSTEM).o power.o - -power.p.o: power-$(SYSTEM).o - cp power-$(SYSTEM).o power.p.o - -main.c: ../byterun/main.c - ln -s ../byterun/main.c main.c -misc.c: ../byterun/misc.c - ln -s ../byterun/misc.c misc.c -freelist.c: ../byterun/freelist.c - ln -s ../byterun/freelist.c freelist.c -major_gc.c: ../byterun/major_gc.c - ln -s ../byterun/major_gc.c major_gc.c -minor_gc.c: ../byterun/minor_gc.c - ln -s ../byterun/minor_gc.c minor_gc.c -memory.c: ../byterun/memory.c - ln -s ../byterun/memory.c memory.c -alloc.c: ../byterun/alloc.c - ln -s ../byterun/alloc.c alloc.c -array.c: ../byterun/array.c - ln -s ../byterun/array.c array.c -compare.c: ../byterun/compare.c - ln -s ../byterun/compare.c compare.c -ints.c: ../byterun/ints.c - ln -s ../byterun/ints.c ints.c -floats.c: ../byterun/floats.c - ln -s ../byterun/floats.c floats.c -str.c: ../byterun/str.c - ln -s ../byterun/str.c str.c -io.c: ../byterun/io.c - ln -s ../byterun/io.c io.c -extern.c: ../byterun/extern.c - ln -s ../byterun/extern.c extern.c -intern.c: ../byterun/intern.c - ln -s ../byterun/intern.c intern.c -hash.c: ../byterun/hash.c - ln -s ../byterun/hash.c hash.c -sys.c: ../byterun/sys.c - ln -s ../byterun/sys.c sys.c -parsing.c: ../byterun/parsing.c - ln -s ../byterun/parsing.c parsing.c -gc_ctrl.c: ../byterun/gc_ctrl.c - ln -s ../byterun/gc_ctrl.c gc_ctrl.c -terminfo.c: ../byterun/terminfo.c - ln -s ../byterun/terminfo.c terminfo.c -md5.c: ../byterun/md5.c - ln -s ../byterun/md5.c md5.c -obj.c: ../byterun/obj.c - ln -s ../byterun/obj.c obj.c -lexing.c: ../byterun/lexing.c - ln -s ../byterun/lexing.c lexing.c -printexc.c: ../byterun/printexc.c - ln -s ../byterun/printexc.c printexc.c -callback.c: ../byterun/callback.c - ln -s ../byterun/callback.c callback.c -weak.c: ../byterun/weak.c - ln -s ../byterun/weak.c weak.c -compact.c: ../byterun/compact.c - ln -s ../byterun/compact.c compact.c -finalise.c: ../byterun/finalise.c - ln -s ../byterun/finalise.c finalise.c -custom.c: ../byterun/custom.c - ln -s ../byterun/custom.c custom.c -meta.c: ../byterun/meta.c - ln -s ../byterun/meta.c meta.c -globroots.c: ../byterun/globroots.c - ln -s ../byterun/globroots.c globroots.c -unix.c: ../byterun/unix.c - ln -s ../byterun/unix.c unix.c -dynlink.c: ../byterun/dynlink.c - ln -s ../byterun/dynlink.c dynlink.c - -LINKEDFILES=misc.c freelist.c major_gc.c minor_gc.c memory.c alloc.c array.c \ - compare.c ints.c floats.c str.c io.c extern.c intern.c hash.c sys.c \ - parsing.c gc_ctrl.c terminfo.c md5.c obj.c lexing.c printexc.c callback.c \ - weak.c compact.c finalise.c meta.c custom.c main.c globroots.c unix.c \ - dynlink.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: - $(ASPP) $(ASPPFLAGS) -o $*.o $*.S || \ - { echo "If your assembler produced syntax errors, it is probably unhappy with the"; echo "preprocessor. Check your assembler, or try producing $*.o by hand."; exit 2; } - -.S.p.o: - $(ASPP) $(ASPPFLAGS) $(ASPPPROFFLAGS) -o $*.p.o $*.S - -.c.d.o: - @ if test -f $*.o; then mv $*.o $*.f.o; else :; fi - $(CC) -c $(DFLAGS) $< - mv $*.o $*.d.o - @ if test -f $*.f.o; then mv $*.f.o $*.o; else :; fi - -.c.p.o: - @ if test -f $*.o; then mv $*.o $*.f.o; else :; fi - $(CC) -c $(PFLAGS) $< - mv $*.o $*.p.o - @ if test -f $*.f.o; then mv $*.f.o $*.o; else :; fi - -.s.o: - $(ASPP) $(ASPPFLAGS) -o $*.o $*.s - -.s.p.o: - $(ASPP) $(ASPPFLAGS) $(ASPPPROFFLAGS) -o $*.p.o $*.s - -clean:: - rm -f *.o *.a *~ - -depend: $(COBJS:.o=.c) ${LINKEDFILES} - gcc -MM $(FLAGS) *.c > .depend - gcc -MM $(FLAGS) -DDEBUG *.c | sed -e 's/\.o/.d.o/' >> .depend - gcc -MM $(FLAGS) -DDEBUG *.c | sed -e 's/\.o/.p.o/' >> .depend - -include .depend - diff --git a/asmrun/Makefile.nt b/asmrun/Makefile.nt deleted file mode 100644 index d505b25a96..0000000000 --- a/asmrun/Makefile.nt +++ /dev/null @@ -1,77 +0,0 @@ -######################################################################### -# # -# Objective Caml # -# # -# Xavier Leroy, projet Cristal, INRIA Rocquencourt # -# # -# Copyright 1999 Institut National de Recherche en Informatique et # -# en Automatique. All rights reserved. This file is distributed # -# under the terms of the GNU Library General Public License, with # -# the special exception on linking described in file ../LICENSE. # -# # -######################################################################### - -# $Id$ - -include ../config/Makefile - -CC=$(NATIVECC) -CFLAGS=-I../byterun -DNATIVE_CODE -DTARGET_$(ARCH) -DSYS_$(SYSTEM) $(NATIVECCCOMPOPTS) - -COBJS=startup.$(O) main.$(O) fail.$(O) roots.$(O) signals.$(O) \ - misc.$(O) freelist.$(O) major_gc.$(O) minor_gc.$(O) memory.$(O) alloc.$(O) \ - compare.$(O) ints.$(O) floats.$(O) str.$(O) array.$(O) io.$(O) extern.$(O) \ - intern.$(O) hash.$(O) sys.$(O) parsing.$(O) gc_ctrl.$(O) terminfo.$(O) \ - md5.$(O) obj.$(O) lexing.$(O) win32.$(O) printexc.$(O) callback.$(O) \ - weak.$(O) compact.$(O) finalise.$(O) custom.$(O) globroots.$(O) - -LINKEDFILES=misc.c freelist.c major_gc.c minor_gc.c memory.c alloc.c array.c \ - compare.c ints.c floats.c str.c io.c extern.c intern.c hash.c sys.c \ - parsing.c gc_ctrl.c terminfo.c md5.c obj.c lexing.c printexc.c callback.c \ - weak.c compact.c meta.c finalise.c custom.c main.c globroots.c \ - dynlink.c - -ifeq ($(TOOLCHAIN),mingw) -ASMOBJS=i386.o -else -ASMOBJS=i386nt.obj -endif - -OBJS=$(COBJS) $(ASMOBJS) - -all: libasmrun.$(A) - -libasmrun.$(A): $(OBJS) - $(call MKLIB,libasmrun.$(A), $(OBJS)) - -i386nt.obj: i386nt.asm - ml /nologo /coff /Cp /c /Foi386nt.obj i386nt.asm - -i386.o: i386.S - $(CC) -c -DSYS_$(SYSTEM) i386.S - -install: - cp libasmrun.$(A) $(LIBDIR) - -$(LINKEDFILES): %.c: ../byterun/%.c - cp ../byterun/$*.c $*.c - -# Need special compilation rule so as not to do -I../byterun -win32.$(O): ../byterun/win32.c - $(CC) -c $(NATIVECCCOMPOPTS) -DNATIVE_CODE ../byterun/win32.c - -.SUFFIXES: .c .$(O) - -.c.$(O): - $(CC) $(CFLAGS) -c $< - -clean:: - rm -f $(LINKEDFILES) - -clean:: - rm -f *.$(O) *.$(A) *~ - -.depend.nt: - sed -e 's/\.o/.$(O)/g' .depend > .depend.nt - -include .depend.nt diff --git a/asmrun/alpha.S b/asmrun/alpha.S deleted file mode 100644 index 99c71dd8d6..0000000000 --- a/asmrun/alpha.S +++ /dev/null @@ -1,440 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -/* Asm part of the runtime system, Alpha processor */ - -/* Allocation */ - - .text - .globl caml_alloc2 - .globl caml_alloc3 - .globl caml_alloc - .globl caml_call_gc - -/* Note: the profiling code sets $27 to the address of the "normal" entrypoint. - So don't pass parameters to those routines in $27. */ - -/* caml_alloc* : all code generator registers preserved, - $gp preserved, $27 not necessarily valid on entry */ - - .globl caml_alloc1 - .ent caml_alloc1 - .align 3 -caml_alloc1: - .prologue 0 - subq $13, 16, $13 - cmpult $13, $14, $25 - bne $25, $100 - ret ($26) -$100: ldiq $25, 16 - br $110 - .end caml_alloc1 - - .globl caml_alloc2 - .ent caml_alloc2 - .align 3 -caml_alloc2: - .prologue 0 - subq $13, 24, $13 - cmpult $13, $14, $25 - bne $25, $101 - ret ($26) -$101: ldiq $25, 24 - br $110 - .end caml_alloc2 - - .globl caml_alloc3 - .ent caml_alloc3 - .align 3 -caml_alloc3: - .prologue 0 - subq $13, 32, $13 - cmpult $13, $14, $25 - bne $25, $102 - ret ($26) -$102: ldiq $25, 32 - br $110 - .end caml_alloc3 - - .globl caml_alloc - .ent caml_alloc - .align 3 -caml_alloc: - .prologue 0 - subq $13, $25, $13 - .set noat - cmpult $13, $14, $at - bne $at, $110 - .set at - ret ($26) - .end caml_alloc - - .globl caml_call_gc - .ent caml_call_gc - .align 3 -caml_call_gc: - .prologue 0 - ldiq $25, 0 -$110: lda $sp, -0x200($sp) - /* 0x200 = 32*8 (ints) + 32*8 (floats) */ - stq $26, 0x1F8($sp) /* return address */ - stq $gp, 0x1F0($sp) /* caller's $gp */ - stq $25, 0x1E8($sp) /* desired size */ - /* Rebuild $gp */ - br $27, $103 -$103: ldgp $gp, 0($27) - /* Record lowest stack address, return address, GC regs */ - stq $26, caml_last_return_address - lda $24, 0x200($sp) - stq $24, caml_bottom_of_stack - lda $24, 0x100($sp) - stq $24, caml_gc_regs - /* Save current allocation pointer for debugging purposes */ -$113: stq $13, young_ptr - /* Save trap pointer in case an exception is raised (e.g. sighandler) */ - stq $15, caml_exception_pointer - /* Save all integer regs used by the code generator in the context */ - stq $0, 0 * 8 ($24) - stq $1, 1 * 8 ($24) - stq $2, 2 * 8 ($24) - stq $3, 3 * 8 ($24) - stq $4, 4 * 8 ($24) - stq $5, 5 * 8 ($24) - stq $6, 6 * 8 ($24) - stq $7, 7 * 8 ($24) - stq $8, 8 * 8 ($24) - stq $9, 9 * 8 ($24) - stq $10, 10 * 8 ($24) - stq $11, 11 * 8 ($24) - stq $12, 12 * 8 ($24) - stq $16, 16 * 8 ($24) - stq $17, 17 * 8 ($24) - stq $18, 18 * 8 ($24) - stq $19, 19 * 8 ($24) - stq $20, 20 * 8 ($24) - stq $21, 21 * 8 ($24) - stq $22, 22 * 8 ($24) - /* Save all float regs that are not callee-save on the stack */ - stt $f0, 0 * 8 ($sp) - stt $f1, 1 * 8 ($sp) - stt $f10, 10 * 8 ($sp) - stt $f11, 11 * 8 ($sp) - stt $f12, 12 * 8 ($sp) - stt $f13, 13 * 8 ($sp) - stt $f14, 14 * 8 ($sp) - stt $f15, 15 * 8 ($sp) - stt $f16, 16 * 8 ($sp) - stt $f17, 17 * 8 ($sp) - stt $f18, 18 * 8 ($sp) - stt $f19, 19 * 8 ($sp) - stt $f20, 20 * 8 ($sp) - stt $f21, 21 * 8 ($sp) - stt $f22, 22 * 8 ($sp) - stt $f23, 23 * 8 ($sp) - stt $f24, 24 * 8 ($sp) - stt $f25, 25 * 8 ($sp) - stt $f26, 26 * 8 ($sp) - stt $f27, 27 * 8 ($sp) - stt $f29, 29 * 8 ($sp) - stt $f30, 30 * 8 ($sp) - /* Call the garbage collector */ - jsr garbage_collection - ldgp $gp, 0($26) - /* Restore all regs used by the code generator */ - lda $24, 0x100($sp) - ldq $0, 0 * 8 ($24) - ldq $1, 1 * 8 ($24) - ldq $2, 2 * 8 ($24) - ldq $3, 3 * 8 ($24) - ldq $4, 4 * 8 ($24) - ldq $5, 5 * 8 ($24) - ldq $6, 6 * 8 ($24) - ldq $7, 7 * 8 ($24) - ldq $8, 8 * 8 ($24) - ldq $9, 9 * 8 ($24) - ldq $10, 10 * 8 ($24) - ldq $11, 11 * 8 ($24) - ldq $12, 12 * 8 ($24) - ldq $16, 16 * 8 ($24) - ldq $17, 17 * 8 ($24) - ldq $18, 18 * 8 ($24) - ldq $19, 19 * 8 ($24) - ldq $20, 20 * 8 ($24) - ldq $21, 21 * 8 ($24) - ldq $22, 22 * 8 ($24) - ldt $f0, 0 * 8 ($sp) - ldt $f1, 1 * 8 ($sp) - ldt $f10, 10 * 8 ($sp) - ldt $f11, 11 * 8 ($sp) - ldt $f12, 12 * 8 ($sp) - ldt $f13, 13 * 8 ($sp) - ldt $f14, 14 * 8 ($sp) - ldt $f15, 15 * 8 ($sp) - ldt $f16, 16 * 8 ($sp) - ldt $f17, 17 * 8 ($sp) - ldt $f18, 18 * 8 ($sp) - ldt $f19, 19 * 8 ($sp) - ldt $f20, 20 * 8 ($sp) - ldt $f21, 21 * 8 ($sp) - ldt $f22, 22 * 8 ($sp) - ldt $f23, 23 * 8 ($sp) - ldt $f24, 24 * 8 ($sp) - ldt $f25, 25 * 8 ($sp) - ldt $f26, 26 * 8 ($sp) - ldt $f27, 27 * 8 ($sp) - ldt $f29, 29 * 8 ($sp) - ldt $f30, 30 * 8 ($sp) - /* Reload new allocation pointer and allocation limit */ - ldq $13, young_ptr - ldq $14, young_limit - /* Allocate space for the block */ - ldq $25, 0x1E8($sp) - subq $13, $25, $13 - cmpult $13, $14, $25 /* Check that we have enough free space */ - bne $25, $113 /* If not, call GC again */ - /* Say that we are back into Caml code */ - stq $31, caml_last_return_address - /* Return to caller */ - ldq $26, 0x1F8($sp) - ldq $gp, 0x1F0($sp) - lda $sp, 0x200($sp) - ret ($26) - - .end caml_call_gc - -/* Call a C function from Caml */ -/* Function to call is in $25 */ - - .globl caml_c_call - .ent caml_c_call - .align 3 -caml_c_call: - .prologue 0 - /* Preserve return address and caller's $gp in callee-save registers */ - mov $26, $9 - mov $gp, $10 - /* Rebuild $gp */ - br $27, $104 -$104: ldgp $gp, 0($27) - /* Record lowest stack address and return address */ - lda $11, caml_last_return_address - stq $26, 0($11) - stq $sp, caml_bottom_of_stack - /* Make the exception handler and alloc ptr available to the C code */ - lda $12, young_ptr - stq $13, 0($12) - lda $14, young_limit - stq $15, caml_exception_pointer - /* Call the function */ - mov $25, $27 - jsr ($25) - /* Reload alloc ptr and alloc limit */ - ldq $13, 0($12) /* $12 still points to young_ptr */ - ldq $14, 0($14) /* $14 still points to young_limit */ - /* Say that we are back into Caml code */ - stq $31, 0($11) /* $11 still points to caml_last_return_address */ - /* Restore $gp */ - mov $10, $gp - /* Return */ - ret ($9) - - .end caml_c_call - -/* Start the Caml program */ - - .globl caml_start_program - .ent caml_start_program - .align 3 -caml_start_program: - ldgp $gp, 0($27) - lda $25, caml_program - -/* Code shared with callback* */ -$107: - /* Save return address */ - lda $sp, -128($sp) - stq $26, 0($sp) - /* Save all callee-save registers */ - stq $9, 8($sp) - stq $10, 16($sp) - stq $11, 24($sp) - stq $12, 32($sp) - stq $13, 40($sp) - stq $14, 48($sp) - stq $15, 56($sp) - stt $f2, 64($sp) - stt $f3, 72($sp) - stt $f4, 80($sp) - stt $f5, 88($sp) - stt $f6, 96($sp) - stt $f7, 104($sp) - stt $f8, 112($sp) - stt $f9, 120($sp) - /* Set up a callback link on the stack. */ - lda $sp, -32($sp) - ldq $0, caml_bottom_of_stack - stq $0, 0($sp) - ldq $1, caml_last_return_address - stq $1, 8($sp) - ldq $1, caml_gc_regs - stq $1, 16($sp) - /* Set up a trap frame to catch exceptions escaping the Caml code */ - lda $sp, -16($sp) - ldq $15, caml_exception_pointer - stq $15, 0($sp) - lda $0, $109 - stq $0, 8($sp) - mov $sp, $15 - /* Reload allocation pointers */ - ldq $13, young_ptr - ldq $14, young_limit - /* We are back into Caml code */ - stq $31, caml_last_return_address - /* Call the Caml code */ - mov $25, $27 -$108: jsr ($25) - /* Reload $gp, masking off low bit in retaddr (might have been marked) */ - bic $26, 1, $26 - ldgp $gp, 4($26) - /* Pop the trap frame, restoring caml_exception_pointer */ - ldq $15, 0($sp) - stq $15, caml_exception_pointer - lda $sp, 16($sp) - /* Pop the callback link, restoring the global variables */ -$112: ldq $24, 0($sp) - stq $24, caml_bottom_of_stack - ldq $25, 8($sp) - stq $25, caml_last_return_address - ldq $24, 16($sp) - stq $24, caml_gc_regs - lda $sp, 32($sp) - /* Update allocation pointer */ - stq $13, young_ptr - /* Reload callee-save registers */ - ldq $9, 8($sp) - ldq $10, 16($sp) - ldq $11, 24($sp) - ldq $12, 32($sp) - ldq $13, 40($sp) - ldq $14, 48($sp) - ldq $15, 56($sp) - ldt $f2, 64($sp) - ldt $f3, 72($sp) - ldt $f4, 80($sp) - ldt $f5, 88($sp) - ldt $f6, 96($sp) - ldt $f7, 104($sp) - ldt $f8, 112($sp) - ldt $f9, 120($sp) - /* Return to caller */ - ldq $26, 0($sp) - lda $sp, 128($sp) - ret ($26) - - /* The trap handler */ -$109: ldgp $gp, 0($26) - /* Save exception pointer */ - stq $15, caml_exception_pointer - /* Encode exception bucket as an exception result */ - or $0, 2, $0 - /* Return it */ - br $112 - - .end caml_start_program - -/* Raise an exception from C */ - - .globl raise_caml_exception - .ent raise_caml_exception - .align 3 -raise_caml_exception: - ldgp $gp, 0($27) - mov $16, $0 /* Move exn bucket */ - ldq $13, young_ptr - ldq $14, young_limit - stq $31, caml_last_return_address /* We're back into Caml */ - ldq $sp, caml_exception_pointer - ldq $15, 0($sp) - ldq $26, 8($sp) - lda $sp, 16($sp) - jmp $25, ($26) /* Keep retaddr in $25 to help debugging */ - .end raise_caml_exception - -/* Callback from C to Caml */ - - .globl callback_exn - .ent callback_exn - .align 3 -callback_exn: - /* Initial shuffling of arguments */ - ldgp $gp, 0($27) - mov $16, $25 - mov $17, $16 /* first arg */ - mov $25, $17 /* environment */ - ldq $25, 0($25) /* code pointer */ - br $107 - .end callback_exn - - .globl callback2_exn - .ent callback2_exn - .align 3 -callback2_exn: - ldgp $gp, 0($27) - mov $16, $25 - mov $17, $16 /* first arg */ - mov $18, $17 /* second arg */ - mov $25, $18 /* environment */ - lda $25, caml_apply2 - br $107 - .end callback2_exn - - .globl callback3_exn - .ent callback3_exn - .align 3 -callback3_exn: - ldgp $gp, 0($27) - mov $16, $25 - mov $17, $16 /* first arg */ - mov $18, $17 /* second arg */ - mov $19, $18 /* third arg */ - mov $25, $19 /* environment */ - lda $25, caml_apply3 - br $107 - .end callback3_exn - -/* Glue code to call array_bound_error */ - - .globl caml_array_bound_error - .ent caml_array_bound_error - .align 3 -caml_array_bound_error: - br $27, $111 -$111: ldgp $gp, 0($27) - lda $25, array_bound_error - br caml_c_call /* never returns */ - .end caml_array_bound_error - -#if defined(SYS_digital) - .rdata -#else - .section .rodata -#endif - .globl system__frametable -system__frametable: - .quad 1 /* one descriptor */ - .quad $108 + 4 /* return address into callback */ - .word -1 /* negative frame size => use callback link */ - .word 0 /* no roots here */ - .align 3 diff --git a/asmrun/amd64.S b/asmrun/amd64.S deleted file mode 100644 index 8168ee7dfa..0000000000 --- a/asmrun/amd64.S +++ /dev/null @@ -1,335 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 2003 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -/* Asm part of the runtime system, AMD64 processor */ -/* Must be preprocessed by cpp */ - -#define FUNCTION_ALIGN 4 - -#define FUNCTION(name) \ - .globl name; \ - .type name,@function; \ - .align FUNCTION_ALIGN; \ - name: - - .text - -/* Allocation */ - -FUNCTION(caml_call_gc) - /* Record lowest stack address and return address */ - movq 0(%rsp), %rax - movq %rax, caml_last_return_address(%rip) - leaq 8(%rsp), %rax - movq %rax, caml_bottom_of_stack(%rip) - /* Save young_ptr, caml_exception_pointer */ - movq %r15, 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 - pushq %r11 - pushq %r10 - pushq %r9 - pushq %r8 - pushq %rcx - pushq %rdx - pushq %rsi - pushq %rdi - pushq %rbx - pushq %rax - movq %rsp, caml_gc_regs - /* Save floating-point registers */ - subq $(16*8), %rsp - movlpd %xmm0, 0*8(%rsp) - movlpd %xmm1, 1*8(%rsp) - movlpd %xmm2, 2*8(%rsp) - movlpd %xmm3, 3*8(%rsp) - movlpd %xmm4, 4*8(%rsp) - movlpd %xmm5, 5*8(%rsp) - movlpd %xmm6, 6*8(%rsp) - movlpd %xmm7, 7*8(%rsp) - movlpd %xmm8, 8*8(%rsp) - movlpd %xmm9, 9*8(%rsp) - movlpd %xmm10, 10*8(%rsp) - movlpd %xmm11, 11*8(%rsp) - movlpd %xmm12, 12*8(%rsp) - movlpd %xmm13, 13*8(%rsp) - movlpd %xmm14, 14*8(%rsp) - movlpd %xmm15, 15*8(%rsp) - /* Call the garbage collector */ - call garbage_collection - /* Restore all regs used by the code generator */ - movlpd 0*8(%rsp), %xmm0 - movlpd 1*8(%rsp), %xmm1 - movlpd 2*8(%rsp), %xmm2 - movlpd 3*8(%rsp), %xmm3 - movlpd 4*8(%rsp), %xmm4 - movlpd 5*8(%rsp), %xmm5 - movlpd 6*8(%rsp), %xmm6 - movlpd 7*8(%rsp), %xmm7 - movlpd 8*8(%rsp), %xmm8 - movlpd 9*8(%rsp), %xmm9 - movlpd 10*8(%rsp), %xmm10 - movlpd 11*8(%rsp), %xmm11 - movlpd 12*8(%rsp), %xmm12 - movlpd 13*8(%rsp), %xmm13 - movlpd 14*8(%rsp), %xmm14 - movlpd 15*8(%rsp), %xmm15 - addq $(16*8), %rsp - popq %rax - popq %rbx - popq %rdi - popq %rsi - popq %rdx - popq %rcx - popq %r8 - popq %r9 - popq %r10 - popq %r11 - popq %rbp - popq %r12 - popq %r13 - /* Restore young_ptr, caml_exception_pointer */ - movq young_ptr(%rip), %r15 - movq caml_exception_pointer(%rip), %r14 - /* Return to caller */ - ret - -FUNCTION(caml_alloc1) - subq $16, %r15 - cmpq young_limit(%rip), %r15 - jb .L100 - ret -.L100: - movq 0(%rsp), %rax - movq %rax, caml_last_return_address(%rip) - leaq 8(%rsp), %rax - movq %rax, caml_bottom_of_stack(%rip) - subq $8, %rsp - call .L105 - addq $8, %rsp - jmp caml_alloc1 - -FUNCTION(caml_alloc2) - subq $24, %r15 - cmpq young_limit(%rip), %r15 - jb .L101 - ret -.L101: - movq 0(%rsp), %rax - movq %rax, caml_last_return_address(%rip) - leaq 8(%rsp), %rax - movq %rax, caml_bottom_of_stack(%rip) - subq $8, %rsp - call .L105 - addq $8, %rsp - jmp caml_alloc2 - -FUNCTION(caml_alloc3) - subq $32, %r15 - cmpq young_limit(%rip), %r15 - jb .L102 - ret -.L102: - movq 0(%rsp), %rax - movq %rax, caml_last_return_address(%rip) - leaq 8(%rsp), %rax - movq %rax, caml_bottom_of_stack(%rip) - subq $8, %rsp - call .L105 - addq $8, %rsp - jmp caml_alloc3 - -FUNCTION(caml_alloc) - subq %rax, %r15 - cmpq young_limit(%rip), %r15 - jb .L103 - ret -.L103: - pushq %rax /* save desired size */ - movq 8(%rsp), %rax - movq %rax, caml_last_return_address(%rip) - leaq 16(%rsp), %rax - movq %rax, caml_bottom_of_stack(%rip) - call .L105 - popq %rax /* recover desired size */ - jmp caml_alloc - -/* Call a C function from Caml */ - -FUNCTION(caml_c_call) - /* Record lowest stack address and return address */ - popq %r12 - movq %r12, caml_last_return_address(%rip) - movq %rsp, caml_bottom_of_stack(%rip) - /* Make the exception handler and alloc ptr available to the C code */ - movq %r15, young_ptr(%rip) - movq %r14, caml_exception_pointer(%rip) - /* Call the function (address in %rax) */ - call *%rax - /* Reload alloc ptr */ - movq young_ptr(%rip), %r15 - /* Return to caller */ - pushq %r12 - ret - -/* Start the Caml program */ - -FUNCTION(caml_start_program) - /* Save callee-save registers */ - pushq %rbx - pushq %rbp - pushq %r12 - pushq %r13 - pushq %r14 - pushq %r15 - subq $8, %rsp /* stack 16-aligned */ - /* Initial entry point is caml_program */ - leaq caml_program(%rip), %r12 - /* Common code for caml_start_program and callback* */ -.L106: - /* Build a callback link */ - subq $8, %rsp /* stack 16-aligned */ - pushq caml_gc_regs(%rip) - pushq caml_last_return_address(%rip) - pushq caml_bottom_of_stack(%rip) - /* Setup alloc ptr and exception ptr */ - movq young_ptr(%rip), %r15 - movq caml_exception_pointer(%rip), %r14 - /* Build an exception handler */ - lea .L108(%rip), %r13 - pushq %r13 - pushq %r14 - movq %rsp, %r14 - /* Call the Caml code */ - call *%r12 -.L107: - /* Pop the exception handler */ - popq %r14 - popq %r12 /* dummy register */ -.L109: - /* Update alloc ptr and exception ptr */ - movq %r15, young_ptr(%rip) - movq %r14, caml_exception_pointer(%rip) - /* Pop the callback link, restoring the global variables */ - popq caml_bottom_of_stack(%rip) - popq caml_last_return_address(%rip) - popq caml_gc_regs(%rip) - addq $8, %rsp - /* Restore callee-save registers. */ - addq $8, %rsp - popq %r15 - popq %r14 - popq %r13 - popq %r12 - popq %rbp - popq %rbx - /* Return to caller. */ - ret -.L108: - /* Exception handler*/ - /* Mark the bucket as an exception result and return it */ - orq $2, %rax - jmp .L109 - -/* Raise an exception from C */ - -FUNCTION(raise_caml_exception) - movq %rdi, %rax - movq caml_exception_pointer(%rip), %rsp - popq caml_exception_pointer(%rip) - ret - -/* Callback from C to Caml */ - -FUNCTION(callback_exn) - /* Save callee-save registers */ - pushq %rbx - pushq %rbp - pushq %r12 - pushq %r13 - pushq %r14 - pushq %r15 - subq $8, %rsp /* stack 16-aligned */ - /* Initial loading of arguments */ - movq %rdi, %rbx /* closure */ - movq %rsi, %rax /* argument */ - movq 0(%rbx), %r12 /* code pointer */ - jmp .L106 - -FUNCTION(callback2_exn) - /* Save callee-save registers */ - pushq %rbx - pushq %rbp - pushq %r12 - pushq %r13 - pushq %r14 - pushq %r15 - subq $8, %rsp /* stack 16-aligned */ - /* Initial loading of arguments */ - /* closure stays in %rdi */ - movq %rsi, %rax /* first argument */ - movq %rdx, %rbx /* second argument */ - leaq caml_apply2(%rip), %r12 /* code pointer */ - jmp .L106 - -FUNCTION(callback3_exn) - /* Save callee-save registers */ - pushq %rbx - pushq %rbp - pushq %r12 - pushq %r13 - pushq %r14 - pushq %r15 - subq $8, %rsp /* stack 16-aligned */ - /* Initial loading of arguments */ - movq %rsi, %rax /* first argument */ - movq %rdx, %rbx /* second argument */ - movq %rdi, %rsi /* closure */ - movq %rcx, %rdi /* third argument */ - leaq caml_apply3(%rip), %r12 /* code pointer */ - jmp .L106 - -FUNCTION(caml_array_bound_error) - /* Make the exception handler and alloc ptr available to the C code */ - movq %r15, young_ptr(%rip) - movq %r14, caml_exception_pointer(%rip) - jmp array_bound_error - - .data - .globl system__frametable - .type system__frametable,@object - .align 8 -system__frametable: - .quad 1 /* one descriptor */ - .quad .L107 /* return address into callback */ - .value -1 /* negative frame size => use callback link */ - .value 0 /* no roots here */ - .align 8 - - .section .rodata.cst8,"aM",@progbits,8 - .globl caml_negf_mask - .type caml_negf_mask,@object - .align 16 -caml_negf_mask: - .quad 0x8000000000000000, 0 - .globl caml_absf_mask - .type caml_absf_mask,@object - .align 16 -caml_absf_mask: - .quad 0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF diff --git a/asmrun/arm.S b/asmrun/arm.S deleted file mode 100644 index c465636b5d..0000000000 --- a/asmrun/arm.S +++ /dev/null @@ -1,339 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1998 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -/* Asm part of the runtime system, ARM processor */ - -trap_ptr .req r11 -alloc_ptr .req r8 -alloc_limit .req r9 -sp .req r13 -lr .req r14 -pc .req r15 - - .text - -/* Allocation functions and GC interface */ - - .global caml_call_gc -caml_call_gc: - /* Record return address */ - /* We can use r10 as a temp reg since it's not live here */ - ldr r10, .Lcaml_last_return_address - str lr, [r10, #0] - /* Branch to shared GC code */ - bl .Linvoke_gc - /* Restart allocation sequence (4 instructions before) */ - sub lr, lr, #16 - mov pc, lr - - .global caml_alloc1 -caml_alloc1: - ldr r10, [alloc_limit, #0] - sub alloc_ptr, alloc_ptr, #8 - cmp alloc_ptr, r10 - movcs pc, lr /* Return if alloc_ptr >= alloc_limit */ - /* Record return address */ - ldr r10, .Lcaml_last_return_address - str lr, [r10, #0] - /* Invoke GC */ - bl .Linvoke_gc - /* Try again */ - b caml_alloc1 - - .global caml_alloc2 -caml_alloc2: - ldr r10, [alloc_limit, #0] - sub alloc_ptr, alloc_ptr, #12 - cmp alloc_ptr, r10 - movcs pc, lr /* Return if alloc_ptr >= alloc_limit */ - /* Record return address */ - ldr r10, .Lcaml_last_return_address - str lr, [r10, #0] - /* Invoke GC */ - bl .Linvoke_gc - /* Try again */ - b caml_alloc2 - - .global caml_alloc3 -caml_alloc3: - ldr r10, [alloc_limit, #0] - sub alloc_ptr, alloc_ptr, #16 - cmp alloc_ptr, r10 - movcs pc, lr /* Return if alloc_ptr >= alloc_limit */ - /* Record return address */ - ldr r10, .Lcaml_last_return_address - str lr, [r10, #0] - /* Invoke GC */ - bl .Linvoke_gc - /* Try again */ - b caml_alloc3 - - .global caml_alloc -caml_alloc: - str r12, [sp, #-4]! - ldr r12, [alloc_limit, #0] - sub alloc_ptr, alloc_ptr, r10 - cmp alloc_ptr, r12 - ldr r12, [sp], #4 - movcs pc, lr /* Return if alloc_ptr >= alloc_limit */ - /* Record return address and desired size */ - ldr alloc_limit, .Lcaml_last_return_address - str lr, [alloc_limit, #0] - str r10, .Lcaml_requested_size - /* Invoke GC */ - bl .Linvoke_gc - /* Try again */ - ldr r10, .Lcaml_requested_size - b caml_alloc - -/* Shared code to invoke the GC */ -.Linvoke_gc: - /* Record lowest stack address */ - ldr r10, .Lcaml_bottom_of_stack - str sp, [r10, #0] - /* Save integer registers and return address on stack */ - stmfd sp!, {r0,r1,r2,r3,r4,r5,r6,r7,r10,r12,lr} - /* Store pointer to saved integer registers in caml_gc_regs */ - ldr r10, .Lcaml_gc_regs - str sp, [r10, #0] - /* Save non-callee-save float registers */ - stfd f0, [sp, #-8]! - stfd f1, [sp, #-8]! - stfd f2, [sp, #-8]! - stfd f3, [sp, #-8]! - /* Save current allocation pointer for debugging purposes */ - ldr r10, .Lyoung_ptr - str alloc_ptr, [r10, #0] - /* Save trap pointer in case an exception is raised during GC */ - ldr r10, .Lcaml_exception_pointer - str trap_ptr, [r10, #0] - /* Call the garbage collector */ - bl garbage_collection - /* Restore the registers from the stack */ - ldfd f4, [sp], #8 - ldfd f5, [sp], #8 - ldfd f6, [sp], #8 - ldfd f7, [sp], #8 - ldmfd sp!, {r0,r1,r2,r3,r4,r5,r6,r7,r10,r12} - /* Reload return address */ - ldr r10, .Lcaml_last_return_address - ldr lr, [r10, #0] - /* Say that we are back into Caml code */ - mov alloc_ptr, #0 - str alloc_ptr, [r10, #0] - /* Reload new allocation pointer and allocation limit */ - ldr r10, .Lyoung_ptr - ldr alloc_ptr, [r10, #0] - ldr alloc_limit, .Lyoung_limit - /* Return to caller */ - ldmfd sp!, {pc} - -/* Call a C function from Caml */ -/* Function to call is in r10 */ - - .global caml_c_call -caml_c_call: - /* Preserve return address in callee-save register r4 */ - mov r4, lr - /* Record lowest stack address and return address */ - ldr r5, .Lcaml_last_return_address - ldr r6, .Lcaml_bottom_of_stack - str lr, [r5, #0] - str sp, [r6, #0] - /* Make the exception handler and alloc ptr available to the C code */ - ldr r6, .Lyoung_ptr - ldr r7, .Lcaml_exception_pointer - str alloc_ptr, [r6, #0] - str trap_ptr, [r7, #0] - /* Call the function */ - mov lr, pc - mov pc, r10 - /* Reload alloc ptr */ - ldr alloc_ptr, [r6, #0] /* r6 still points to young_ptr */ - /* Say that we are back into Caml code */ - mov r6, #0 - str r6, [r5, #0] /* r5 still points to caml_last_return_address */ - /* Return */ - mov pc, r4 - -/* Start the Caml program */ - - .global caml_start_program -caml_start_program: - ldr r10, .Lcaml_program - -/* Code shared with callback* */ -/* Address of Caml code to call is in r10 */ -/* Arguments to the Caml code are in r0...r3 */ - -.Ljump_to_caml: - /* Save return address and callee-save registers */ - stmfd sp!, {r4,r5,r6,r7,r8,r9,r11,lr} - stfd f7, [sp, #-8]! - stfd f6, [sp, #-8]! - stfd f5, [sp, #-8]! - stfd f4, [sp, #-8]! - /* Setup a callback link on the stack */ - sub sp, sp, #4*3 - ldr r4, .Lcaml_bottom_of_stack - ldr r4, [r4, #0] - str r4, [sp, #0] - ldr r4, .Lcaml_last_return_address - ldr r4, [r4, #0] - str r4, [sp, #4] - ldr r4, .Lcaml_gc_regs - ldr r4, [r4, #0] - str r4, [sp, #8] - /* Setup a trap frame to catch exceptions escaping the Caml code */ - sub sp, sp, #4*2 - ldr r4, .Lcaml_exception_pointer - ldr r4, [r4, #0] - str r4, [sp, #0] - ldr r4, .LLtrap_handler - str r4, [sp, #4] - mov trap_ptr, sp - /* Reload allocation pointers */ - ldr r4, .Lyoung_ptr - ldr alloc_ptr, [r4, #0] - ldr alloc_limit, .Lyoung_limit - /* We are back into Caml code */ - ldr r4, .Lcaml_last_return_address - mov r5, #0 - str r5, [r4, #0] - /* Call the Caml code */ - mov lr, pc - mov pc, r10 -.Lcaml_retaddr: - /* Pop the trap frame, restoring caml_exception_pointer */ - ldr r4, .Lcaml_exception_pointer - ldr r5, [sp, #0] - str r5, [r4, #0] - add sp, sp, #2 * 4 - /* Pop the callback link, restoring the global variables */ -.Lreturn_result: - ldr r4, .Lcaml_bottom_of_stack - ldr r5, [sp, #0] - str r5, [r4, #0] - ldr r4, .Lcaml_last_return_address - ldr r5, [sp, #4] - str r5, [r4, #0] - ldr r4, .Lcaml_gc_regs - ldr r5, [sp, #8] - str r5, [r4, #0] - add sp, sp, #4*3 - /* Update allocation pointer */ - ldr r4, .Lyoung_ptr - str alloc_ptr, [r4, #0] - /* Reload callee-save registers and return */ - ldfd f4, [sp], #8 - ldfd f5, [sp], #8 - ldfd f6, [sp], #8 - ldfd f7, [sp], #8 - ldmfd sp!, {r4,r5,r6,r7,r8,r9,r11,pc} - - /* The trap handler */ -.Ltrap_handler: - /* Save exception pointer */ - ldr r4, .Lcaml_exception_pointer - str trap_ptr, [r4, #0] - /* Encode exception bucket as an exception result */ - orr r0, r0, #2 - /* Return it */ - b .Lreturn_result - -/* Raise an exception from C */ - - .global raise_caml_exception -raise_caml_exception: - /* Reload Caml allocation pointers */ - ldr r1, .Lyoung_ptr - ldr alloc_ptr, [r1, #0] - ldr alloc_limit, .Lyoung_limit - /* Say we're back into Caml */ - ldr r1, .Lcaml_last_return_address - mov r2, #0 - str r2, [r1, #0] - /* Cut stack at current trap handler */ - ldr r1, .Lcaml_exception_pointer - ldr sp, [r1, #0] - /* Pop previous handler and addr of trap, and jump to it */ - ldmfd sp!, {trap_ptr, pc} - -/* Callback from C to Caml */ - - .global callback_exn -callback_exn: - /* Initial shuffling of arguments (r0 = closure, r1 = first arg) */ - mov r10, r0 - mov r0, r1 /* r0 = first arg */ - mov r1, r10 /* r1 = closure environment */ - ldr r10, [r10, #0] /* code pointer */ - b .Ljump_to_caml - - .global callback2_exn -callback2_exn: - /* Initial shuffling of arguments (r0 = closure, r1 = arg1, r2 = arg2) */ - mov r10, r0 - mov r0, r1 /* r0 = first arg */ - mov r1, r2 /* r1 = second arg */ - mov r2, r10 /* r2 = closure environment */ - ldr r10, .Lcaml_apply2 - b .Ljump_to_caml - - .global callback3_exn -callback3_exn: - /* Initial shuffling of arguments */ - /* (r0 = closure, r1 = arg1, r2 = arg2, r3 = arg3) */ - mov r10, r0 - mov r0, r1 /* r0 = first arg */ - mov r1, r2 /* r1 = second arg */ - mov r2, r3 /* r2 = third arg */ - mov r3, r10 /* r3 = closure environment */ - ldr r10, .Lcaml_apply3 - b .Ljump_to_caml - - .global caml_array_bound_error -caml_array_bound_error: - /* Load address of array_bound_error in r10 */ - ldr r10, .Larray_bound_error - /* Call that function */ - b caml_c_call - -/* Global references */ - -.Lcaml_last_return_address: .word caml_last_return_address -.Lcaml_bottom_of_stack: .word caml_bottom_of_stack -.Lcaml_gc_regs: .word caml_gc_regs -.Lyoung_ptr: .word young_ptr -.Lyoung_limit: .word young_limit -.Lcaml_exception_pointer: .word caml_exception_pointer -.Lcaml_program: .word caml_program -.LLtrap_handler: .word .Ltrap_handler -.Lcaml_apply2: .word caml_apply2 -.Lcaml_apply3: .word caml_apply3 -.Lcaml_requested_size: .word 0 -.Larray_bound_error: .word array_bound_error - -/* GC roots for callback */ - - .data - - .global system__frametable -system__frametable: - .word 1 /* one descriptor */ - .word .Lcaml_retaddr /* return address into callback */ - .short -1 /* negative frame size => use callback link */ - .short 0 /* no roots */ - .align 2 diff --git a/asmrun/fail.c b/asmrun/fail.c deleted file mode 100644 index 0c79b7f157..0000000000 --- a/asmrun/fail.c +++ /dev/null @@ -1,172 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -/* Raising exceptions from C. */ - -#include <signal.h> -#include "alloc.h" -#include "fail.h" -#include "io.h" -#include "gc.h" -#include "memory.h" -#include "mlvalues.h" -#include "printexc.h" -#include "signals.h" -#include "stack.h" -#include "roots.h" - -/* The globals holding predefined exceptions */ - -typedef value caml_generated_constant[1]; - -extern caml_generated_constant Out_of_memory, Sys_error, Failure, - Invalid_argument, End_of_file, Division_by_zero, Not_found, - Match_failure, Sys_blocked_io, Stack_overflow; -extern caml_generated_constant - bucket_Out_of_memory, bucket_Stack_overflow; - -/* Exception raising */ - -extern void raise_caml_exception (value bucket) Noreturn; - -char * caml_exception_pointer = NULL; - -void mlraise(value v) -{ - Unlock_exn(); - if (caml_exception_pointer == NULL) fatal_uncaught_exception(v); - -#ifndef Stack_grows_upwards -#define PUSHED_AFTER < -#else -#define PUSHED_AFTER > -#endif - while (local_roots != NULL && - (char *) local_roots PUSHED_AFTER caml_exception_pointer) { - local_roots = local_roots->next; - } -#undef PUSHED_AFTER - - raise_caml_exception(v); -} - -void raise_constant(value tag) -{ - value bucket; - Begin_root (tag); - bucket = alloc_small (1, 0); - Field(bucket, 0) = tag; - End_roots (); - mlraise(bucket); -} - -void raise_with_arg(value tag, value arg) -{ - value bucket; - Begin_roots2 (tag, arg); - bucket = alloc_small (2, 0); - Field(bucket, 0) = tag; - Field(bucket, 1) = arg; - End_roots (); - mlraise(bucket); -} - -void raise_with_string(value tag, char *msg) -{ - raise_with_arg(tag, copy_string(msg)); -} - -void failwith (char *msg) -{ - raise_with_string((value) Failure, msg); -} - -void invalid_argument (char *msg) -{ - raise_with_string((value) Invalid_argument, msg); -} - -/* To raise Out_of_memory, we can't use raise_constant, - because it allocates and we're out of memory... - We therefore use a statically-allocated bucket constructed - by the ocamlopt linker. - This works OK because the exception value for Out_of_memory is also - statically allocated out of the heap. - The same applies to Stack_overflow. */ - -void raise_out_of_memory(void) -{ - mlraise((value) &bucket_Out_of_memory); -} - -void raise_stack_overflow(void) -{ - mlraise((value) &bucket_Stack_overflow); -} - -void raise_sys_error(value msg) -{ - raise_with_arg((value) Sys_error, msg); -} - -void raise_end_of_file(void) -{ - raise_constant((value) End_of_file); -} - -void raise_zero_divide(void) -{ - raise_constant((value) Division_by_zero); -} - -void raise_not_found(void) -{ - raise_constant((value) Not_found); -} - -void raise_sys_blocked_io(void) -{ - raise_constant((value) Sys_blocked_io); -} - -/* We allocate statically the bucket for the exception because we can't - do a GC before the exception is raised (lack of stack descriptors - for the ccall to array_bound_error */ - -#define BOUND_MSG "index out of bounds" -#define BOUND_MSG_LEN (sizeof(BOUND_MSG) - 1) - -static struct { - header_t hdr; - value exn; - value arg; -} array_bound_error_bucket; - -static struct { - header_t hdr; - char data[BOUND_MSG_LEN + sizeof(value)]; -} array_bound_error_msg = { 0, BOUND_MSG }; - -void array_bound_error(void) -{ - mlsize_t wosize = (BOUND_MSG_LEN + sizeof(value)) / sizeof(value); - mlsize_t offset_index = Bsize_wsize(wosize) - 1; - array_bound_error_msg.hdr = Make_header(wosize, String_tag, Caml_white); - array_bound_error_msg.data[offset_index] = offset_index - BOUND_MSG_LEN; - array_bound_error_bucket.hdr = Make_header(2, 0, Caml_white); - array_bound_error_bucket.exn = (value) Invalid_argument; - array_bound_error_bucket.arg = (value) array_bound_error_msg.data; - mlraise((value) &array_bound_error_bucket.exn); -} diff --git a/asmrun/hppa.S b/asmrun/hppa.S deleted file mode 100644 index 59daa91c73..0000000000 --- a/asmrun/hppa.S +++ /dev/null @@ -1,550 +0,0 @@ -;********************************************************************* -;* * -;* Objective Caml * -;* * -;* Xavier Leroy, projet Cristal, INRIA Rocquencourt * -;* * -;* Copyright 1996 Institut National de Recherche en Informatique et * -;* en Automatique. All rights reserved. This file is distributed * -;* under the terms of the GNU Library General Public License, with * -;* the special exception on linking described in file ../LICENSE. * -;* * -;********************************************************************* - -; $Id$ - -; Asm part of the runtime system for the HP PA-RISC processor. -; Must be preprocessed by cpp - -#ifdef SYS_hpux -#define G(x) x -#define CODESPACE .code -#define CODE_ALIGN 4 -#define EXPORT_CODE(x) .export x, entry, priv_lev=3 -#define EXPORT_DATA(x) .export x, data -#define STARTPROC .proc ! .callinfo frame=0, no_calls ! .entry -#define ENDPROC .exit ! .procend -#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_nextstep -#define G(x) _##x -#define CODESPACE .text -#define CODE_ALIGN 2 -#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 -#endif - -#ifdef SYS_hpux - .space $PRIVATE$ - .subspa $DATA$,quad=1,align=8,access=31 - .subspa $BSS$,quad=1,align=8,access=31,zero,sort=82 - .space $TEXT$ - .subspa $LIT$,quad=0,align=8,access=44 - .subspa $CODE$,quad=0,align=8,access=44,code_only - .import $global$, data - .import $$dyncall, millicode - .import garbage_collection, code - .import caml_program, code - .import mlraise, code - .import caml_apply2, code - .import caml_apply3, code - .import array_bound_error, code - -young_limit .comm 8 -young_ptr .comm 8 -caml_bottom_of_stack .comm 8 -caml_last_return_address .comm 8 -caml_gc_regs .comm 8 -caml_exception_pointer .comm 8 -caml_required_size .comm 8 -#endif - -#ifdef SYS_nextstep - .comm G(young_limit), 8 - .comm G(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 -#endif - -; Allocation functions - - CODESPACE - .align CODE_ALIGN - EXPORT_CODE(G(caml_alloc)) -G(caml_alloc): - STARTPROC -; Required size in %r29 - ldw 0(%r4), %r1 - sub %r3, %r29, %r3 - comb,<<,n %r3, %r1, G(caml_call_gc) ; nullify if taken (forward br.) - bv 0(%r2) - nop - ENDPROC - - EXPORT_CODE(G(caml_call_gc)) -G(caml_call_gc): - STARTPROC -; Save required size (%r29) - LOADHIGH(G(caml_required_size)) - stw %r29, LOW(G(caml_required_size))(%r1) -; Save current allocation pointer for debugging purposes - LOADHIGH(G(young_ptr)) - stw %r3, LOW(G(young_ptr))(%r1) -; Record lowest stack address - LOADHIGH(G(caml_bottom_of_stack)) - stw %r30, LOW(G(caml_bottom_of_stack))(%r1) -; Record return address - LOADHIGH(G(caml_last_return_address)) - stw %r2, LOW(G(caml_last_return_address))(%r1) -; Save the exception handler (if e.g. a sighandler raises) - LOADHIGH(G(caml_exception_pointer)) - stw %r5, LOW(G(caml_exception_pointer))(%r1) -; Reserve stack space -; 0x1C0 = 4 * 32 (int regs) + 8 * 32 (float regs) + 64 (for calling C) - ldo 0x1C0(%r30), %r30 -; Save caml_gc_regs -L100: ldo -(64 + 4*32)(%r30), %r31 - LOADHIGH(G(caml_gc_regs)) - stw %r31, LOW(G(caml_gc_regs))(%r1) -; Save all regs used by the code generator - copy %r31, %r1 - stws,ma %r6, 4(%r1) - stws,ma %r7, 4(%r1) - stws,ma %r8, 4(%r1) - stws,ma %r9, 4(%r1) - stws,ma %r10, 4(%r1) - stws,ma %r11, 4(%r1) - stws,ma %r12, 4(%r1) - stws,ma %r13, 4(%r1) - stws,ma %r14, 4(%r1) - stws,ma %r15, 4(%r1) - stws,ma %r16, 4(%r1) - stws,ma %r17, 4(%r1) - stws,ma %r18, 4(%r1) - stws,ma %r19, 4(%r1) - stws,ma %r20, 4(%r1) - stws,ma %r21, 4(%r1) - stws,ma %r22, 4(%r1) - stws,ma %r23, 4(%r1) - stws,ma %r24, 4(%r1) - stws,ma %r25, 4(%r1) - stws,ma %r26, 4(%r1) - stws,ma %r28, 4(%r1) - ldo -0x1C0(%r30), %r1 - fstds,ma %fr4, 8(%r1) - fstds,ma %fr5, 8(%r1) - fstds,ma %fr6, 8(%r1) - fstds,ma %fr7, 8(%r1) - fstds,ma %fr8, 8(%r1) - fstds,ma %fr9, 8(%r1) - fstds,ma %fr10, 8(%r1) - fstds,ma %fr11, 8(%r1) - fstds,ma %fr12, 8(%r1) - fstds,ma %fr13, 8(%r1) - fstds,ma %fr14, 8(%r1) - fstds,ma %fr15, 8(%r1) - fstds,ma %fr16, 8(%r1) - fstds,ma %fr17, 8(%r1) - fstds,ma %fr18, 8(%r1) - fstds,ma %fr19, 8(%r1) - fstds,ma %fr20, 8(%r1) - fstds,ma %fr21, 8(%r1) - fstds,ma %fr22, 8(%r1) - fstds,ma %fr23, 8(%r1) - fstds,ma %fr24, 8(%r1) - fstds,ma %fr25, 8(%r1) - fstds,ma %fr26, 8(%r1) - fstds,ma %fr27, 8(%r1) - fstds,ma %fr28, 8(%r1) - fstds,ma %fr29, 8(%r1) - fstds,ma %fr30, 8(%r1) - -; Call the garbage collector -#ifdef SYS_nextstep - ldil L`G(garbage_collection), %r1 - ble R`G(garbage_collection)(4, %r1) - copy %r31, %r2 -#else - bl G(garbage_collection), %r2 - nop -#endif - -; Restore all regs used by the code generator - ldo -(64 + 4*32)(%r30), %r1 - ldws,ma 4(%r1), %r6 - ldws,ma 4(%r1), %r7 - ldws,ma 4(%r1), %r8 - ldws,ma 4(%r1), %r9 - ldws,ma 4(%r1), %r10 - ldws,ma 4(%r1), %r11 - ldws,ma 4(%r1), %r12 - ldws,ma 4(%r1), %r13 - ldws,ma 4(%r1), %r14 - ldws,ma 4(%r1), %r15 - ldws,ma 4(%r1), %r16 - ldws,ma 4(%r1), %r17 - ldws,ma 4(%r1), %r18 - ldws,ma 4(%r1), %r19 - ldws,ma 4(%r1), %r20 - ldws,ma 4(%r1), %r21 - ldws,ma 4(%r1), %r22 - ldws,ma 4(%r1), %r23 - ldws,ma 4(%r1), %r24 - ldws,ma 4(%r1), %r25 - ldws,ma 4(%r1), %r26 - ldws,ma 4(%r1), %r28 - ldo -0x1C0(%r30), %r1 - fldds,ma 8(%r1), %fr4 - fldds,ma 8(%r1), %fr5 - fldds,ma 8(%r1), %fr6 - fldds,ma 8(%r1), %fr7 - fldds,ma 8(%r1), %fr8 - fldds,ma 8(%r1), %fr9 - fldds,ma 8(%r1), %fr10 - fldds,ma 8(%r1), %fr11 - fldds,ma 8(%r1), %fr12 - fldds,ma 8(%r1), %fr13 - fldds,ma 8(%r1), %fr14 - fldds,ma 8(%r1), %fr15 - fldds,ma 8(%r1), %fr16 - fldds,ma 8(%r1), %fr17 - fldds,ma 8(%r1), %fr18 - fldds,ma 8(%r1), %fr19 - fldds,ma 8(%r1), %fr20 - fldds,ma 8(%r1), %fr21 - fldds,ma 8(%r1), %fr22 - fldds,ma 8(%r1), %fr23 - fldds,ma 8(%r1), %fr24 - fldds,ma 8(%r1), %fr25 - fldds,ma 8(%r1), %fr26 - fldds,ma 8(%r1), %fr27 - fldds,ma 8(%r1), %fr28 - fldds,ma 8(%r1), %fr29 - fldds,ma 8(%r1), %fr30 - -; Reload the allocation pointer - LOADHIGH(G(young_ptr)) - ldw LOW(G(young_ptr))(%r1), %r3 -; Allocate space for block - LOADHIGH(G(caml_required_size)) - ldw LOW(G(caml_required_size))(%r1), %r29 - ldw 0(%r4), %r1 - sub %r3, %r29, %r3 - comb,<< %r3, %r1, L100 - nop -; Return to caller - LOADHIGH(G(caml_last_return_address)) - ldw LOW(G(caml_last_return_address))(%r1), %r2 - bv 0(%r2) - ldo -0x1C0(%r30), %r30 - ENDPROC - -; Call a C function from Caml -; 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 - LOADHIGH(G(caml_bottom_of_stack)) - stw %r30, LOW(G(caml_bottom_of_stack))(%r1) -; Record return address - LOADHIGH(G(caml_last_return_address)) - stw %r2, LOW(G(caml_last_return_address))(%r1) -; Save the exception handler - LOADHIGH(G(caml_exception_pointer)) - stw %r5, LOW(G(caml_exception_pointer))(%r1) -; Save the allocation pointer - LOADHIGH(G(young_ptr)) - stw %r3, LOW(G(young_ptr))(%r1) -; Call the C function -#ifdef SYS_hpux - bl $$dyncall, %r31 -#else - ble 0(4, %r22) -#endif - copy %r31, %r2 ; in delay slot -; Reload return address - LOADHIGH(G(caml_last_return_address)) - ldw LOW(G(caml_last_return_address))(%r1), %r2 -; Reload allocation pointer - LOADHIGH(G(young_ptr)) -; Return to caller - bv 0(%r2) - ldw LOW(G(young_ptr))(%r1), %r3 ; in delay slot - ENDPROC - -; Start the Caml program - - .align CODE_ALIGN - EXPORT_CODE(G(caml_start_program)) -G(caml_start_program): - STARTPROC - LOADHIGH(G(caml_program)) - ldo LOW(G(caml_program))(%r1), %r22 - -; Code shared with callback* -L102: -; Save return address - stw %r2,-20(%r30) - ldo 256(%r30), %r30 -; Save the callee-save registers - ldo -32(%r30), %r1 - stws,ma %r3, -4(%r1) - stws,ma %r4, -4(%r1) - stws,ma %r5, -4(%r1) - stws,ma %r6, -4(%r1) - stws,ma %r7, -4(%r1) - stws,ma %r8, -4(%r1) - stws,ma %r9, -4(%r1) - stws,ma %r10, -4(%r1) - stws,ma %r11, -4(%r1) - stws,ma %r12, -4(%r1) - stws,ma %r13, -4(%r1) - stws,ma %r14, -4(%r1) - stws,ma %r15, -4(%r1) - stws,ma %r16, -4(%r1) - stws,ma %r17, -4(%r1) - stws,ma %r18, -4(%r1) - fstds,ma %fr12, -8(%r1) - fstds,ma %fr13, -8(%r1) - fstds,ma %fr14, -8(%r1) - fstds,ma %fr15, -8(%r1) - fstds,ma %fr16, -8(%r1) - fstds,ma %fr17, -8(%r1) - fstds,ma %fr18, -8(%r1) - fstds,ma %fr19, -8(%r1) - fstds,ma %fr20, -8(%r1) - fstds,ma %fr21, -8(%r1) - fstds,ma %fr22, -8(%r1) - fstds,ma %fr23, -8(%r1) - fstds,ma %fr24, -8(%r1) - fstds,ma %fr25, -8(%r1) - fstds,ma %fr26, -8(%r1) - fstds,ma %fr27, -8(%r1) - fstds,ma %fr28, -8(%r1) - fstds,ma %fr29, -8(%r1) - fstds,ma %fr30, -8(%r1) - fstds,ma %fr31, -8(%r1) -; Set up a callback link - ldo 16(%r30), %r30 - LOADHIGH(G(caml_bottom_of_stack)) - ldw LOW(G(caml_bottom_of_stack))(%r1), %r1 - stw %r1, -16(%r30) - LOADHIGH(G(caml_last_return_address)) - ldw LOW(G(caml_last_return_address))(%r1), %r1 - stw %r1, -12(%r30) - LOADHIGH(G(caml_gc_regs)) - ldw LOW(G(caml_gc_regs))(%r1), %r1 - stw %r1, -8(%r30) -; Set up a trap frame to catch exceptions escaping the Caml code - ldo 8(%r30), %r30 - LOADHIGH(G(caml_exception_pointer)) - ldw LOW(G(caml_exception_pointer))(%r1), %r1 - stw %r1, -8(%r30) - LOADHIGHLABEL(L103) - ldo LOWLABEL(L103)(%r1), %r1 - stw %r1, -4(%r30) - copy %r30, %r5 -; Reload allocation pointers - LOADHIGH(G(young_ptr)) - ldw LOW(G(young_ptr))(%r1), %r3 - LOADHIGH(G(young_limit)) - ldo LOW(G(young_limit))(%r1), %r4 -; Call the Caml code - ble 0(4, %r22) - copy %r31, %r2 -L104: -; Pop the trap frame - ldw -8(%r30), %r31 - LOADHIGH(G(caml_exception_pointer)) - stw %r31, LOW(G(caml_exception_pointer))(%r1) - ldo -8(%r30), %r30 -; Pop the callback link -L105: - ldw -16(%r30), %r31 - LOADHIGH(G(caml_bottom_of_stack)) - stw %r31, LOW(G(caml_bottom_of_stack))(%r1) - ldw -12(%r30), %r31 - LOADHIGH(G(caml_last_return_address)) - stw %r31, LOW(G(caml_last_return_address))(%r1) - ldw -8(%r30), %r31 - LOADHIGH(G(caml_gc_regs)) - stw %r31, LOW(G(caml_gc_regs))(%r1) - ldo -16(%r30), %r30 -; Save allocation pointer - LOADHIGH(G(young_ptr)) - stw %r3, LOW(G(young_ptr))(%r1) -; Move result where C function expects it - copy %r26, %r28 -; Reload callee-save registers - ldo -32(%r30), %r1 - ldws,ma -4(%r1), %r3 - ldws,ma -4(%r1), %r4 - ldws,ma -4(%r1), %r5 - ldws,ma -4(%r1), %r6 - ldws,ma -4(%r1), %r7 - ldws,ma -4(%r1), %r8 - ldws,ma -4(%r1), %r9 - ldws,ma -4(%r1), %r10 - ldws,ma -4(%r1), %r11 - ldws,ma -4(%r1), %r12 - ldws,ma -4(%r1), %r13 - ldws,ma -4(%r1), %r14 - ldws,ma -4(%r1), %r15 - ldws,ma -4(%r1), %r16 - ldws,ma -4(%r1), %r17 - ldws,ma -4(%r1), %r18 - fldds,ma -8(%r1), %fr12 - fldds,ma -8(%r1), %fr13 - fldds,ma -8(%r1), %fr14 - fldds,ma -8(%r1), %fr15 - fldds,ma -8(%r1), %fr16 - fldds,ma -8(%r1), %fr17 - fldds,ma -8(%r1), %fr18 - fldds,ma -8(%r1), %fr19 - fldds,ma -8(%r1), %fr20 - fldds,ma -8(%r1), %fr21 - fldds,ma -8(%r1), %fr22 - fldds,ma -8(%r1), %fr23 - fldds,ma -8(%r1), %fr24 - fldds,ma -8(%r1), %fr25 - fldds,ma -8(%r1), %fr26 - fldds,ma -8(%r1), %fr27 - fldds,ma -8(%r1), %fr28 - fldds,ma -8(%r1), %fr29 - fldds,ma -8(%r1), %fr30 - fldds,ma -8(%r1), %fr31 -; Return to C - ldo -256(%r30), %r30 - ldw -20(%r30), %r2 - bv 0(%r2) - nop -; The trap handler -L103: -; Save exception pointer - LOADHIGH(G(caml_exception_pointer)) - stw %r5, LOW(G(caml_exception_pointer))(%r1) -; Encode exception bucket as an exception result and return it - ldi 2, %r1 - or %r26, %r1, %r26 -; Return it - b L105 - nop - -; Re-raise the exception through mlraise, to clean up local C roots - ldo 64(%r30), %r30 -#ifdef SYS_nextstep - ldil L`G(mlraise), %r1 - ble R`G(mlraise)(4, %r1) - copy %r31, %r2 -#else - bl G(mlraise), %r2 - nop -#endif - ENDPROC - -; Raise an exception from C - - .align CODE_ALIGN - EXPORT_CODE(G(raise_caml_exception)) -G(raise_caml_exception): - STARTPROC -; Cut the stack - LOADHIGH(G(caml_exception_pointer)) - ldw LOW(G(caml_exception_pointer))(%r1), %r30 -; Reload allocation registers - LOADHIGH(G(young_ptr)) - ldw LOW(G(young_ptr))(%r1), %r3 - LOADHIGH(G(young_limit)) - ldo LOW(G(young_limit))(%r1), %r4 -; Raise the exception - ldw -4(%r30), %r1 - ldw -8(%r30), %r5 - bv 0(%r1) - ldo -8(%r30), %r30 ; in delay slot - ENDPROC - -; Callbacks C -> ML - - .align CODE_ALIGN - EXPORT_CODE(G(callback_exn)) -G(callback_exn): - STARTPROC -; Initial shuffling of arguments - copy %r26, %r1 ; Closure - copy %r25, %r26 ; Argument - copy %r1, %r25 - b L102 - ldw 0(%r1), %r22 ; Code to call (in delay slot) - ENDPROC - - .align CODE_ALIGN - EXPORT_CODE(G(callback2_exn)) -G(callback2_exn): - STARTPROC - copy %r26, %r1 ; Closure - copy %r25, %r26 ; First argument - copy %r24, %r25 ; Second argument - copy %r1, %r24 - LOADHIGH(G(caml_apply2)) - b L102 - ldo LOW(G(caml_apply2))(%r1), %r22 - ENDPROC - - .align CODE_ALIGN - EXPORT_CODE(G(callback3_exn)) -G(callback3_exn): - STARTPROC - copy %r26, %r1 ; Closure - copy %r25, %r26 ; First argument - copy %r24, %r25 ; Second argument - copy %r23, %r24 ; Third argument - copy %r1, %r23 - LOADHIGH(G(caml_apply3)) - b L102 - ldo LOW(G(caml_apply3))(%r1), %r22 - ENDPROC - - .align CODE_ALIGN - EXPORT_CODE(G(caml_array_bound_error)) -G(caml_array_bound_error): - STARTPROC -; Load address of array_bound_error in %r22 -#ifdef SYS_hpux - ldil LR%array_bound_error, %r22 - ldo RR%array_bound_error(%r22), %r22 -#else - ldil L`_array_bound_error, %r22 - ldo R`_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 */ - ENDPROC - - .data - EXPORT_DATA(G(system__frametable)) -G(system__frametable): - .long 1 /* one descriptor */ - .long L104 + 3 /* return address into callback */ - .short -1 /* negative frame size => use callback link */ - .short 0 /* no roots */ diff --git a/asmrun/i386.S b/asmrun/i386.S deleted file mode 100644 index f89ed37425..0000000000 --- a/asmrun/i386.S +++ /dev/null @@ -1,326 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -/* Asm part of the runtime system, Intel 386 processor */ -/* Must be preprocessed by cpp */ - -/* Linux/BSD with ELF binaries and Solaris do not prefix identifiers with _. - Linux/BSD with a.out binaries and NextStep do. */ - -#if defined(SYS_solaris) -#define CONCAT(a,b) a/**/b -#else -#define CONCAT(a,b) a##b -#endif - -#if defined(SYS_linux_elf) || defined(SYS_bsd_elf) \ - || defined(SYS_solaris) || defined(SYS_beos) -#define G(x) x -#define LBL(x) CONCAT(.L,x) -#else -#define G(x) CONCAT(_,x) -#define LBL(x) CONCAT(L,x) -#endif - -#if defined(SYS_linux_elf) || defined(SYS_bsd_elf) \ - || defined(SYS_solaris) || defined(SYS_beos) || defined(SYS_cygwin) \ - || defined(SYS_mingw) -#define FUNCTION_ALIGN 4 -#else -#define FUNCTION_ALIGN 2 -#endif - -#if defined(PROFILING) -#if defined(SYS_linux_elf) -#define PROFILE_CAML \ - pushl %ebp; movl %esp, %ebp; pushl %eax; pushl %ecx; pushl %edx; \ - call mcount; \ - popl %edx; popl %ecx; popl %eax; popl %ebp -#define PROFILE_C \ - pushl %ebp; movl %esp, %ebp; call mcount; popl %ebp -#elif defined(SYS_bsd_elf) -#define PROFILE_CAML \ - pushl %ebp; movl %esp, %ebp; pushl %eax; pushl %ecx; pushl %edx; \ - call .mcount; \ - popl %edx; popl %ecx; popl %eax; popl %ebp -#define PROFILE_C \ - pushl %ebp; movl %esp, %ebp; call .mcount; popl %ebp -#endif -#else -#define PROFILE_CAML -#define PROFILE_C -#endif - -/* Allocation */ - - .text - .globl G(caml_call_gc) - .globl G(caml_alloc1) - .globl G(caml_alloc2) - .globl G(caml_alloc3) - .globl G(caml_alloc) - -G(caml_call_gc): - PROFILE_CAML - /* Record lowest stack address and return address */ - movl 0(%esp), %eax - movl %eax, G(caml_last_return_address) - leal 4(%esp), %eax - movl %eax, G(caml_bottom_of_stack) - /* Build array of registers, save it into caml_gc_regs */ -LBL(105): - pushl %ebp - pushl %edi - pushl %esi - pushl %edx - pushl %ecx - pushl %ebx - pushl %eax - movl %esp, G(caml_gc_regs) - /* Call the garbage collector */ - call G(garbage_collection) - /* Restore all regs used by the code generator */ - popl %eax - popl %ebx - popl %ecx - popl %edx - popl %esi - popl %edi - popl %ebp - /* Return to caller */ - ret - - .align FUNCTION_ALIGN -G(caml_alloc1): - PROFILE_CAML - movl G(young_ptr), %eax - subl $8, %eax - movl %eax, G(young_ptr) - cmpl G(young_limit), %eax - jb LBL(100) - ret -LBL(100): - movl 0(%esp), %eax - movl %eax, G(caml_last_return_address) - leal 4(%esp), %eax - movl %eax, G(caml_bottom_of_stack) - call LBL(105) - jmp G(caml_alloc1) - - .align FUNCTION_ALIGN -G(caml_alloc2): - PROFILE_CAML - movl G(young_ptr), %eax - subl $12, %eax - movl %eax, G(young_ptr) - cmpl G(young_limit), %eax - jb LBL(101) - ret -LBL(101): - movl 0(%esp), %eax - movl %eax, G(caml_last_return_address) - leal 4(%esp), %eax - movl %eax, G(caml_bottom_of_stack) - call LBL(105) - jmp G(caml_alloc2) - - .align FUNCTION_ALIGN -G(caml_alloc3): - PROFILE_CAML - movl G(young_ptr), %eax - subl $16, %eax - movl %eax, G(young_ptr) - cmpl G(young_limit), %eax - jb LBL(102) - ret -LBL(102): - movl 0(%esp), %eax - movl %eax, G(caml_last_return_address) - leal 4(%esp), %eax - movl %eax, G(caml_bottom_of_stack) - call LBL(105) - jmp G(caml_alloc3) - - .align FUNCTION_ALIGN -G(caml_alloc): - PROFILE_CAML - subl G(young_ptr), %eax /* eax = size - young_ptr */ - negl %eax /* eax = young_ptr - size */ - cmpl G(young_limit), %eax - jb LBL(103) - movl %eax, G(young_ptr) - ret -LBL(103): - subl G(young_ptr), %eax /* eax = - size */ - negl %eax /* eax = size */ - pushl %eax /* save desired size */ - subl %eax, G(young_ptr) /* must update young_ptr */ - movl 4(%esp), %eax - movl %eax, G(caml_last_return_address) - leal 8(%esp), %eax - movl %eax, G(caml_bottom_of_stack) - call LBL(105) - popl %eax /* recover desired size */ - jmp G(caml_alloc) - -/* Call a C function from Caml */ - - .globl G(caml_c_call) - .align FUNCTION_ALIGN -G(caml_c_call): - PROFILE_CAML - /* Record lowest stack address and return address */ - movl (%esp), %edx - movl %edx, G(caml_last_return_address) - leal 4(%esp), %edx - movl %edx, G(caml_bottom_of_stack) - /* Call the function (address in %eax) */ - jmp *%eax - -/* Start the Caml program */ - - .globl G(caml_start_program) - .align FUNCTION_ALIGN -G(caml_start_program): - PROFILE_C - /* Save callee-save registers */ - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - /* Initial entry point is caml_program */ - movl $ G(caml_program), %esi - /* Common code for caml_start_program and callback* */ -LBL(106): - /* Build a callback link */ - pushl G(caml_gc_regs) - pushl G(caml_last_return_address) - pushl G(caml_bottom_of_stack) - /* Build an exception handler */ - pushl $ LBL(108) - pushl G(caml_exception_pointer) - movl %esp, G(caml_exception_pointer) - /* Call the Caml code */ - call *%esi -LBL(107): - /* Pop the exception handler */ - popl G(caml_exception_pointer) - popl %esi /* dummy register */ -LBL(109): - /* Pop the callback link, restoring the global variables */ - popl G(caml_bottom_of_stack) - popl G(caml_last_return_address) - popl G(caml_gc_regs) - /* Restore callee-save registers. */ - popl %ebp - popl %edi - popl %esi - popl %ebx - /* Return to caller. */ - ret -LBL(108): - /* Exception handler*/ - /* Mark the bucket as an exception result and return it */ - orl $2, %eax - jmp LBL(109) - -/* Raise an exception from C */ - - .globl G(raise_caml_exception) - .align FUNCTION_ALIGN -G(raise_caml_exception): - PROFILE_C - movl 4(%esp), %eax - movl G(caml_exception_pointer), %esp - popl G(caml_exception_pointer) - ret - -/* Callback from C to Caml */ - - .globl G(callback_exn) - .align FUNCTION_ALIGN -G(callback_exn): - PROFILE_C - /* Save callee-save registers */ - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - /* Initial loading of arguments */ - movl 20(%esp), %ebx /* closure */ - movl 24(%esp), %eax /* argument */ - movl 0(%ebx), %esi /* code pointer */ - jmp LBL(106) - - .globl G(callback2_exn) - .align FUNCTION_ALIGN -G(callback2_exn): - PROFILE_C - /* Save callee-save registers */ - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - /* Initial loading of arguments */ - movl 20(%esp), %ecx /* closure */ - movl 24(%esp), %eax /* first argument */ - movl 28(%esp), %ebx /* second argument */ - movl $ G(caml_apply2), %esi /* code pointer */ - jmp LBL(106) - - .globl G(callback3_exn) - .align FUNCTION_ALIGN -G(callback3_exn): - PROFILE_C - /* Save callee-save registers */ - pushl %ebx - pushl %esi - pushl %edi - pushl %ebp - /* Initial loading of arguments */ - movl 20(%esp), %edx /* closure */ - movl 24(%esp), %eax /* first argument */ - movl 28(%esp), %ebx /* second argument */ - movl 32(%esp), %ecx /* third argument */ - movl $ G(caml_apply3), %esi /* code pointer */ - jmp LBL(106) - - .globl G(caml_array_bound_error) - .align FUNCTION_ALIGN -G(caml_array_bound_error): - /* Empty the floating-point stack */ - ffree %st(0) - ffree %st(1) - ffree %st(2) - ffree %st(3) - ffree %st(4) - ffree %st(5) - ffree %st(6) - ffree %st(7) - /* Branch to array_bound_error */ - jmp G(array_bound_error) - - .data - .globl G(system__frametable) -G(system__frametable): - .long 1 /* one descriptor */ - .long LBL(107) /* return address into callback */ -#ifndef SYS_solaris - .word -1 /* negative frame size => use callback link */ - .word 0 /* no roots here */ -#else - .value -1 /* negative frame size => use callback link */ - .value 0 /* no roots here */ -#endif diff --git a/asmrun/i386nt.asm b/asmrun/i386nt.asm deleted file mode 100644 index 9ef28aeffc..0000000000 --- a/asmrun/i386nt.asm +++ /dev/null @@ -1,278 +0,0 @@ -;********************************************************************* -; -; Objective Caml -; -; Xavier Leroy, projet Cristal, INRIA Rocquencourt -; -; Copyright 1996 Institut National de Recherche en Informatique et -; en Automatique. All rights reserved. This file is distributed -; under the terms of the GNU Library General Public License, with -; the special exception on linking described in file ../LICENSE. -; -;********************************************************************* - -; $Id$ - -; Asm part of the runtime system, Intel 386 processor, Intel syntax - - .386 - .MODEL FLAT - - EXTERN _garbage_collection: PROC - EXTERN _mlraise: 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_bottom_of_stack: DWORD - EXTERN _caml_last_return_address: DWORD - EXTERN _caml_gc_regs: DWORD - EXTERN _caml_exception_pointer: DWORD - -; Allocation - - .CODE - PUBLIC _caml_alloc1 - PUBLIC _caml_alloc2 - PUBLIC _caml_alloc3 - PUBLIC _caml_alloc - PUBLIC _caml_call_gc - -_caml_call_gc: - ; Record lowest stack address and return address - mov eax, [esp] - mov _caml_last_return_address, eax - lea eax, [esp+4] - mov _caml_bottom_of_stack, eax - ; Save all regs used by the code generator -L105: push ebp - push edi - push esi - push edx - push ecx - push ebx - push eax - mov _caml_gc_regs, esp - ; Call the garbage collector - call _garbage_collection - ; Restore all regs used by the code generator - pop eax - pop ebx - pop ecx - pop edx - pop esi - pop edi - pop ebp - ; Return to caller - ret - - ALIGN 4 -_caml_alloc1: - mov eax, _young_ptr - sub eax, 8 - mov _young_ptr, eax - cmp eax, _young_limit - jb L100 - ret -L100: mov eax, [esp] - mov _caml_last_return_address, eax - lea eax, [esp+4] - mov _caml_bottom_of_stack, eax - call L105 - jmp _caml_alloc1 - - ALIGN 4 -_caml_alloc2: - mov eax, _young_ptr - sub eax, 12 - mov _young_ptr, eax - cmp eax, _young_limit - jb L101 - ret -L101: mov eax, [esp] - mov _caml_last_return_address, eax - lea eax, [esp+4] - mov _caml_bottom_of_stack, eax - call L105 - jmp _caml_alloc2 - - ALIGN 4 -_caml_alloc3: - mov eax, _young_ptr - sub eax, 16 - mov _young_ptr, eax - cmp eax, _young_limit - jb L102 - ret -L102: mov eax, [esp] - mov _caml_last_return_address, eax - lea eax, [esp+4] - mov _caml_bottom_of_stack, eax - call L105 - jmp _caml_alloc3 - - ALIGN 4 -_caml_alloc: - sub eax, _young_ptr ; eax = size - young_ptr - neg eax ; eax = young_ptr - size - cmp eax, _young_limit - jb L103 - mov _young_ptr, eax - ret -L103: sub eax, _young_ptr ; eax = - size - neg eax ; eax = size - push eax ; save desired size - sub _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 - -; Call a C function from Caml - - PUBLIC _caml_c_call - ALIGN 4 -_caml_c_call: - ; Record lowest stack address and return address - mov edx, [esp] - mov _caml_last_return_address, edx - lea edx, [esp+4] - mov _caml_bottom_of_stack, edx - ; Call the function (address in %eax) - jmp eax - -; Start the Caml program - - PUBLIC _caml_start_program - ALIGN 4 -_caml_start_program: - ; Save callee-save registers - push ebx - push esi - push edi - push ebp - ; Initial code pointer is caml_program - mov esi, offset _caml_program - -; Code shared between caml_start_program and callback* - -L106: - ; Build a callback link - push _caml_gc_regs - push _caml_last_return_address - push _caml_bottom_of_stack - ; Build an exception handler - push L108 - push _caml_exception_pointer - mov _caml_exception_pointer, esp - ; Call the Caml code - call esi -L107: - ; Pop the exception handler - pop _caml_exception_pointer - pop esi ; dummy register -L109: - ; Pop the callback link, restoring the global variables - ; used by caml_c_call - pop _caml_bottom_of_stack - pop _caml_last_return_address - pop _caml_gc_regs - ; Restore callee-save registers. - pop ebp - pop edi - pop esi - pop ebx - ; Return to caller. - ret -L108: - ; Exception handler - ; Mark the bucket as an exception result and return it - or eax, 2 - jmp L109 - -; Raise an exception from C - - PUBLIC _raise_caml_exception - ALIGN 4 -_raise_caml_exception: - mov eax, [esp+4] - mov esp, _caml_exception_pointer - pop _caml_exception_pointer - ret - -; Callback from C to Caml - - PUBLIC _callback_exn - ALIGN 4 -_callback_exn: - ; Save callee-save registers - push ebx - push esi - push edi - push ebp - ; Initial loading of arguments - mov ebx, [esp+20] ; closure - mov eax, [esp+24] ; argument - mov esi, [ebx] ; code pointer - jmp L106 - - PUBLIC _callback2_exn - ALIGN 4 -_callback2_exn: - ; Save callee-save registers - push ebx - push esi - push edi - push ebp - ; Initial loading of arguments - mov ecx, [esp+20] ; closure - mov eax, [esp+24] ; first argument - mov ebx, [esp+28] ; second argument - mov esi, offset _caml_apply2 ; code pointer - jmp L106 - - PUBLIC _callback3_exn - ALIGN 4 -_callback3_exn: - ; Save callee-save registers - push ebx - push esi - push edi - push ebp - ; Initial loading of arguments - mov edx, [esp+20] ; closure - mov eax, [esp+24] ; first argument - mov ebx, [esp+28] ; second argument - mov ecx, [esp+32] ; third argument - mov esi, offset _caml_apply3 ; code pointer - jmp L106 - - PUBLIC _caml_array_bound_error - ALIGN 4 -_caml_array_bound_error: - ; Empty the floating-point stack - ffree st(0) - ffree st(1) - ffree st(2) - ffree st(3) - ffree st(4) - ffree st(5) - ffree st(6) - ffree st(7) - ; Branch to array_bound_error - jmp _array_bound_error - - .DATA - PUBLIC _system__frametable -_system__frametable LABEL DWORD - DWORD 1 ; one descriptor - DWORD L107 ; return address into callback - WORD -1 ; negative frame size => use callback link - WORD 0 ; no roots here - - END diff --git a/asmrun/ia64.S b/asmrun/ia64.S deleted file mode 100644 index 66e1620a92..0000000000 --- a/asmrun/ia64.S +++ /dev/null @@ -1,530 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the Q Public License version 1.0. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -/* Asm part of the runtime system, Alpha processor */ - -#undef BROKEN_POSTINCREMENT - -#define ADDRGLOBAL(reg,symb) \ - add reg = @ltoff(symb), gp;; ld8 reg = [reg] -#define LOADGLOBAL(reg,symb) \ - add r3 = @ltoff(symb), gp;; ld8 r3 = [r3];; ld8 reg = [r3] -#define STOREGLOBAL(reg,symb) \ - add r3 = @ltoff(symb), gp;; ld8 r3 = [r3];; st8 [r3] = reg - -#define ST8OFF(a,b,d) st8 [a] = b, d -#define LD8OFF(a,b,d) ld8 a = [b], d -#define STFDOFF(a,b,d) stfd [a] = b, d -#define LDFDOFF(a,b,d) ldfd a = [b], d -#define STFSPILLOFF(a,b,d) stf.spill [a] = b, d -#define LDFFILLOFF(a,b,d) ldf.fill a = [b], d - -#define SAVE2(a,b) ST8OFF(r2, a, 16); ST8OFF(r3, b, 16) -#define SAVE4(a,b,c,d) SAVE2(a,b);; SAVE2(c,d) -#define SAVE8(a,b,c,d,e,f,g,h) SAVE4(a,b,c,d);; SAVE4(e,f,g,h) - -#define LOAD2(a,b) LD8OFF(a, r2, 16); LD8OFF(b, r3, 16) -#define LOAD4(a,b,c,d) LOAD2(a,b);; LOAD2(c,d) -#define LOAD8(a,b,c,d,e,f,g,h) LOAD4(a,b,c,d);; LOAD4(e,f,g,h) - -#define FSAVE2(a,b) STFDOFF(r2, a, 16); STFDOFF(r3, b, 16) -#define FSAVE4(a,b,c,d) FSAVE2(a,b);; FSAVE2(c,d) -#define FSAVE8(a,b,c,d,e,f,g,h) FSAVE4(a,b,c,d);; FSAVE4(e,f,g,h) - -#define FLOAD2(a,b) LDFDOFF(a, r2, 16); LDFDOFF(b, r3, 16) -#define FLOAD4(a,b,c,d) FLOAD2(a,b);; FLOAD2(c,d) -#define FLOAD8(a,b,c,d,e,f,g,h) FLOAD4(a,b,c,d);; FLOAD4(e,f,g,h) - -#define FSPILL2(a,b) STFSPILLOFF(r2, a, 32); STFSPILLOFF(r3, b, 32) -#define FSPILL4(a,b,c,d) FSPILL2(a,b);; FSPILL2(c,d) -#define FSPILL8(a,b,c,d,e,f,g,h) FSPILL4(a,b,c,d);; FSPILL4(e,f,g,h) - -#define FFILL2(a,b) LDFFILLOFF(a, r2, 32); LDFFILLOFF(b, r3, 32) -#define FFILL4(a,b,c,d) FFILL2(a,b);; FFILL2(c,d) -#define FFILL8(a,b,c,d,e,f,g,h) FFILL4(a,b,c,d);; FFILL4(e,f,g,h) - -/* Allocation */ - .text - - .global caml_alloc# - .proc caml_alloc# - .align 16 - -/* caml_alloc: all code generator registers preserved, - gp preserved, r2 = requested size */ - -caml_alloc: - sub r4 = r4, r2 ;; - cmp.ltu p0, p6 = r4, r5 - (p6) br.ret.sptk b0 ;; - /* Stash return address at sp (in stack scratch area) */ - mov r3 = b0 ;; - st8 [sp] = r3 - /* Call GC */ - br.call.sptk b0 = caml_call_gc# ;; - /* Return to caller */ - ld8 r3 = [sp] ;; - mov b0 = r3 ;; - br.ret.sptk b0 - - .endp caml_alloc# - -/* caml_call_gc: all code generator registers preserved, - gp preserved, r2 = requested size */ - - .global caml_call_gc# - .proc caml_call_gc# - .align 16 -caml_call_gc: - /* Allocate stack frame */ - add sp = -(16 + 16 + 80*8 + 42*8), sp ;; - - /* Save requested size and GP on stack */ - add r3 = 16, sp ;; - ST8OFF(r3, r2, 8) ;; - st8 [r3] = gp - - /* Record lowest stack address, return address, GC regs */ - mov r2 = b0 ;; - STOREGLOBAL(r2, caml_last_return_address#) - add r2 = (16 + 16 + 80*8 + 42*8), sp ;; - STOREGLOBAL(r2, caml_bottom_of_stack#) - add r2 = (16 + 16), sp ;; - STOREGLOBAL(r2, caml_gc_regs#) - - /* Save all integer regs used by the code generator in the context */ -.L100: add r3 = 8, r2 ;; - SAVE4(r8,r9,r10,r11) ;; - SAVE8(r16,r17,r18,r19,r20,r21,r22,r23) ;; - SAVE8(r24,r25,r26,r27,r28,r29,r30,r31) ;; - SAVE8(r32,r33,r34,r35,r36,r37,r38,r39) ;; - SAVE8(r40,r41,r42,r43,r44,r45,r46,r47) ;; - SAVE8(r48,r49,r50,r51,r52,r53,r54,r55) ;; - SAVE8(r56,r57,r58,r59,r60,r61,r62,r63) ;; - SAVE8(r64,r65,r66,r67,r68,r69,r70,r71) ;; - SAVE8(r72,r73,r74,r75,r76,r77,r78,r79) ;; - SAVE8(r80,r81,r82,r83,r84,r85,r86,r87) ;; - SAVE4(r88,r89,r90,r91) ;; - - /* Save all floating-point registers not preserved by C */ - FSAVE2(f6,f7) ;; - FSAVE8(f8,f9,f10,f11,f12,f13,f14,f15) ;; - FSAVE8(f32,f33,f34,f35,f36,f37,f38,f39) ;; - FSAVE8(f40,f41,f42,f43,f44,f45,f46,f47) ;; - FSAVE8(f48,f49,f50,f51,f52,f53,f54,f55) ;; - FSAVE8(f56,f57,f58,f59,f60,f61,f62,f63) ;; - - /* Save current allocation pointer for debugging purposes */ - STOREGLOBAL(r4, young_ptr#) - - /* Save trap pointer in case an exception is raised */ - STOREGLOBAL(r6, caml_exception_pointer#) - - /* Call the garbage collector */ - br.call.sptk b0 = garbage_collection# ;; - - /* Restore gp */ - add r3 = 24, sp ;; - ld8 gp = [r3] - - /* Restore all integer regs from GC context */ - add r2 = (16 + 16), sp ;; - add r3 = 8, r2 ;; - LOAD4(r8,r9,r10,r11) ;; - LOAD8(r16,r17,r18,r19,r20,r21,r22,r23) ;; - LOAD8(r24,r25,r26,r27,r28,r29,r30,r31) ;; - LOAD8(r32,r33,r34,r35,r36,r37,r38,r39) ;; - LOAD8(r40,r41,r42,r43,r44,r45,r46,r47) ;; - LOAD8(r48,r49,r50,r51,r52,r53,r54,r55) ;; - LOAD8(r56,r57,r58,r59,r60,r61,r62,r63) ;; - LOAD8(r64,r65,r66,r67,r68,r69,r70,r71) ;; - LOAD8(r72,r73,r74,r75,r76,r77,r78,r79) ;; - LOAD8(r80,r81,r82,r83,r84,r85,r86,r87) ;; - LOAD4(r88,r89,r90,r91) ;; - - /* Restore all floating-point registers not preserved by C */ - FLOAD2(f6,f7) ;; - FLOAD8(f8,f9,f10,f11,f12,f13,f14,f15) ;; - FLOAD8(f32,f33,f34,f35,f36,f37,f38,f39) ;; - FLOAD8(f40,f41,f42,f43,f44,f45,f46,f47) ;; - FLOAD8(f48,f49,f50,f51,f52,f53,f54,f55) ;; - FLOAD8(f56,f57,f58,f59,f60,f61,f62,f63) ;; - - /* Reload new allocation pointer and allocation limit */ - LOADGLOBAL(r4, young_ptr#) - LOADGLOBAL(r5, young_limit#) - - /* Allocate space for the block */ - add r3 = 16, sp ;; - ld8 r2 = [r3] ;; - sub r4 = r4, r2 ;; - cmp.ltu p6, p0 = r4, r5 /* enough space? */ - (p6) br.cond.spnt .L100 ;; /* no: call GC again */ - - /* Reload return address and say that we are back into Caml code */ - ADDRGLOBAL(r3, caml_last_return_address#) ;; - ld8 r2 = [r3] - st8 [r3] = r0 ;; - - /* Return to caller */ - mov b0 = r2 - add sp = (16 + 16 + 80*8 + 42*8), sp ;; - br.ret.sptk b0 - - .endp caml_call_gc# - -/* Call a C function from Caml */ -/* Function to call is in r2 */ - - .global caml_c_call# - .proc caml_c_call# - .align 16 - -caml_c_call: - /* The Caml code that called us does not expect any - code-generator registers to be preserved */ - - /* Recover entry point from the function pointer in r2 */ - LD8OFF(r3, r2, 8) ;; - mov b6 = r3 - - /* Preserve gp in r7 */ - mov r7 = gp - - /* Record lowest stack address and return address */ - mov r14 = b0 - STOREGLOBAL(sp, caml_bottom_of_stack#) ;; - STOREGLOBAL(r14, caml_last_return_address#) - - /* Make the exception handler and alloc ptr available to the C code */ - STOREGLOBAL(r4, young_ptr#) - STOREGLOBAL(r6, caml_exception_pointer#) - - /* Recover gp from the function pointer in r2 */ - ld8 gp = [r2] - - /* Call the function */ - br.call.sptk b0 = b6 ;; - - /* Restore gp */ - mov gp = r7 ;; - - /* Reload alloc ptr and alloc limit */ - LOADGLOBAL(r4, young_ptr#) - LOADGLOBAL(r5, young_limit#) - - /* Reload return address and say that we are back into Caml code */ - ADDRGLOBAL(r3, caml_last_return_address#) ;; - ld8 r2 = [r3] - st8 [r3] = r0 ;; - - /* Return to caller */ - mov b0 = r2 ;; - br.ret.sptk b0 - - .endp caml_c_call# - -/* Start the Caml program */ - - .global caml_start_program# - .proc caml_start_program# - .align 16 - -caml_start_program: - ADDRGLOBAL(r2, caml_program#) ;; - mov b6 = r2 - - /* Code shared with callback* */ -.L103: - /* Allocate 64 "out" registers (for the Caml code) and no locals */ - alloc r3 = ar.pfs, 0, 0, 64, 0 - add sp = -(56 * 8), sp ;; - - /* Save all callee-save registers on stack */ - add r2 = 16, sp ;; - ST8OFF(r2, r3, 8) /* 0 : ar.pfs */ - mov r3 = b0 ;; - ST8OFF(r2, r3, 8) ;; /* 1 : return address */ - ST8OFF(r2, gp, 8) /* 2 : gp */ - mov r3 = pr ;; - ST8OFF(r2, r3, 8) /* 3 : predicates */ - mov r3 = ar.fpsr ;; - ST8OFF(r2, r3, 8) /* 4 : ar.fpsr */ - mov r3 = ar.unat ;; - ST8OFF(r2, r3, 8) /* 5 : ar.unat */ - mov r3 = ar.lc ;; - ST8OFF(r2, r3, 8) /* 6 : ar.lc */ - mov r3 = b1 ;; - ST8OFF(r2, r3, 8) /* 7 - 11 : b1 - b5 */ - mov r3 = b2 ;; - ST8OFF(r2, r3, 8) - mov r3 = b3 ;; - ST8OFF(r2, r3, 8) - mov r3 = b4 ;; - ST8OFF(r2, r3, 8) - mov r3 = b5 ;; - ST8OFF(r2, r3, 8) ;; - - add r3 = 8, r2 ;; - SAVE4(r4,r5,r6,r7) ;; /* 12 - 15 : r4 - r7 */ - - add r3 = 16, r2 ;; /* 16 - 55 : f2 - f5, f16 - f31 */ - FSPILL4(f2,f3,f4,f5) ;; - FSPILL8(f16,f17,f18,f19,f20,f21,f22,f23) ;; - FSPILL8(f24,f25,f26,f27,f28,f29,f30,f31) ;; - - /* Set up a callback link on the stack. In addition to - the normal callback link contents (saved values of - caml_bottom_of_stack, caml_last_return_address and - caml_gc_regs), we also save there caml_saved_bsp - and caml_saved_rnat */ - add sp = -48, sp - LOADGLOBAL(r3, caml_bottom_of_stack#) - add r2 = 16, sp ;; - ST8OFF(r2, r3, 8) - LOADGLOBAL(r3, caml_last_return_address#) ;; - ST8OFF(r2, r3, 8) - LOADGLOBAL(r3, caml_gc_regs#) ;; - ST8OFF(r2, r3, 8) - LOADGLOBAL(r3, caml_saved_bsp#) ;; - ST8OFF(r2, r3, 8) - LOADGLOBAL(r3, caml_saved_rnat#) ;; - ST8OFF(r2, r3, 8) - - /* Set up a trap frame to catch exceptions escaping the Caml code */ - mov r6 = sp - add sp = -16, sp ;; - LOADGLOBAL(r3, caml_exception_pointer#) - add r2 = 16, sp ;; - ST8OFF(r2, r3, 8) -.L110: mov r3 = ip ;; - add r3 = .L101 - .L110, r3 ;; - ST8OFF(r2, r3, 8) ;; - - /* Save ar.bsp, flush register window, and save ar.rnat */ - mov r2 = ar.bsp ;; - STOREGLOBAL(r2, caml_saved_bsp#) ;; - mov r14 = ar.rsc ;; - and r2 = ~0x3, r14;; /* set rsc.mode = 0 */ - mov ar.rsc = r2 ;; /* RSE is in enforced lazy mode */ - flushrs ;; /* must be first instr in group */ - mov r2 = ar.rnat ;; - STOREGLOBAL(r2, caml_saved_rnat#) - mov ar.rsc = r14 /* restore original RSE mode */ - - /* Reload allocation pointers */ - LOADGLOBAL(r4, young_ptr#) - LOADGLOBAL(r5, young_limit#) - - /* We are back into Caml code */ - STOREGLOBAL(r0, caml_last_return_address#) - - /* Call the Caml code */ - br.call.sptk b0 = b6 ;; -.L102: - - /* Pop the trap frame, restoring caml_exception_pointer */ - add sp = 16, sp ;; - ld8 r2 = [sp] ;; - STOREGLOBAL(r2, caml_exception_pointer#) - -.L104: - /* Pop the callback link, restoring the global variables */ - add r14 = 16, sp ;; - LD8OFF(r2, r14, 8) ;; - STOREGLOBAL(r2, caml_bottom_of_stack#) - LD8OFF(r2, r14, 8) ;; - STOREGLOBAL(r2, caml_last_return_address#) - LD8OFF(r2, r14, 8) ;; - STOREGLOBAL(r2, caml_gc_regs#) - LD8OFF(r2, r14, 8) ;; - STOREGLOBAL(r2, caml_saved_bsp#) - LD8OFF(r2, r14, 8) ;; - STOREGLOBAL(r2, caml_saved_rnat#) - add sp = 48, sp - - /* Update allocation pointer */ - STOREGLOBAL(r4, young_ptr#) - - /* Restore all callee-save registers from stack */ - add r2 = 16, sp ;; - LD8OFF(r3, r2, 8) ;; /* 0 : ar.pfs */ - mov ar.pfs = r3 - LD8OFF(r3, r2, 8) ;; /* 1 : return address */ - mov b0 = r3 - LD8OFF(gp, r2, 8) ;; /* 2 : gp */ - LD8OFF(r3, r2, 8) ;; /* 3 : predicates */ - mov pr = r3, -1 - LD8OFF(r3, r2, 8) ;; /* 4 : ar.fpsr */ - mov ar.fpsr = r3 - LD8OFF(r3, r2, 8) ;; /* 5 : ar.unat */ - mov ar.unat = r3 - LD8OFF(r3, r2, 8) ;; /* 6 : ar.lc */ - mov ar.lc = r3 - LD8OFF(r3, r2, 8) ;; /* 7 - 11 : b1 - b5 */ - mov b1 = r3 - LD8OFF(r3, r2, 8) ;; - mov b2 = r3 - LD8OFF(r3, r2, 8) ;; - mov b3 = r3 - LD8OFF(r3, r2, 8) ;; - mov b4 = r3 - LD8OFF(r3, r2, 8) ;; - mov b5 = r3 - - add r3 = 8, r2 ;; - LOAD4(r4,r5,r6,r7) ;; /* 12 - 15 : r4 - r7 */ - - add r3 = 16, r2 ;; /* 16 - 55 : f2 - f5, f16 - f31 */ - FFILL4(f2,f3,f4,f5) ;; - FFILL8(f16,f17,f18,f19,f20,f21,f22,f23) ;; - FFILL8(f24,f25,f26,f27,f28,f29,f30,f31) ;; - - /* Pop stack frame and return */ - add sp = (56 * 8), sp - br.ret.sptk.many b0 ;; - - /* The trap handler */ -.L101: - /* Save exception pointer */ - STOREGLOBAL(r6, caml_exception_pointer#) - - /* Encode exception bucket as exception result */ - or r8 = 2, r8 - - /* Return it */ - br.sptk .L104 ;; - - .endp caml_start_program# - -/* Raise an exception from C */ - - .global raise_caml_exception# - .proc raise_caml_exception# - .align 16 -raise_caml_exception: - /* Allocate 64 "out" registers (for the Caml code) and no locals */ - /* Since we don't return, don't bother saving the PFS */ - alloc r2 = ar.pfs, 0, 0, 64, 0 - - /* Move exn bucket where Caml expects it */ - mov r8 = r32 ;; - - /* Perform "context switch" as per the Software Conventions Guide, - chapter 10 */ - flushrs ;; /* flush dirty registers to stack */ - mov r14 = ar.rsc ;; - and r2 = ~0x3, r14;; /* set rsc.mode = 0 */ - dep r2 = r0, r2, 16, 4 ;; /* clear rsc.loadrs */ - mov ar.rsc = r2 ;; /* RSE is in enforced lazy mode */ - invala ;; /* Invalidate ALAT */ - LOADGLOBAL(r2, caml_saved_bsp#) ;; - mov ar.bspstore = r2 /* Restore ar.bspstore */ - LOADGLOBAL(r2, caml_saved_rnat#) ;; - mov ar.rnat = r2 /* Restore ar.rnat */ - mov ar.rsc = r14 ;; /* Restore original RSE mode */ - - /* Reload allocation pointers and exception pointer */ - LOADGLOBAL(r4, young_ptr#) - LOADGLOBAL(r5, young_limit#) - LOADGLOBAL(r6, caml_exception_pointer#) - - /* Say that we're back into Caml */ - STOREGLOBAL(r0, caml_last_return_address#) - - /* Raise the exception proper */ - mov sp = r6 - add r2 = 8, r6 ;; - ld8 r6 = [r6] - ld8 r2 = [r2] ;; - mov b6 = r2 ;; - - /* Branch to handler. Must use a call so as to set up the - CFM and PFS correctly. */ - br.call.sptk.many b0 = b6 - - .endp raise_caml_exception - -/* Callbacks from C to Caml */ - - .global callback_exn# - .proc callback_exn# - .align 16 -callback_exn: - /* Initial shuffling of arguments */ - ld8 r3 = [r32] /* code pointer */ - mov r2 = r32 - mov r32 = r33 ;; /* first arg */ - mov r33 = r2 /* environment */ - mov b6 = r3 - br.sptk .L103 ;; - - .endp callback_exn# - - .global callback2_exn# - .proc callback2_exn# - .align 16 -callback2_exn: - /* Initial shuffling of arguments */ - ADDRGLOBAL(r3, caml_apply2) /* code pointer */ - mov r2 = r32 - mov r32 = r33 /* first arg */ - mov r33 = r34 ;; /* second arg */ - mov r34 = r2 /* environment */ - mov b6 = r3 - br.sptk .L103 ;; - - .endp callback2_exn# - - .global callback3_exn# - .proc callback3_exn# - .align 16 -callback3_exn: - /* Initial shuffling of arguments */ - ADDRGLOBAL(r3, caml_apply3) /* code pointer */ - mov r2 = r32 - mov r32 = r33 /* first arg */ - mov r33 = r34 /* second arg */ - mov r34 = r35 ;; /* third arg */ - mov r35 = r2 /* environment */ - mov b6 = r3 - br.sptk .L103 ;; - - .endp callback3_exn# - -/* Glue code to call array_bound_error */ - - .global caml_array_bound_error# - .proc caml_array_bound_error# - .align 16 -caml_array_bound_error: - ADDRGLOBAL(r2, @fptr(array_bound_error#)) - br.sptk caml_c_call /* never returns */ - - .rodata - - .global system__frametable# - .type system__frametable#, @object - .size system__frametable#, 8 -system__frametable: - data8 1 /* one descriptor */ - data8 .L102 /* return address into callback */ - data2 -1 /* negative frame size => use callback link */ - data2 0 /* no roots here */ - .align 8 - -/* Global variables used by raise_caml_exception */ - - .common caml_saved_bsp#, 8, 8 - .common caml_saved_rnat#, 8, 8 diff --git a/asmrun/m68k.S b/asmrun/m68k.S deleted file mode 100644 index 85de3fb3dc..0000000000 --- a/asmrun/m68k.S +++ /dev/null @@ -1,244 +0,0 @@ -|*********************************************************************** -|* * -|* Objective Caml * -|* * -|* Xavier Leroy, projet Cristal, INRIA Rocquencourt * -|* * -|* Copyright 1996 Institut National de Recherche en Informatique et * -|* en Automatique. All rights reserved. This file is distributed * -|* under the terms of the GNU Library General Public License, with * -|* the special exception on linking described in file ../LICENSE. * -|* * -|*********************************************************************** - -| $Id$ - -| Asm part of the runtime system, Motorola 68k processor - - .comm _caml_requested_size, 4 - -| Allocation - - .text - .globl _caml_call_gc - .globl _caml_alloc1 - .globl _caml_alloc2 - .globl _caml_alloc3 - .globl _caml_alloc - -_caml_call_gc: - | Save desired size - movel d5, _caml_requested_size - | Record lowest stack address and return address - movel a7@, _caml_last_return_address - movel a7, d5 - addql #4, d5 - movel d5, _caml_bottom_of_stack - | Record current allocation pointer (for debugging) - movel d6, _young_ptr - | Save all regs used by the code generator - movel d4, a7@- - movel d3, a7@- - movel d2, a7@- - movel d1, a7@- - movel d0, a7@- - movel a6, a7@- - movel a5, a7@- - movel a4, a7@- - movel a3, a7@- - movel a2, a7@- - movel a1, a7@- - movel a0, a7@- - movel a7, _caml_gc_regs - fmovem fp0-fp7, a7@- - | Call the garbage collector - jbsr _garbage_collection - | Restore all regs used by the code generator - fmovem a7@+, fp0-fp7 - movel a7@+, a0 - movel a7@+, a1 - movel a7@+, a2 - movel a7@+, a3 - movel a7@+, a4 - movel a7@+, a5 - movel a7@+, a6 - movel a7@+, d0 - movel a7@+, d1 - movel a7@+, d2 - movel a7@+, d3 - movel a7@+, d4 - | Reload allocation pointer and allocate block - movel _young_ptr, d6 - subl _caml_requested_size, d6 - | Return to caller - rts - -_caml_alloc1: - subql #8, d6 - cmpl _young_limit, d6 - bcs L100 - rts -L100: moveq #8, d5 - bra _caml_call_gc - -_caml_alloc2: - subl #12, d6 - cmpl _young_limit, d6 - bcs L101 - rts -L101: moveq #12, d5 - bra _caml_call_gc - -_caml_alloc3: - subl #16, d6 - cmpl _young_limit, d6 - bcs L102 - rts -L102: moveq #16, d5 - bra _caml_call_gc - -_caml_alloc: - subl d5, d6 - cmpl _young_limit, d6 - bcs _caml_call_gc - rts - -| Call a C function from Caml - - .globl _caml_c_call - -_caml_c_call: - | Record lowest stack address and return address - movel a7@+, _caml_last_return_address - movel a7, _caml_bottom_of_stack - | Save allocation pointer and exception pointer - movel d6, _young_ptr - movel d7, _caml_exception_pointer - | Call the function (address in a0) - jbsr a0@ - | Reload allocation pointer - movel _young_ptr, d6 - | Return to caller - movel _caml_last_return_address, a1 - jmp a1@ - -| Start the Caml program - - .globl _caml_start_program - -_caml_start_program: - | Save callee-save registers - moveml a2-a6/d2-d7, a7@- - fmovem fp2-fp7, a7@- - | Initial code point is caml_program - lea _caml_program, a5 - -| Code shared between caml_start_program and callback* - -L106: - | Build a callback link - movel _caml_gc_regs, a7@- - movel _caml_last_return_address, a7@- - movel _caml_bottom_of_stack, a7@- - | Build an exception handler - pea L108 - movel _caml_exception_pointer, a7@- - movel a7, d7 - | Load allocation pointer - movel _young_ptr, d6 - | Call the Caml code - jbsr a5@ -L107: - | Move result where C code expects it - movel a0, d0 - | Save allocation pointer - movel d6, _young_ptr - | Pop the exception handler - movel a7@+, _caml_exception_pointer - addql #4, a7 -L109: - | Pop the callback link, restoring the global variables - | used by caml_c_call - movel a7@+, _caml_bottom_of_stack - movel a7@+, _caml_last_return_address - movel a7@+, _caml_gc_regs - | Restore callee-save registers and return - fmovem a7@+, fp2-fp7 - moveml a7@+, a2-a6/d2-d7 - unlk a6 - rts -L108: - | Exception handler - | Save allocation pointer and exception pointer - movel d6, _young_ptr - movel d7, _caml_exception_pointer - | Encode exception bucket as an exception result - movel a0, d0 - orl #2, d0 - | Return it - bra L109 - -| Raise an exception from C - - .globl _raise_caml_exception -_raise_caml_exception: - movel a7@(4), a0 | exception bucket - movel _young_ptr, d6 - movel _caml_exception_pointer, a7 - movel a7@+, d7 - rts - -| Callback from C to Caml - - .globl _callback_exn -_callback_exn: - link a6, #0 - | Save callee-save registers - moveml a2-a6/d2-d7, a7@- - fmovem fp2-fp7, a7@- - | Initial loading of arguments - movel a6@(8), a1 | closure - movel a6@(12), a0 | argument - movel a1@(0), a5 | code pointer - bra L106 - - .globl _callback2_exn -_callback2_exn: - link a6, #0 - | Save callee-save registers - moveml a2-a6/d2-d7, a7@- - fmovem fp2-fp7, a7@- - | Initial loading of arguments - movel a6@(8), a2 | closure - movel a6@(12), a0 | first argument - movel a6@(16), a1 | second argument - lea _caml_apply2, a5 | code pointer - bra L106 - - .globl _callback3_exn -_callback3_exn: - link a6, #0 - | Save callee-save registers - moveml a2-a6/d2-d7, a7@- - fmovem fp2-fp7, a7@- - | Initial loading of arguments - movel a6@(8), a3 | closure - movel a6@(12), a0 | first argument - movel a6@(16), a1 | second argument - movel a6@(20), a2 | third argument - lea _caml_apply3, a5 | code pointer - bra L106 - - .globl _caml_array_bound_error -_caml_array_bound_error: - | Load address of array_bound_error in a0 and call it - lea _array_bound_error, a0 - bra _caml_c_call - - .data - .globl _system__frametable -_system__frametable: - .long 1 | one descriptor - .long L107 | return address into callback - .word -1 | negative frame size => use callback link - .word 0 | no roots here diff --git a/asmrun/mips.s b/asmrun/mips.s deleted file mode 100644 index 26853c0d8d..0000000000 --- a/asmrun/mips.s +++ /dev/null @@ -1,386 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -/* Asm part of the runtime system, Mips processor, IRIX n32 conventions */ - -/* Allocation */ - - .text - - .globl caml_call_gc - .ent caml_call_gc - -caml_call_gc: - /* Reserve stack space for registers and saved $gp */ - /* 32 * 8 = 0x100 for float regs - 22 * 4 = 0x58 for integer regs - 8 = 0x8 for saved $gp ====> 0x160 total */ - subu $sp, $sp, 0x160 - /* Reinit $gp */ - .cpsetup $25, 0x158, caml_call_gc - /* Record return address */ - sw $31, caml_last_return_address - /* Record lowest stack address */ - addu $24, $sp, 0x160 - sw $24, caml_bottom_of_stack - /* Save pointer to register array */ - addu $24, $sp, 0x100 - sw $24, caml_gc_regs - /* Save current allocation pointer for debugging purposes */ - sw $22, young_ptr - /* Save the exception handler (if e.g. a sighandler raises) */ - sw $30, caml_exception_pointer - /* Save all regs used by the code generator on the stack */ - sw $2, 2 * 4($24) - sw $3, 3 * 4($24) - sw $4, 4 * 4($24) - sw $5, 5 * 4($24) - sw $6, 6 * 4($24) - sw $7, 7 * 4($24) - sw $8, 8 * 4($24) - sw $9, 9 * 4($24) - sw $10, 10 * 4($24) - sw $11, 11 * 4($24) - sw $12, 12 * 4($24) - sw $13, 13 * 4($24) - sw $14, 14 * 4($24) - sw $15, 15 * 4($24) - sw $16, 16 * 4($24) - sw $17, 17 * 4($24) - sw $18, 18 * 4($24) - sw $19, 19 * 4($24) - sw $20, 20 * 4($24) - sw $21, 21 * 4($24) - s.d $f0, 0 * 8($sp) - s.d $f1, 1 * 8($sp) - s.d $f2, 2 * 8($sp) - s.d $f3, 3 * 8($sp) - s.d $f4, 4 * 8($sp) - s.d $f5, 5 * 8($sp) - s.d $f6, 6 * 8($sp) - s.d $f7, 7 * 8($sp) - s.d $f8, 8 * 8($sp) - s.d $f9, 9 * 8($sp) - s.d $f10, 10 * 8($sp) - s.d $f11, 11 * 8($sp) - s.d $f12, 12 * 8($sp) - s.d $f13, 13 * 8($sp) - s.d $f14, 14 * 8($sp) - s.d $f15, 15 * 8($sp) - s.d $f16, 16 * 8($sp) - s.d $f17, 17 * 8($sp) - s.d $f18, 18 * 8($sp) - s.d $f19, 19 * 8($sp) - s.d $f20, 20 * 8($sp) - s.d $f21, 21 * 8($sp) - s.d $f22, 22 * 8($sp) - s.d $f23, 23 * 8($sp) - s.d $f24, 24 * 8($sp) - s.d $f25, 25 * 8($sp) - s.d $f26, 26 * 8($sp) - s.d $f27, 27 * 8($sp) - s.d $f28, 28 * 8($sp) - s.d $f29, 29 * 8($sp) - s.d $f30, 30 * 8($sp) - s.d $f31, 31 * 8($sp) - /* Call the garbage collector */ - jal garbage_collection - /* Restore all regs used by the code generator */ - addu $24, $sp, 0x100 - lw $2, 2 * 4($24) - lw $3, 3 * 4($24) - lw $4, 4 * 4($24) - lw $5, 5 * 4($24) - lw $6, 6 * 4($24) - lw $7, 7 * 4($24) - lw $8, 8 * 4($24) - lw $9, 9 * 4($24) - lw $10, 10 * 4($24) - lw $11, 11 * 4($24) - lw $12, 12 * 4($24) - lw $13, 13 * 4($24) - lw $14, 14 * 4($24) - lw $15, 15 * 4($24) - lw $16, 16 * 4($24) - lw $17, 17 * 4($24) - lw $18, 18 * 4($24) - lw $19, 19 * 4($24) - lw $20, 20 * 4($24) - lw $21, 21 * 4($24) - l.d $f0, 0 * 8($sp) - l.d $f1, 1 * 8($sp) - l.d $f2, 2 * 8($sp) - l.d $f3, 3 * 8($sp) - l.d $f4, 4 * 8($sp) - l.d $f5, 5 * 8($sp) - l.d $f6, 6 * 8($sp) - l.d $f7, 7 * 8($sp) - l.d $f8, 8 * 8($sp) - l.d $f9, 9 * 8($sp) - l.d $f10, 10 * 8($sp) - l.d $f11, 11 * 8($sp) - l.d $f12, 12 * 8($sp) - l.d $f13, 13 * 8($sp) - l.d $f14, 14 * 8($sp) - l.d $f15, 15 * 8($sp) - l.d $f16, 16 * 8($sp) - l.d $f17, 17 * 8($sp) - l.d $f18, 18 * 8($sp) - l.d $f19, 19 * 8($sp) - l.d $f20, 20 * 8($sp) - l.d $f21, 21 * 8($sp) - l.d $f22, 22 * 8($sp) - l.d $f23, 23 * 8($sp) - l.d $f24, 24 * 8($sp) - l.d $f25, 25 * 8($sp) - l.d $f26, 26 * 8($sp) - l.d $f27, 27 * 8($sp) - l.d $f28, 28 * 8($sp) - l.d $f29, 29 * 8($sp) - l.d $f30, 30 * 8($sp) - l.d $f31, 31 * 8($sp) - /* Reload new allocation pointer and allocation limit */ - lw $22, young_ptr - lw $23, young_limit - /* Reload return address */ - lw $31, caml_last_return_address - /* Say that we are back into Caml code */ - sw $0, caml_last_return_address - /* Adjust return address to restart the allocation sequence */ - subu $31, $31, 16 - /* Return */ - .cpreturn - addu $sp, $sp, 0x160 - j $31 - - .end caml_call_gc - -/* Call a C function from Caml */ - - .globl caml_c_call - .ent caml_c_call - -caml_c_call: - /* Function to call is in $24 */ - /* Set up $gp, saving caller's $gp in callee-save register $19 */ - .cpsetup $25, $19, caml_c_call - /* Preload addresses of interesting global variables - in callee-save registers */ - la $16, caml_last_return_address - la $17, young_ptr - /* Save return address, bottom of stack, alloc ptr, exn ptr */ - sw $31, 0($16) /* caml_last_return_address */ - sw $sp, caml_bottom_of_stack - sw $22, 0($17) /* young_ptr */ - sw $30, caml_exception_pointer - /* Call C function */ - move $25, $24 - jal $24 - /* Reload return address, alloc ptr, alloc limit */ - lw $31, 0($16) /* caml_last_return_address */ - lw $22, 0($17) /* young_ptr */ - lw $23, young_limit /* young_limit */ - /* Zero caml_last_return_address, indicating we're back in Caml code */ - sw $0, 0($16) /* caml_last_return_address */ - /* Restore $gp and return */ - move $gp, $19 - j $31 - .end caml_c_call - -/* Start the Caml program */ - - .globl caml_start_program - .globl stray_exn_handler - .ent caml_start_program -caml_start_program: - /* Reserve space for callee-save registers */ - subu $sp, $sp, 0x90 - /* Setup $gp */ - .cpsetup $25, 0x80, caml_start_program - /* Load in $24 the code address to call */ - la $24, caml_program - /* Code shared with callback* */ -$103: - /* Save return address */ - sd $31, 0x88($sp) - /* Save all callee-save registers */ - sd $16, 0x0($sp) - sd $17, 0x8($sp) - sd $18, 0x10($sp) - sd $19, 0x18($sp) - sd $20, 0x20($sp) - sd $21, 0x28($sp) - sd $22, 0x30($sp) - sd $23, 0x38($sp) - sd $30, 0x40($sp) - s.d $f20, 0x48($sp) - s.d $f22, 0x50($sp) - s.d $f24, 0x58($sp) - s.d $f26, 0x60($sp) - s.d $f28, 0x68($sp) - s.d $f30, 0x70($sp) - /* Set up a callback link on the stack. */ - subu $sp, $sp, 16 - lw $2, caml_bottom_of_stack - sw $2, 0($sp) - lw $3, caml_last_return_address - sw $3, 4($sp) - lw $4, caml_gc_regs - sw $4, 8($sp) - /* Set up a trap frame to catch exceptions escaping the Caml code */ - subu $sp, $sp, 16 - lw $30, caml_exception_pointer - sw $30, 0($sp) - la $2, $105 - sw $2, 4($sp) - sw $gp, 8($sp) - move $30, $sp - /* Reload allocation pointers */ - lw $22, young_ptr - lw $23, young_limit - /* Say that we are back into Caml code */ - sw $0, caml_last_return_address - /* Call the Caml code */ - move $25, $24 - jal $24 -$104: - /* Pop the trap frame, restoring caml_exception_pointer */ - lw $24, 0($sp) - sw $24, caml_exception_pointer - addu $sp, $sp, 16 -$106: - /* Pop the callback link, restoring the global variables */ - lw $24, 0($sp) - sw $24, caml_bottom_of_stack - lw $25, 4($sp) - sw $25, caml_last_return_address - lw $24, 8($sp) - sw $24, caml_gc_regs - addu $sp, $sp, 16 - /* Update allocation pointer */ - sw $22, young_ptr - /* Reload callee-save registers and return */ - ld $31, 0x88($sp) - ld $16, 0x0($sp) - ld $17, 0x8($sp) - ld $18, 0x10($sp) - ld $19, 0x18($sp) - ld $20, 0x20($sp) - ld $21, 0x28($sp) - ld $22, 0x30($sp) - ld $23, 0x38($sp) - ld $30, 0x40($sp) - l.d $f20, 0x48($sp) - l.d $f22, 0x50($sp) - l.d $f24, 0x58($sp) - l.d $f26, 0x60($sp) - l.d $f28, 0x68($sp) - l.d $f30, 0x70($sp) - .cpreturn - addu $sp, $sp, 0x90 - j $31 - - /* The trap handler: encode exception bucket as an exception result - and return it */ -$105: - sw $30, caml_exception_pointer - or $2, $2, 2 - b $106 - - .end caml_start_program - -/* Raise an exception from C */ - - .globl raise_caml_exception - .ent raise_caml_exception -raise_caml_exception: - /* Setup $gp, discarding caller's $gp (we won't return) */ - .cpsetup $25, $24, raise_caml_exception - /* Branch to exn handler */ - move $2, $4 - lw $22, young_ptr - lw $23, young_limit - lw $sp, caml_exception_pointer - lw $30, 0($sp) - lw $24, 4($sp) - lw $gp, 8($sp) - addu $sp, $sp, 16 - j $24 - - .end raise_caml_exception - -/* Callback from C to Caml */ - - .globl callback_exn - .ent callback_exn -callback_exn: - subu $sp, $sp, 0x90 - .cpsetup $25, 0x80, callback_exn - /* Initial shuffling of arguments */ - move $9, $4 /* closure */ - move $8, $5 /* argument */ - lw $24, 0($4) /* code pointer */ - b $103 - .end callback_exn - - .globl callback2_exn - .ent callback2_exn -callback2_exn: - subu $sp, $sp, 0x90 - .cpsetup $25, 0x80, callback2_exn - /* Initial shuffling of arguments */ - move $10, $4 /* closure */ - move $8, $5 /* first argument */ - move $9, $6 /* second argument */ - la $24, caml_apply2 /* code pointer */ - b $103 - - .end callback2_exn - - .globl callback3_exn - .ent callback3_exn -callback3_exn: - subu $sp, $sp, 0x90 - .cpsetup $25, 0x80, callback3_exn - /* Initial shuffling of arguments */ - move $11, $4 /* closure */ - move $8, $5 /* first argument */ - move $9, $6 /* second argument */ - move $10, $7 /* third argument */ - la $24, caml_apply3 /* code pointer */ - b $103 - - .end callback3_exn - -/* Glue code to call array_bound_error */ - - .globl caml_array_bound_error - .ent caml_array_bound_error - -caml_array_bound_error: - /* Setup $gp, discarding caller's $gp (we won't return) */ - .cpsetup $25, $24, caml_array_bound_error - la $24, array_bound_error - jal caml_c_call /* never returns */ - - .end caml_array_bound_error - - .rdata - .globl system__frametable -system__frametable: - .word 1 /* one descriptor */ - .word $104 /* return address into callback */ - .half -1 /* negative frame size => use callback link */ - .half 0 /* no roots here */ diff --git a/asmrun/power-aix.S b/asmrun/power-aix.S deleted file mode 100644 index 3baa5f9665..0000000000 --- a/asmrun/power-aix.S +++ /dev/null @@ -1,513 +0,0 @@ -#********************************************************************* -#* * -#* Objective Caml * -#* * -#* Xavier Leroy, projet Cristal, INRIA Rocquencourt * -#* * -#* Copyright 1996 Institut National de Recherche en Informatique et * -#* en Automatique. All rights reserved. This file is distributed * -#* under the terms of the GNU Library General Public License, with * -#* the special exception on linking described in file ../LICENSE. * -#* * -#********************************************************************* - -# $Id$ - - .csect .text[PR] - -#### Invoke the garbage collector. r0 contains the return address - - .globl .caml_call_gc -.caml_call_gc: - # Set up stack frame - stwu 1, -0x1C0(1) - # 0x1C0 = 4*32 (int regs) + 8*32 (float regs) + 64 (space for C call) - # Record last return address into Caml code - lwz 11, L..caml_last_return_address(2) - stw 0, 0(11) - # Record return address into call_gc stub code - mflr 0 - stw 0, 0x1C0+8(1) - # Record lowest stack address - lwz 11, L..caml_bottom_of_stack(2) - addi 0, 1, 0x1C0 - stw 0, 0(11) - # Record pointer to register array - lwz 11, L..caml_gc_regs(2) - addi 0, 1, 8*32 + 64 - stw 0, 0(11) - # Save current allocation pointer for debugging purposes - lwz 11, L..young_ptr(2) - stw 31, 0(11) - # Save exception pointer (if e.g. a sighandler raises) - lwz 11, L..caml_exception_pointer(2) - stw 29, 0(11) - # Save all registers used by the code generator - addi 11, 1, 8*32 + 64 - 4 - stwu 3, 4(11) - stwu 4, 4(11) - stwu 5, 4(11) - stwu 6, 4(11) - stwu 7, 4(11) - stwu 8, 4(11) - stwu 9, 4(11) - stwu 10, 4(11) - 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) - addi 11, 1, 64 - 8 - stfdu 1, 8(11) - stfdu 2, 8(11) - stfdu 3, 8(11) - stfdu 4, 8(11) - stfdu 5, 8(11) - stfdu 6, 8(11) - stfdu 7, 8(11) - stfdu 8, 8(11) - stfdu 9, 8(11) - stfdu 10, 8(11) - stfdu 11, 8(11) - stfdu 12, 8(11) - stfdu 13, 8(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) - # Call the GC - bl .garbage_collection - or 0, 0, 0 - # Reload new allocation pointer and allocation limit - lwz 11, L..young_ptr(2) - lwz 31, 0(11) - lwz 11, L..young_limit(2) - lwz 30, 0(11) - # Restore all regs used by the code generator - addi 11, 1, 8*32 + 64 - 4 - lwzu 3, 4(11) - lwzu 4, 4(11) - lwzu 5, 4(11) - lwzu 6, 4(11) - lwzu 7, 4(11) - lwzu 8, 4(11) - lwzu 9, 4(11) - lwzu 10, 4(11) - 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) - addi 11, 1, 64 - 8 - lfdu 1, 8(11) - lfdu 2, 8(11) - lfdu 3, 8(11) - lfdu 4, 8(11) - lfdu 5, 8(11) - lfdu 6, 8(11) - lfdu 7, 8(11) - lfdu 8, 8(11) - lfdu 9, 8(11) - lfdu 10, 8(11) - lfdu 11, 8(11) - lfdu 12, 8(11) - lfdu 13, 8(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) - # Return to caller (the stub code), leaving return address into - # Caml code in the link register - lwz 0, 0x1C0+8(1) - mtctr 0 - lwz 11, L..caml_last_return_address(2) - lwz 0, 0(11) - addic 0, 0, -16 # Restart the allocation (4 instructions) - mtlr 0 - # Say we are back into Caml code - li 12, 0 - stw 12, 0(11) # 11 still points to caml_last_return_address - # Deallocate stack frame - addi 1, 1, 0x1C0 - # Return - bctr - -#### Call a C function from Caml - - .globl .caml_c_call -.caml_c_call: - # Save return address in 25 - mflr 25 - # Record lowest stack address and return address - lwz 27, L..caml_bottom_of_stack(2) - lwz 24, L..caml_last_return_address(2) - stw 1, 0(27) - stw 25, 0(24) - # Make the exception handler and alloc ptr available to the C code - lwz 27, L..young_ptr(2) - lwz 26, L..caml_exception_pointer(2) - stw 31, 0(27) - stw 29, 0(26) - # Preserve RTOC and return address in callee-save registers - # The C function will preserve them, and the Caml code does not - # expect them to be preserved - # Return address is in 25, RTOC is in 26, pointer to young_ptr in 27, - # pointer to caml_last_return_address is in 24 - # Call the function (descriptor in 11) - lwz 0, 0(11) - mr 26, 2 - mtlr 0 - lwz 2, 4(11) - lwz 11, 8(11) - blrl - # Restore return address - mtlr 25 - # Restore RTOC - mr 2, 26 - # Reload allocation pointer - lwz 31, 0(27) # 27 still points to young_ptr - # Say we are back into Caml code - li 12, 0 - stw 12, 0(24) # 24 still points to caml_last_return_address - # Return to caller - blr - -#### Raise an exception from C - - .globl .raise_caml_exception -.raise_caml_exception: - # Reload Caml global registers - lwz 4, L..caml_exception_pointer(2) - lwz 5, L..young_ptr(2) - lwz 6, L..young_limit(2) - lwz 1, 0(4) - lwz 31, 0(5) - lwz 30, 0(6) - # Say we are back into Caml code - lwz 4, L..caml_last_return_address(2) - li 0, 0 - stw 0, 0(4) - # Pop trap frame - lwz 0, 0(1) - lwz 29, 4(1) - mtlr 0 - lwz 2, 20(1) - addi 1, 1, 32 - # Branch to handler - blr - -#### Start the Caml program - - .globl .caml_start_program -.caml_start_program: - lwz 11, L..caml_program(2) - -#### Code shared between caml_start_program and callback* - -L..102: - mflr 0 - # Save return address - stw 0, 8(1) - # Save all callee-save registers - stw 13, -76(1) - stw 14, -72(1) - stw 15, -68(1) - stw 16, -64(1) - stw 17, -60(1) - stw 18, -56(1) - stw 19, -52(1) - stw 20, -48(1) - stw 21, -44(1) - stw 22, -40(1) - stw 23, -36(1) - stw 24, -32(1) - stw 25, -28(1) - stw 26, -24(1) - stw 27, -20(1) - stw 28, -16(1) - stw 29, -12(1) - stw 30, -8(1) - stw 31, -4(1) - stfd 14, -224(1) - stfd 15, -216(1) - stfd 16, -208(1) - stfd 17, -200(1) - stfd 18, -192(1) - stfd 19, -184(1) - stfd 20, -176(1) - stfd 21, -168(1) - stfd 22, -160(1) - stfd 23, -152(1) - stfd 24, -144(1) - stfd 25, -136(1) - stfd 26, -128(1) - stfd 27, -120(1) - stfd 28, -112(1) - stfd 29, -104(1) - stfd 30, -96(1) - stfd 31, -88(1) - # Allocate and link stack frame - stwu 1, -288(1) - # Set up a callback link - addi 1, 1, -32 - lwz 9, L..caml_bottom_of_stack(2) - lwz 10, L..caml_last_return_address(2) - lwz 12, L..caml_gc_regs(2) - lwz 9, 0(9) - lwz 10, 0(10) - lwz 12, 0(12) - stw 9, 0(1) - stw 10, 4(1) - stw 12, 8(1) - # Build an exception handler to catch exceptions escaping out of Caml - bl L..103 - b L..104 -L..103: - addi 1, 1, -32 - lwz 9, L..caml_exception_pointer(2) - mflr 0 - lwz 29, 0(9) - stw 0, 0(1) - stw 29, 4(1) - stw 2, 20(1) - mr 29, 1 - # Reload allocation pointers - lwz 9, L..young_ptr(2) - lwz 10, L..young_limit(2) - lwz 31, 0(9) - lwz 30, 0(10) - # Say we are back into Caml code - lwz 9, L..caml_last_return_address(2) - li 0, 0 - stw 0, 0(9) - # Call the Caml code - lwz 0, 0(11) - stw 2, 20(1) - mtlr 0 - lwz 2, 4(11) -L..105: - blrl - lwz 2, 20(1) - # Pop the trap frame, restoring caml_exception_pointer - lwz 9, 4(1) - lwz 10, L..caml_exception_pointer(2) - addi 1, 1, 32 - stw 9, 0(10) - # Pop the callback link, restoring the global variables -L..106: - lwz 7, 0(1) - lwz 8, 4(1) - lwz 9, 8(1) - lwz 10, L..caml_bottom_of_stack(2) - lwz 11, L..caml_last_return_address(2) - lwz 12, L..caml_gc_regs(2) - stw 7, 0(10) - stw 8, 0(11) - stw 9, 0(12) - addi 1, 1, 32 - # Update allocation pointer - lwz 11, L..young_ptr(2) - stw 31, 0(11) - # Deallocate stack frame - addi 1, 1, 288 - # Restore callee-save registers - lwz 13, -76(1) - lwz 14, -72(1) - lwz 15, -68(1) - lwz 16, -64(1) - lwz 17, -60(1) - lwz 18, -56(1) - lwz 19, -52(1) - lwz 20, -48(1) - lwz 21, -44(1) - lwz 22, -40(1) - lwz 23, -36(1) - lwz 24, -32(1) - lwz 25, -28(1) - lwz 26, -24(1) - lwz 27, -20(1) - lwz 28, -16(1) - lwz 29, -12(1) - lwz 30, -8(1) - lwz 31, -4(1) - lfd 14, -224(1) - lfd 15, -216(1) - lfd 16, -208(1) - lfd 17, -200(1) - lfd 18, -192(1) - lfd 19, -184(1) - lfd 20, -176(1) - lfd 21, -168(1) - lfd 22, -160(1) - lfd 23, -152(1) - lfd 24, -144(1) - lfd 25, -136(1) - lfd 26, -128(1) - lfd 27, -120(1) - lfd 28, -112(1) - lfd 29, -104(1) - lfd 30, -96(1) - lfd 31, -88(1) - # Reload return address - lwz 0, 8(1) - mtlr 0 - # Return - blr - # The trap handler: -L..104: - # Update caml_exception_pointer - lwz 9, L..caml_exception_pointer(2) - stw 29, 0(9) - # Encode exception bucket as an exception result and return it - ori 3, 3, 2 - b L..106 - -#### Callback from C to Caml - - .globl .callback_exn -.callback_exn: - # Initial shuffling of arguments - mr 0, 3 # Closure - mr 3, 4 # Argument - mr 4, 0 - lwz 11, 0(4) # Code pointer - b L..102 - - .globl .callback2_exn -.callback2_exn: - mr 0, 3 # Closure - mr 3, 4 # First argument - mr 4, 5 # Second argument - mr 5, 0 - lwz 11, L..caml_apply2(2) - b L..102 - - .globl .callback3_exn -.callback3_exn: - mr 0, 3 # Closure - mr 3, 4 # First argument - mr 4, 5 # Second argument - mr 5, 6 # Third argument - mr 6, 0 - lwz 11, L..caml_apply3(2) - b L..102 - -#### Frame table - - .csect .data[RW] - .globl system__frametable -system__frametable: - .long 1 # one descriptor - .long L..105 + 4 # return address into callback - .short -1 # negative size count => use callback link - .short 0 # no roots here - -#### TOC entries - - .toc -L..young_limit: - .tc young_limit[TC], young_limit -L..young_ptr: - .tc young_ptr[TC], young_ptr -L..caml_bottom_of_stack: - .tc caml_bottom_of_stack[TC], caml_bottom_of_stack -L..caml_last_return_address: - .tc caml_last_return_address[TC], caml_last_return_address -L..caml_gc_regs: - .tc caml_gc_regs[TC], caml_gc_regs -L..caml_exception_pointer: - .tc caml_exception_pointer[TC], caml_exception_pointer -L..gc_entry_regs: - .tc gc_entry_regs[TC], gc_entry_regs -L..gc_entry_float_regs: - .tc gc_entry_float_regs[TC], gc_entry_float_regs -L..caml_program: - .tc caml_program[TC], caml_program -L..caml_apply2: - .tc caml_apply2[TC], caml_apply2 -L..caml_apply3: - .tc caml_apply3[TC], caml_apply3 - -#### Function closures - - .csect caml_call_gc[DS] -caml_call_gc: - .long .caml_call_gc, TOC[tc0], 0 - - .globl caml_c_call - .csect caml_c_call[DS] -caml_c_call: - .long .caml_c_call, TOC[tc0], 0 - - .globl raise_caml_exception - .csect raise_caml_exception[DS] -raise_caml_exception: - .long .raise_caml_exception, TOC[tc0], 0 - - .globl caml_start_program - .csect caml_start_program[DS] -caml_start_program: - .long .caml_start_program, TOC[tc0], 0 - - .globl callback_exn - .csect callback_exn[DS] -callback_exn: - .long .callback_exn, TOC[tc0], 0 - - .globl callback2_exn - .csect callback2_exn[DS] -callback2_exn: - .long .callback2_exn, TOC[tc0], 0 - - .globl callback3_exn - .csect callback3_exn[DS] -callback3_exn: - .long .callback3_exn, TOC[tc0], 0 diff --git a/asmrun/power-elf.S b/asmrun/power-elf.S deleted file mode 100644 index 52f3441cdb..0000000000 --- a/asmrun/power-elf.S +++ /dev/null @@ -1,421 +0,0 @@ -/*********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/*********************************************************************/ - -/* $Id$ */ - -#define Addrglobal(reg,glob) \ - addis reg, 0, glob@ha; \ - addi reg, reg, glob@l -#define Loadglobal(reg,glob,tmp) \ - addis tmp, 0, glob@ha; \ - lwz reg, glob@l(tmp) -#define Storeglobal(reg,glob,tmp) \ - addis tmp, 0, glob@ha; \ - stw reg, glob@l(tmp) - - .section ".text" - -/* Invoke the garbage collector. */ - - .globl caml_call_gc - .type caml_call_gc, @function -caml_call_gc: - /* Set up stack frame */ - stwu 1, -0x1A0(1) - /* 0x1A0 = 4*32 (int regs) + 8*32 (float regs) + 32 (space for C call) */ - /* Record return address into Caml code */ - mflr 0 - Storeglobal(0, caml_last_return_address, 11) - /* Record lowest stack address */ - addi 0, 1, 0x1A0 - Storeglobal(0, caml_bottom_of_stack, 11) - /* Record pointer to register array */ - addi 0, 1, 8*32 + 32 - Storeglobal(0, caml_gc_regs, 11) - /* Save current allocation pointer for debugging purposes */ - Storeglobal(31, young_ptr, 11) - /* Save exception pointer (if e.g. a sighandler raises) */ - Storeglobal(29, caml_exception_pointer, 11) - /* Save all registers used by the code generator */ - addi 11, 1, 8*32 + 32 - 4 - stwu 3, 4(11) - stwu 4, 4(11) - stwu 5, 4(11) - stwu 6, 4(11) - stwu 7, 4(11) - stwu 8, 4(11) - stwu 9, 4(11) - stwu 10, 4(11) - 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) - addi 11, 1, 32 - 8 - stfdu 1, 8(11) - stfdu 2, 8(11) - stfdu 3, 8(11) - stfdu 4, 8(11) - stfdu 5, 8(11) - stfdu 6, 8(11) - stfdu 7, 8(11) - stfdu 8, 8(11) - stfdu 9, 8(11) - stfdu 10, 8(11) - stfdu 11, 8(11) - stfdu 12, 8(11) - stfdu 13, 8(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) - /* Call the GC */ - bl garbage_collection - /* Reload new allocation pointer and allocation limit */ - Loadglobal(31, young_ptr, 11) - Loadglobal(30, young_limit, 11) - /* Restore all regs used by the code generator */ - addi 11, 1, 8*32 + 32 - 4 - lwzu 3, 4(11) - lwzu 4, 4(11) - lwzu 5, 4(11) - lwzu 6, 4(11) - lwzu 7, 4(11) - lwzu 8, 4(11) - lwzu 9, 4(11) - lwzu 10, 4(11) - 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) - addi 11, 1, 32 - 8 - lfdu 1, 8(11) - lfdu 2, 8(11) - lfdu 3, 8(11) - lfdu 4, 8(11) - lfdu 5, 8(11) - lfdu 6, 8(11) - lfdu 7, 8(11) - lfdu 8, 8(11) - lfdu 9, 8(11) - lfdu 10, 8(11) - lfdu 11, 8(11) - lfdu 12, 8(11) - lfdu 13, 8(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) - /* Return to caller, restarting the allocation */ - Loadglobal(0, caml_last_return_address, 11) - addic 0, 0, -16 /* Restart the allocation (4 instructions) */ - mtlr 0 - /* Say we are back into Caml code */ - li 12, 0 - Storeglobal(12, caml_last_return_address, 11) - /* Deallocate stack frame */ - addi 1, 1, 0x1A0 - /* Return */ - blr - -/* Call a C function from Caml */ - - .globl caml_c_call - .type caml_c_call, @function -caml_c_call: - /* Save return address */ - mflr 25 - /* Get ready to call C function (address in 11) */ - mtlr 11 - /* Record lowest stack address and return address */ - Storeglobal(1, caml_bottom_of_stack, 12) - Storeglobal(25, caml_last_return_address, 12) - /* Make the exception handler and alloc ptr available to the C code */ - Storeglobal(31, young_ptr, 11) - Storeglobal(29, caml_exception_pointer, 11) - /* Call the function (address in link register) */ - blrl - /* Restore return address (in 25, preserved by the C function) */ - mtlr 25 - /* Reload allocation pointer and allocation limit*/ - Loadglobal(31, young_ptr, 11) - Loadglobal(30, young_limit, 11) - /* Say we are back into Caml code */ - li 12, 0 - Storeglobal(12, caml_last_return_address, 11) - /* Return to caller */ - blr - -/* Raise an exception from C */ - - .globl raise_caml_exception - .type raise_caml_exception, @function -raise_caml_exception: - /* Reload Caml global registers */ - Loadglobal(1, caml_exception_pointer, 11) - Loadglobal(31, young_ptr, 11) - Loadglobal(30, young_limit, 11) - /* Say we are back into Caml code */ - li 0, 0 - Storeglobal(0, caml_last_return_address, 11) - /* Pop trap frame */ - lwz 0, 0(1) - lwz 29, 4(1) - mtlr 0 - addi 1, 1, 16 - /* Branch to handler */ - blr - -/* Start the Caml program */ - - .globl caml_start_program - .type caml_start_program, @function -caml_start_program: - Addrglobal(12, caml_program) - -/* Code shared between caml_start_program and callback */ -.L102: - /* Allocate and link stack frame */ - stwu 1, -256(1) - /* Save return address */ - mflr 0 - stw 0, 256+4(1) - /* Save all callee-save registers */ - /* GPR 14 at sp+16 ... GPR 31 at sp+84 - FPR 14 at sp+92 ... FPR 31 at sp+228 */ - addi 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) - /* Set up a callback link */ - addi 1, 1, -16 - Loadglobal(9, caml_bottom_of_stack, 11) - Loadglobal(10, caml_last_return_address, 11) - Loadglobal(11, caml_gc_regs, 11) - stw 9, 0(1) - stw 10, 4(1) - stw 11, 8(1) - /* Build an exception handler to catch exceptions escaping out of Caml */ - bl .L103 - b .L104 -.L103: - addi 1, 1, -16 - mflr 0 - stw 0, 0(1) - Loadglobal(11, caml_exception_pointer, 11) - stw 11, 4(1) - mr 29, 1 - /* Reload allocation pointers */ - Loadglobal(31, young_ptr, 11) - Loadglobal(30, young_limit, 11) - /* Say we are back into Caml code */ - li 0, 0 - Storeglobal(0, caml_last_return_address, 11) - /* Call the Caml code */ - mtlr 12 -.L105: - blrl - /* Pop the trap frame, restoring caml_exception_pointer */ - lwz 9, 4(1) - Storeglobal(9, caml_exception_pointer, 11) - addi 1, 1, 16 - /* Pop the callback link, restoring the global variables */ -.L106: - lwz 9, 0(1) - lwz 10, 4(1) - lwz 11, 8(1) - Storeglobal(9, caml_bottom_of_stack, 12) - Storeglobal(10, caml_last_return_address, 12) - Storeglobal(11, caml_gc_regs, 12) - addi 1, 1, 16 - /* Update allocation pointer */ - Storeglobal(31, young_ptr, 11) - /* Restore callee-save registers */ - addi 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) - /* Reload return address */ - lwz 0, 256+4(1) - mtlr 0 - /* Return */ - addi 1, 1, 256 - blr - - /* The trap handler: */ -.L104: - /* Update caml_exception_pointer */ - Storeglobal(29, caml_exception_pointer, 11) - /* Encode exception bucket as an exception result and return it */ - ori 3, 3, 2 - b .L106 - -/* Callback from C to Caml */ - - .globl callback_exn - .type callback_exn, @function -callback_exn: - /* Initial shuffling of arguments */ - mr 0, 3 /* Closure */ - mr 3, 4 /* Argument */ - mr 4, 0 - lwz 12, 0(4) /* Code pointer */ - b .L102 - - .globl callback2_exn - .type callback2_exn, @function -callback2_exn: - mr 0, 3 /* Closure */ - mr 3, 4 /* First argument */ - mr 4, 5 /* Second argument */ - mr 5, 0 - Addrglobal(12, caml_apply2) - b .L102 - - .globl callback3_exn - .type callback3_exn, @function -callback3_exn: - mr 0, 3 /* Closure */ - mr 3, 4 /* First argument */ - mr 4, 5 /* Second argument */ - mr 5, 6 /* Third argument */ - mr 6, 0 - Addrglobal(12, caml_apply3) - b .L102 - -/* Frame table */ - - .section ".data" - .globl system__frametable - .type system__frametable, @object -system__frametable: - .long 1 /* one descriptor */ - .long .L105 + 4 /* return address into callback */ - .short -1 /* negative size count => use callback link */ - .short 0 /* no roots here */ - diff --git a/asmrun/power-rhapsody.S b/asmrun/power-rhapsody.S deleted file mode 100644 index 0d56983df5..0000000000 --- a/asmrun/power-rhapsody.S +++ /dev/null @@ -1,416 +0,0 @@ -/*********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/*********************************************************************/ - -/* $Id$ */ - -.macro Addrglobal /* reg, glob */ - addis $0, 0, ha16($1) - addi $0, $0, lo16($1) -.endmacro -.macro Loadglobal /* reg,glob,tmp */ - addis $2, 0, ha16($1) - lwz $0, lo16($1)($2) -.endmacro -.macro Storeglobal /* reg,glob,tmp */ - addis $2, 0, ha16($1) - stw $0, lo16($1)($2) -.endmacro - - .text - -/* Invoke the garbage collector. */ - - .globl _caml_call_gc -_caml_call_gc: - /* Set up stack frame */ - stwu r1, -0x1A0(r1) - /* 0x1A0 = 4*32 (int regs) + 8*32 (float regs) + 32 (space for C call) */ - /* Record return address into Caml code */ - mflr r0 - Storeglobal r0, _caml_last_return_address, r11 - /* Record lowest stack address */ - addi r0, r1, 0x1A0 - Storeglobal r0, _caml_bottom_of_stack, r11 - /* Record pointer to register array */ - addi r0, r1, 8*32 + 32 - Storeglobal r0, _caml_gc_regs, r11 - /* Save current allocation pointer for debugging purposes */ - Storeglobal r31, _young_ptr, r11 - /* Save exception pointer (if e.g. a sighandler raises) */ - Storeglobal r29, _caml_exception_pointer, r11 - /* Save all registers used by the code generator */ - addi r11, r1, 8*32 + 32 - 4 - stwu r3, 4(r11) - stwu r4, 4(r11) - stwu r5, 4(r11) - stwu r6, 4(r11) - stwu r7, 4(r11) - stwu r8, 4(r11) - stwu r9, 4(r11) - stwu r10, 4(r11) - stwu r14, 4(r11) - stwu r15, 4(r11) - stwu r16, 4(r11) - stwu r17, 4(r11) - stwu r18, 4(r11) - stwu r19, 4(r11) - stwu r20, 4(r11) - stwu r21, 4(r11) - stwu r22, 4(r11) - stwu r23, 4(r11) - stwu r24, 4(r11) - stwu r25, 4(r11) - stwu r26, 4(r11) - stwu r27, 4(r11) - stwu r28, 4(r11) - addi r11, r1, 32 - 8 - stfdu f1, 8(r11) - stfdu f2, 8(r11) - stfdu f3, 8(r11) - stfdu f4, 8(r11) - stfdu f5, 8(r11) - stfdu f6, 8(r11) - stfdu f7, 8(r11) - stfdu f8, 8(r11) - stfdu f9, 8(r11) - stfdu f10, 8(r11) - stfdu f11, 8(r11) - stfdu f12, 8(r11) - stfdu f13, 8(r11) - stfdu f14, 8(r11) - stfdu f15, 8(r11) - stfdu f16, 8(r11) - stfdu f17, 8(r11) - stfdu f18, 8(r11) - stfdu f19, 8(r11) - stfdu f20, 8(r11) - stfdu f21, 8(r11) - stfdu f22, 8(r11) - stfdu f23, 8(r11) - stfdu f24, 8(r11) - stfdu f25, 8(r11) - stfdu f26, 8(r11) - stfdu f27, 8(r11) - stfdu f28, 8(r11) - stfdu f29, 8(r11) - stfdu f30, 8(r11) - stfdu f31, 8(r11) - /* Call the GC */ - bl _garbage_collection - /* Reload new allocation pointer and allocation limit */ - Loadglobal r31, _young_ptr, r11 - Loadglobal r30, _young_limit, r11 - /* Restore all regs used by the code generator */ - addi r11, r1, 8*32 + 32 - 4 - lwzu r3, 4(r11) - lwzu r4, 4(r11) - lwzu r5, 4(r11) - lwzu r6, 4(r11) - lwzu r7, 4(r11) - lwzu r8, 4(r11) - lwzu r9, 4(r11) - lwzu r10, 4(r11) - lwzu r14, 4(r11) - lwzu r15, 4(r11) - lwzu r16, 4(r11) - lwzu r17, 4(r11) - lwzu r18, 4(r11) - lwzu r19, 4(r11) - lwzu r20, 4(r11) - lwzu r21, 4(r11) - lwzu r22, 4(r11) - lwzu r23, 4(r11) - lwzu r24, 4(r11) - lwzu r25, 4(r11) - lwzu r26, 4(r11) - lwzu r27, 4(r11) - lwzu r28, 4(r11) - addi r11, r1, 32 - 8 - lfdu f1, 8(r11) - lfdu f2, 8(r11) - lfdu f3, 8(r11) - lfdu f4, 8(r11) - lfdu f5, 8(r11) - lfdu f6, 8(r11) - lfdu f7, 8(r11) - lfdu f8, 8(r11) - lfdu f9, 8(r11) - lfdu f10, 8(r11) - lfdu f11, 8(r11) - lfdu f12, 8(r11) - lfdu f13, 8(r11) - lfdu f14, 8(r11) - lfdu f15, 8(r11) - lfdu f16, 8(r11) - lfdu f17, 8(r11) - lfdu f18, 8(r11) - lfdu f19, 8(r11) - lfdu f20, 8(r11) - lfdu f21, 8(r11) - lfdu f22, 8(r11) - lfdu f23, 8(r11) - lfdu f24, 8(r11) - lfdu f25, 8(r11) - lfdu f26, 8(r11) - lfdu f27, 8(r11) - lfdu f28, 8(r11) - lfdu f29, 8(r11) - lfdu f30, 8(r11) - lfdu f31, 8(r11) - /* Return to caller, restarting the allocation */ - Loadglobal r0, _caml_last_return_address, r11 - addic r0, r0, -16 /* Restart the allocation (4 instructions) */ - mtlr r0 - /* Say we are back into Caml code */ - li r12, 0 - Storeglobal r12, _caml_last_return_address, r11 - /* Deallocate stack frame */ - addi r1, r1, 0x1A0 - /* Return */ - blr - -/* Call a C function from Caml */ - - .globl _caml_c_call -_caml_c_call: - /* Save return address */ - mflr r25 - /* Get ready to call C function (address in 11) */ - mtlr r11 - /* Record lowest stack address and return address */ - Storeglobal r1, _caml_bottom_of_stack, r12 - Storeglobal r25, _caml_last_return_address, r12 - /* Make the exception handler and alloc ptr available to the C code */ - Storeglobal r31, _young_ptr, r11 - Storeglobal r29, _caml_exception_pointer, r11 - /* Call the function (address in link register) */ - blrl - /* Restore return address (in 25, preserved by the C function) */ - mtlr r25 - /* Reload allocation pointer and allocation limit*/ - Loadglobal r31, _young_ptr, r11 - Loadglobal r30, _young_limit, r11 - /* Say we are back into Caml code */ - li r12, 0 - Storeglobal r12, _caml_last_return_address, r11 - /* Return to caller */ - blr - -/* Raise an exception from C */ - - .globl _raise_caml_exception -_raise_caml_exception: - /* Reload Caml global registers */ - Loadglobal r1, _caml_exception_pointer, r11 - Loadglobal r31, _young_ptr, r11 - Loadglobal r30, _young_limit, r11 - /* Say we are back into Caml code */ - li r0, 0 - Storeglobal r0, _caml_last_return_address, r11 - /* Pop trap frame */ - lwz r0, 0(r1) - lwz r29, 4(r1) - mtlr r0 - addi r1, r1, 16 - /* Branch to handler */ - blr - -/* Start the Caml program */ - - .globl _caml_start_program -_caml_start_program: - Addrglobal r12, _caml_program - -/* Code shared between caml_start_program and callback */ -L102: - /* Allocate and link stack frame */ - stwu r1, -256(r1) - /* Save return address */ - mflr r0 - stw r0, 256+4(r1) - /* Save all callee-save registers */ - /* GPR 14 at sp+16 ... GPR 31 at sp+84 - FPR 14 at sp+92 ... FPR 31 at sp+228 */ - addi r11, r1, 16-4 - stwu r14, 4(r11) - stwu r15, 4(r11) - stwu r16, 4(r11) - stwu r17, 4(r11) - stwu r18, 4(r11) - stwu r19, 4(r11) - stwu r20, 4(r11) - stwu r21, 4(r11) - stwu r22, 4(r11) - stwu r23, 4(r11) - stwu r24, 4(r11) - stwu r25, 4(r11) - stwu r26, 4(r11) - stwu r27, 4(r11) - stwu r28, 4(r11) - stwu r29, 4(r11) - stwu r30, 4(r11) - stwu r31, 4(r11) - stfdu f14, 8(r11) - stfdu f15, 8(r11) - stfdu f16, 8(r11) - stfdu f17, 8(r11) - stfdu f18, 8(r11) - stfdu f19, 8(r11) - stfdu f20, 8(r11) - stfdu f21, 8(r11) - stfdu f22, 8(r11) - stfdu f23, 8(r11) - stfdu f24, 8(r11) - stfdu f25, 8(r11) - stfdu f26, 8(r11) - stfdu f27, 8(r11) - stfdu f28, 8(r11) - stfdu f29, 8(r11) - stfdu f30, 8(r11) - stfdu f31, 8(r11) - /* Set up a callback link */ - addi r1, r1, -16 - Loadglobal r9, _caml_bottom_of_stack, r11 - Loadglobal r10, _caml_last_return_address, r11 - Loadglobal r11, _caml_gc_regs, r11 - stw r9, 0(r1) - stw r10, 4(r1) - stw r11, 8(r1) - /* Build an exception handler to catch exceptions escaping out of Caml */ - bl L103 - b L104 -L103: - addi r1, r1, -16 - mflr r0 - stw r0, 0(r1) - Loadglobal r11, _caml_exception_pointer, r11 - stw r11, 4(r1) - mr r29, r1 - /* Reload allocation pointers */ - Loadglobal r31, _young_ptr, r11 - Loadglobal r30, _young_limit, r11 - /* Say we are back into Caml code */ - li r0, 0 - Storeglobal r0, _caml_last_return_address, r11 - /* Call the Caml code */ - mtlr r12 -L105: - blrl - /* Pop the trap frame, restoring caml_exception_pointer */ - lwz r9, 4(r1) - Storeglobal r9, _caml_exception_pointer, r11 - addi r1, r1, 16 - /* Pop the callback link, restoring the global variables */ -L106: - lwz r9, 0(r1) - lwz r10, 4(r1) - lwz r11, 8(r1) - Storeglobal r9, _caml_bottom_of_stack, r12 - Storeglobal r10, _caml_last_return_address, r12 - Storeglobal r11, _caml_gc_regs, r12 - addi r1, r1, 16 - /* Update allocation pointer */ - Storeglobal r31, _young_ptr, r11 - /* Restore callee-save registers */ - addi r11, r1, 16-4 - lwzu r14, 4(r11) - lwzu r15, 4(r11) - lwzu r16, 4(r11) - lwzu r17, 4(r11) - lwzu r18, 4(r11) - lwzu r19, 4(r11) - lwzu r20, 4(r11) - lwzu r21, 4(r11) - lwzu r22, 4(r11) - lwzu r23, 4(r11) - lwzu r24, 4(r11) - lwzu r25, 4(r11) - lwzu r26, 4(r11) - lwzu r27, 4(r11) - lwzu r28, 4(r11) - lwzu r29, 4(r11) - lwzu r30, 4(r11) - lwzu r31, 4(r11) - lfdu f14, 8(r11) - lfdu f15, 8(r11) - lfdu f16, 8(r11) - lfdu f17, 8(r11) - lfdu f18, 8(r11) - lfdu f19, 8(r11) - lfdu f20, 8(r11) - lfdu f21, 8(r11) - lfdu f22, 8(r11) - lfdu f23, 8(r11) - lfdu f24, 8(r11) - lfdu f25, 8(r11) - lfdu f26, 8(r11) - lfdu f27, 8(r11) - lfdu f28, 8(r11) - lfdu f29, 8(r11) - lfdu f30, 8(r11) - lfdu f31, 8(r11) - /* Reload return address */ - lwz r0, 256+4(r1) - mtlr r0 - /* Return */ - addi r1, r1, 256 - blr - - /* The trap handler: */ -L104: - /* Update caml_exception_pointer */ - Storeglobal r29, _caml_exception_pointer, r11 - /* Encode exception bucket as an exception result and return it */ - ori r3, r3, 2 - b L106 - -/* Callback from C to Caml */ - - .globl _callback_exn -_callback_exn: - /* Initial shuffling of arguments */ - mr r0, r3 /* Closure */ - mr r3, r4 /* Argument */ - mr r4, r0 - lwz r12, 0(r4) /* Code pointer */ - b L102 - - .globl _callback2_exn -_callback2_exn: - mr r0, r3 /* Closure */ - mr r3, r4 /* First argument */ - mr r4, r5 /* Second argument */ - mr r5, r0 - Addrglobal r12, _caml_apply2 - b L102 - - .globl _callback3_exn -_callback3_exn: - mr r0, r3 /* Closure */ - mr r3, r4 /* First argument */ - mr r4, r5 /* Second argument */ - mr r5, r6 /* Third argument */ - mr r6, r0 - Addrglobal r12, _caml_apply3 - b L102 - -/* Frame table */ - - .const - .globl _system__frametable -_system__frametable: - .long 1 /* one descriptor */ - .long L105 + 4 /* return address into callback */ - .short -1 /* negative size count => use callback link */ - .short 0 /* no roots here */ - diff --git a/asmrun/roots.c b/asmrun/roots.c deleted file mode 100644 index f56ebf150b..0000000000 --- a/asmrun/roots.c +++ /dev/null @@ -1,297 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -/* To walk the memory roots for garbage collection */ - -#include "finalise.h" -#include "globroots.h" -#include "memory.h" -#include "major_gc.h" -#include "minor_gc.h" -#include "misc.h" -#include "mlvalues.h" -#include "stack.h" -#include "roots.h" - -/* Roots registered from C functions */ - -struct caml__roots_block *local_roots = NULL; - -void (*scan_roots_hook) (scanning_action) = NULL; - -/* The hashtable of frame descriptors */ - -typedef struct { - unsigned long retaddr; - short frame_size; - short num_live; - short live_ofs[1]; -} frame_descr; - -static frame_descr ** frame_descriptors = NULL; -static int frame_descriptors_mask; - -#define Hash_retaddr(addr) \ - (((unsigned long)(addr) >> 3) & frame_descriptors_mask) - -static void init_frame_descriptors(void) -{ - long num_descr, tblsize, i, j, len; - long * tbl; - frame_descr * d; - unsigned long h; - - /* Count the frame descriptors */ - num_descr = 0; - for (i = 0; caml_frametable[i] != 0; i++) - num_descr += *(caml_frametable[i]); - - /* The size of the hashtable is a power of 2 greater or equal to - 2 times the number of descriptors */ - tblsize = 4; - while (tblsize < 2 * num_descr) tblsize *= 2; - - /* Allocate the hash table */ - frame_descriptors = - (frame_descr **) stat_alloc(tblsize * sizeof(frame_descr *)); - for (i = 0; i < tblsize; i++) frame_descriptors[i] = NULL; - frame_descriptors_mask = tblsize - 1; - - /* Fill the hash table */ - for (i = 0; caml_frametable[i] != 0; i++) { - tbl = caml_frametable[i]; - len = *tbl; - d = (frame_descr *)(tbl + 1); - for (j = 0; j < len; j++) { - h = Hash_retaddr(d->retaddr); - while (frame_descriptors[h] != NULL) { - h = (h+1) & frame_descriptors_mask; - } - frame_descriptors[h] = d; - d = (frame_descr *) - (((unsigned long)d + - sizeof(char *) + sizeof(short) + sizeof(short) + - sizeof(short) * d->num_live + sizeof(frame_descr *) - 1) - & -sizeof(frame_descr *)); - } - } -} - -/* Communication with [caml_start_program] and [caml_call_gc]. */ - -char * caml_bottom_of_stack = NULL; /* no stack initially */ -unsigned long caml_last_return_address = 1; /* not in Caml code initially */ -value * caml_gc_regs; -long caml_globals_inited = 0; -static long caml_globals_scanned = 0; - -/* Call [oldify_one] on (at least) all the roots that point to the minor - heap. */ -void oldify_local_roots (void) -{ - char * sp; - unsigned long retaddr; - value * regs; - frame_descr * d; - unsigned long h; - int i, j, n, ofs; - short * p; - value glob; - value * root; - struct global_root * gr; - struct caml__roots_block *lr; - - /* The global roots */ - for (i = caml_globals_scanned; - i <= caml_globals_inited && caml_globals[i] != 0; - i++) { - glob = caml_globals[i]; - for (j = 0; j < Wosize_val(glob); j++){ - Oldify (&Field (glob, j)); - } - } - caml_globals_scanned = caml_globals_inited; - - /* The stack and local roots */ - if (frame_descriptors == NULL) init_frame_descriptors(); - sp = caml_bottom_of_stack; - retaddr = caml_last_return_address; - regs = caml_gc_regs; - if (sp != NULL) { - while (1) { - /* Find the descriptor corresponding to the return address */ - h = Hash_retaddr(retaddr); - while(1) { - d = frame_descriptors[h]; - if (d->retaddr == retaddr) break; - h = (h+1) & frame_descriptors_mask; - } - if (d->frame_size >= 0) { - /* Scan the roots in this frame */ - for (p = d->live_ofs, n = d->num_live; n > 0; n--, p++) { - ofs = *p; - if (ofs & 1) { - root = regs + (ofs >> 1); - } else { - root = (value *)(sp + ofs); - } - Oldify (root); - } - /* Move to next frame */ -#ifndef Stack_grows_upwards - sp += d->frame_size; -#else - sp -= d->frame_size; -#endif - retaddr = Saved_return_address(sp); -#ifdef Already_scanned - /* Stop here if the frame has been scanned during earlier GCs */ - if (Already_scanned(sp, retaddr)) break; - /* Mark frame as already scanned */ - Mark_scanned(sp, retaddr); -#endif - } else { - /* This marks the top of a stack chunk for an ML callback. - Skip C portion of stack and continue with next ML stack chunk. */ - struct caml_context * next_context = Callback_link(sp); - sp = next_context->bottom_of_stack; - retaddr = next_context->last_retaddr; - regs = next_context->gc_regs; - /* A null sp means no more ML stack chunks; stop here. */ - if (sp == NULL) break; - } - } - } - /* Local C roots */ - for (lr = local_roots; lr != NULL; lr = lr->next) { - for (i = 0; i < lr->ntables; i++){ - for (j = 0; j < lr->nitems; j++){ - root = &(lr->tables[i][j]); - Oldify (root); - } - } - } - /* Global C roots */ - for (gr = caml_global_roots.forward[0]; gr != NULL; gr = gr->forward[0]) { - Oldify (gr->root); - } - /* Finalised values */ - final_do_young_roots (&oldify_one); - /* Hook */ - if (scan_roots_hook != NULL) (*scan_roots_hook)(oldify_one); -} - -/* Call [darken] on all roots */ - -void darken_all_roots (void) -{ - do_roots (darken); -} - -void do_roots (scanning_action f) -{ - int i, j; - value glob; - struct global_root * gr; - - /* The global roots */ - for (i = 0; caml_globals[i] != 0; i++) { - glob = caml_globals[i]; - for (j = 0; j < Wosize_val(glob); j++) - f (Field (glob, j), &Field (glob, j)); - } - /* The stack and local roots */ - if (frame_descriptors == NULL) init_frame_descriptors(); - do_local_roots(f, caml_bottom_of_stack, caml_last_return_address, - caml_gc_regs, local_roots); - /* Global C roots */ - for (gr = caml_global_roots.forward[0]; gr != NULL; gr = gr->forward[0]) { - f(*(gr->root), gr->root); - } - /* Finalised values */ - final_do_strong_roots (f); - /* Hook */ - if (scan_roots_hook != NULL) (*scan_roots_hook)(f); -} - -void do_local_roots(scanning_action f, char * bottom_of_stack, - unsigned long last_retaddr, value * gc_regs, - struct caml__roots_block * local_roots) -{ - char * sp; - unsigned long retaddr; - value * regs; - frame_descr * d; - unsigned long h; - int i, j, n, ofs; - short * p; - value * root; - struct caml__roots_block *lr; - - sp = bottom_of_stack; - retaddr = last_retaddr; - regs = gc_regs; - if (sp != NULL) { - while (1) { - /* Find the descriptor corresponding to the return address */ - h = Hash_retaddr(retaddr); - while(1) { - d = frame_descriptors[h]; - if (d->retaddr == retaddr) break; - h = (h+1) & frame_descriptors_mask; - } - if (d->frame_size >= 0) { - /* Scan the roots in this frame */ - for (p = d->live_ofs, n = d->num_live; n > 0; n--, p++) { - ofs = *p; - if (ofs & 1) { - root = regs + (ofs >> 1); - } else { - root = (value *)(sp + ofs); - } - f (*root, root); - } - /* Move to next frame */ -#ifndef Stack_grows_upwards - sp += d->frame_size; -#else - sp -= d->frame_size; -#endif - retaddr = Saved_return_address(sp); -#ifdef Mask_already_scanned - retaddr = Mask_already_scanned(retaddr); -#endif - } else { - /* This marks the top of a stack chunk for an ML callback. - Skip C portion of stack and continue with next ML stack chunk. */ - struct caml_context * next_context = Callback_link(sp); - sp = next_context->bottom_of_stack; - retaddr = next_context->last_retaddr; - regs = next_context->gc_regs; - /* A null sp means no more ML stack chunks; stop here. */ - if (sp == NULL) break; - } - } - } - /* Local C roots */ - for (lr = local_roots; lr != NULL; lr = lr->next) { - for (i = 0; i < lr->ntables; i++){ - for (j = 0; j < lr->nitems; j++){ - root = &(lr->tables[i][j]); - f (*root, root); - } - } - } -} diff --git a/asmrun/signals.c b/asmrun/signals.c deleted file mode 100644 index c05e9c73f0..0000000000 --- a/asmrun/signals.c +++ /dev/null @@ -1,677 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -#include <signal.h> -#include <stdio.h> -#if defined(TARGET_sparc) && defined(SYS_solaris) -#include <ucontext.h> -#endif -#include "alloc.h" -#include "callback.h" -#include "memory.h" -#include "minor_gc.h" -#include "misc.h" -#include "mlvalues.h" -#include "fail.h" -#include "signals.h" -#include "stack.h" -#include "sys.h" -#ifdef HAS_STACK_OVERFLOW_DETECTION -#include <sys/time.h> -#include <sys/resource.h> -#endif - -extern char * code_area_start, * code_area_end; - -#define In_code_area(pc) \ - ((char *)(pc) >= code_area_start && (char *)(pc) <= code_area_end) - -#ifdef _WIN32 -typedef void (*sighandler)(int sig); -extern sighandler win32_signal(int sig, sighandler action); -#define signal(sig,act) win32_signal(sig,act) -#endif - -#if defined(TARGET_power) && defined(SYS_rhapsody) - - #include <sys/utsname.h> - - #define STRUCT_SIGCONTEXT void - #define CONTEXT_GPR(ctx, regno) (*context_gpr_p ((ctx), (regno))) - #define CONTEXT_PC(ctx) CONTEXT_GPR ((ctx), -2) - static int ctx_version = 0; - static void init_ctx (void) - { - struct utsname name; - if (uname (&name) == 0){ - if (name.release[1] == '.' && name.release[0] <= '5'){ - ctx_version = 1; - }else{ - ctx_version = 2; - } - }else{ - fatal_error ("cannot determine SIGCONTEXT format"); - } - } - - #ifdef DARWIN_VERSION_6 - #include <sys/ucontext.h> - static unsigned long *context_gpr_p (void *ctx, int regno) - { - unsigned long *regs; - if (ctx_version == 0) init_ctx (); - if (ctx_version == 1){ - /* old-style context (10.0 and 10.1) */ - regs = (unsigned long *)(((struct sigcontext *)ctx)->sc_regs); - }else{ - Assert (ctx_version == 2); - /* new-style context (10.2) */ - regs = (unsigned long *)&(((struct ucontext *)ctx)->uc_mcontext->ss); - } - return &(regs[2 + regno]); - } - #else - #define SA_SIGINFO 0x0040 - struct ucontext { - int uc_onstack; - sigset_t uc_sigmask; - struct sigaltstack uc_stack; - struct ucontext *uc_link; - size_t uc_mcsize; - unsigned long *uc_mcontext; - }; - static unsigned long *context_gpr_p (void *ctx, int regno) - { - unsigned long *regs; - if (ctx_version == 0) init_ctx (); - if (ctx_version == 1){ - /* old-style context (10.0 and 10.1) */ - regs = (unsigned long *)(((struct sigcontext *)ctx)->sc_regs); - }else{ - Assert (ctx_version == 2); - /* new-style context (10.2) */ - regs = (unsigned long *)((struct ucontext *)ctx)->uc_mcontext + 8; - } - return &(regs[2 + regno]); - } - #endif -#endif - -#if defined(TARGET_power) && defined(SYS_aix) -#ifdef _AIXVERSION_430 -#define STRUCT_SIGCONTEXT struct __sigcontext -#define CONTEXT_GPR(ctx, regno) \ - ((ctx)->__sc_jmpbuf.__jmp_context.__gpr[(regno)]) -#else -#define STRUCT_SIGCONTEXT struct sigcontext -#define CONTEXT_GPR(ctx, regno) \ - ((ctx)->sc_jmpbuf.jmp_context.gpr[(regno)]) -#endif -#endif - -volatile int async_signal_mode = 0; -volatile int pending_signal = 0; -volatile int force_major_slice = 0; -value signal_handlers = 0; -void (*enter_blocking_section_hook)() = NULL; -void (*leave_blocking_section_hook)() = NULL; - -static int rev_convert_signal_number(int signo); - -/* Execute a signal handler immediately. */ - -void execute_signal(int signal_number, int in_signal_handler) -{ - value res; -#ifdef POSIX_SIGNALS - sigset_t sigs; - /* Block the signal before executing the handler, and record in sigs - the original signal mask */ - sigemptyset(&sigs); - sigaddset(&sigs, signal_number); - sigprocmask(SIG_BLOCK, &sigs, &sigs); -#endif - res = callback_exn(Field(signal_handlers, signal_number), - Val_int(rev_convert_signal_number(signal_number))); -#ifdef POSIX_SIGNALS - if (! in_signal_handler) { - /* Restore the original signal mask */ - sigprocmask(SIG_SETMASK, &sigs, NULL); - } else if (Is_exception_result(res)) { - /* Restore the original signal mask and unblock the signal itself */ - sigdelset(&sigs, signal_number); - sigprocmask(SIG_SETMASK, &sigs, NULL); - } -#endif - if (Is_exception_result(res)) mlraise(Extract_exception(res)); -} - -/* This routine is the common entry point for garbage collection - and signal handling. It can trigger a callback to Caml code. - With system threads, this callback can cause a context switch. - Hence [garbage_collection] must not be called from regular C code - (e.g. the [alloc] function) because the context of the call - (e.g. [intern_val]) may not allow context switching. - Only generated assembly code can call [garbage_collection], - via the caml_call_gc assembly stubs. */ - -void garbage_collection(void) -{ - int sig; - - if (young_ptr < young_start || force_major_slice) minor_collection(); - /* If a signal arrives between the following two instructions, - it will be lost. */ - sig = pending_signal; - pending_signal = 0; - young_limit = young_start; - if (sig) execute_signal(sig, 0); -} - -/* Trigger a garbage collection as soon as possible */ - -void urge_major_slice (void) -{ - force_major_slice = 1; - young_limit = young_end; - /* This is only moderately effective on ports that cache young_limit - in a register, since modify() is called directly, not through - caml_c_call, so it may take a while before the register is reloaded - from young_limit. */ -} - -void enter_blocking_section(void) -{ - int sig; - - while (1){ - Assert (!async_signal_mode); - /* If a signal arrives between the next two instructions, - it will be lost. */ - sig = pending_signal; - pending_signal = 0; - young_limit = young_start; - if (sig) execute_signal(sig, 0); - async_signal_mode = 1; - if (!pending_signal) break; - async_signal_mode = 0; - } - if (enter_blocking_section_hook != NULL) enter_blocking_section_hook(); -} - -void leave_blocking_section(void) -{ - if (leave_blocking_section_hook != NULL) leave_blocking_section_hook(); - Assert(async_signal_mode); - 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) -void handle_signal(int sig, int code, struct sigcontext * context) -#elif defined(TARGET_power) && defined(SYS_aix) -void handle_signal(int sig, int code, STRUCT_SIGCONTEXT * context) -#elif defined(TARGET_power) && defined(SYS_elf) -void handle_signal(int sig, struct sigcontext * context) -#elif defined(TARGET_power) && defined(SYS_rhapsody) -void handle_signal(int sig, int code, STRUCT_SIGCONTEXT * context) -#elif defined(TARGET_power) && defined(SYS_bsd) -void handle_signal(int sig, int code, struct sigcontext * context) -#elif defined(TARGET_sparc) && defined(SYS_solaris) -void handle_signal(int sig, int code, void * context) -#else -void handle_signal(int sig) -#endif -{ -#if !defined(POSIX_SIGNALS) && !defined(BSD_SIGNALS) - signal(sig, handle_signal); -#endif - if (async_signal_mode) { - /* We are interrupting a C function blocked on I/O. - Callback the Caml code immediately. */ - leave_blocking_section(); - execute_signal(sig, 1); - enter_blocking_section(); - } else { - /* We can't execute the signal code immediately. - Instead, we remember the signal and play with the allocation limit - so that the next allocation will trigger a garbage collection. */ - pending_signal = sig; - young_limit = young_end; - /* Some ports cache young_limit in a register. - Use the signal context to modify that register too, but only if - we are inside Caml code (not inside C code). */ -#if defined(TARGET_alpha) - if (In_code_area(context->sc_pc)) { - /* Cached in register $14 */ - context->sc_regs[14] = (long) young_limit; - } -#endif -#if defined(TARGET_mips) - if (In_code_area(context->sc_pc)) { - /* Cached in register $23 */ - context->sc_regs[23] = (int) young_limit; - } -#endif -#if defined(TARGET_power) && defined(SYS_aix) - if (caml_last_return_address == 0) { - /* Cached in register 30 */ - CONTEXT_GPR(context, 30) = (ulong_t) young_limit; - } -#endif -#if defined(TARGET_power) && defined(SYS_elf) - if (caml_last_return_address == 0) { - /* Cached in register 30 */ - context->regs->gpr[30] = (unsigned long) young_limit; - } -#endif -#if defined(TARGET_power) && defined(SYS_rhapsody) - if (In_code_area(CONTEXT_PC(context))) { - /* Cached in register 30 */ - CONTEXT_GPR(context, 30) = (unsigned long) young_limit; - } -#endif -#if defined(TARGET_power) && defined(SYS_bsd) - if (caml_last_return_address == 0) { - /* Cached in register 30 */ - context->sc_frame.fixreg[30] = (unsigned long) young_limit; - } -#endif -#if defined(TARGET_sparc) && defined(SYS_solaris) - { greg_t * gregs = ((ucontext_t *)context)->uc_mcontext.gregs; - if (In_code_area(gregs[REG_PC])) { - /* Cached in register l7, which is saved on the stack 7 words - after the stack pointer. */ - ((long *)(gregs[REG_SP]))[7] = (long) young_limit; - } - } -#endif - } -} - -#ifndef SIGABRT -#define SIGABRT -1 -#endif -#ifndef SIGALRM -#define SIGALRM -1 -#endif -#ifndef SIGFPE -#define SIGFPE -1 -#endif -#ifndef SIGHUP -#define SIGHUP -1 -#endif -#ifndef SIGILL -#define SIGILL -1 -#endif -#ifndef SIGINT -#define SIGINT -1 -#endif -#ifndef SIGKILL -#define SIGKILL -1 -#endif -#ifndef SIGPIPE -#define SIGPIPE -1 -#endif -#ifndef SIGQUIT -#define SIGQUIT -1 -#endif -#ifndef SIGSEGV -#define SIGSEGV -1 -#endif -#ifndef SIGTERM -#define SIGTERM -1 -#endif -#ifndef SIGUSR1 -#define SIGUSR1 -1 -#endif -#ifndef SIGUSR2 -#define SIGUSR2 -1 -#endif -#ifndef SIGCHLD -#define SIGCHLD -1 -#endif -#ifndef SIGCONT -#define SIGCONT -1 -#endif -#ifndef SIGSTOP -#define SIGSTOP -1 -#endif -#ifndef SIGTSTP -#define SIGTSTP -1 -#endif -#ifndef SIGTTIN -#define SIGTTIN -1 -#endif -#ifndef SIGTTOU -#define SIGTTOU -1 -#endif -#ifndef SIGVTALRM -#define SIGVTALRM -1 -#endif -#ifndef SIGPROF -#define SIGPROF -1 -#endif - -static int posix_signals[] = { - SIGABRT, SIGALRM, SIGFPE, SIGHUP, SIGILL, SIGINT, SIGKILL, SIGPIPE, - SIGQUIT, SIGSEGV, SIGTERM, SIGUSR1, SIGUSR2, SIGCHLD, SIGCONT, - SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU, SIGVTALRM, SIGPROF -}; - -int convert_signal_number(int signo) -{ - if (signo < 0 && signo >= -(sizeof(posix_signals) / sizeof(int))) - return posix_signals[-signo-1]; - else - return signo; -} - -static int rev_convert_signal_number(int signo) -{ - int i; - for (i = 0; i < sizeof(posix_signals) / sizeof(int); i++) - if (signo == posix_signals[i]) return -i - 1; - return signo; -} - -#ifndef NSIG -#define NSIG 64 -#endif - -value install_signal_handler(value signal_number, value action) /* ML */ -{ - CAMLparam2 (signal_number, action); - int sig; - void (*act)(int signo), (*oldact)(int signo); -#ifdef POSIX_SIGNALS - struct sigaction sigact, oldsigact; -#endif - CAMLlocal1 (res); - - sig = convert_signal_number(Int_val(signal_number)); - if (sig < 0 || sig >= NSIG) - invalid_argument("Sys.signal: unavailable signal"); - switch(action) { - case Val_int(0): /* Signal_default */ - act = SIG_DFL; - break; - case Val_int(1): /* Signal_ignore */ - act = SIG_IGN; - break; - default: /* Signal_handle */ - act = (void (*)(int)) handle_signal; - break; - } -#ifdef POSIX_SIGNALS - sigact.sa_handler = act; - sigemptyset(&sigact.sa_mask); -#if defined(SYS_solaris) || defined(SYS_rhapsody) - sigact.sa_flags = SA_SIGINFO; -#else - sigact.sa_flags = 0; -#endif - if (sigaction(sig, &sigact, &oldsigact) == -1) sys_error(NO_ARG); - oldact = oldsigact.sa_handler; -#else - oldact = signal(sig, act); - if (oldact == SIG_ERR) sys_error(NO_ARG); -#endif - if (oldact == (void (*)(int)) handle_signal) { - res = alloc_small(1, 0); /* Signal_handle */ - Field(res, 0) = Field(signal_handlers, sig); - } - else if (oldact == SIG_IGN) - res = Val_int(1); /* Signal_ignore */ - else - res = Val_int(0); /* Signal_default */ - if (Is_block(action)) { - if (signal_handlers == 0) { - signal_handlers = alloc(NSIG, 0); - register_global_root(&signal_handlers); - } - modify(&Field(signal_handlers, sig), Field(action, 0)); - } - CAMLreturn (res); -} - -/* Machine- and OS-dependent handling of bound check trap */ - -#if defined(TARGET_sparc) && defined(SYS_sunos) -static void trap_handler(int sig, int code, - struct sigcontext * context, char * address) -{ - int * sp; - /* Unblock SIGILL */ - sigset_t mask; - sigemptyset(&mask); - sigaddset(&mask, SIGILL); - sigprocmask(SIG_UNBLOCK, &mask, NULL); - if (code != ILL_TRAP_FAULT(5)) { - fprintf(stderr, "Fatal error: illegal instruction, code 0x%x\n", code); - exit(100); - } - /* Recover young_ptr and caml_exception_pointer from the %l5 and %l6 regs */ - sp = (int *) context->sc_sp; - caml_exception_pointer = (char *) sp[5]; - young_ptr = (char *) sp[6]; - array_bound_error(); -} -#endif - -#if defined(TARGET_sparc) && defined(SYS_solaris) -static void trap_handler(int sig, siginfo_t * info, void * context) -{ - long * sp; - - if (info->si_code != ILL_ILLTRP) { - fprintf(stderr, "Fatal error: illegal instruction, code 0x%x\n", - info->si_code); - exit(100); - } - /* Recover young_ptr and caml_exception_pointer from the %l5 and %l6 regs */ - sp = (long *) (((ucontext_t *)context)->uc_mcontext.gregs[REG_SP]); - caml_exception_pointer = (char *) sp[5]; - young_ptr = (char *) sp[6]; - array_bound_error(); -} -#endif - -#if defined(TARGET_sparc) && (defined(SYS_bsd) || defined(SYS_linux)) -static void trap_handler(int sig) -{ - /* TODO: recover registers from context and call array_bound_error */ - fatal_error("Fatal error: out-of-bound access in array or string\n"); -} -#endif - -#if defined(TARGET_power) && defined(SYS_aix) -static void trap_handler(int sig, int code, STRUCT_SIGCONTEXT * context) -{ - /* Unblock SIGTRAP */ - sigset_t mask; - sigemptyset(&mask); - sigaddset(&mask, SIGTRAP); - sigprocmask(SIG_UNBLOCK, &mask, NULL); - /* Recover young_ptr and caml_exception_pointer from registers 31 and 29 */ - caml_exception_pointer = (char *) CONTEXT_GPR(context, 29); - young_ptr = (char *) CONTEXT_GPR(context, 31); - array_bound_error(); -} -#endif - -#if defined(TARGET_power) && defined(SYS_elf) -static void trap_handler(int sig, struct sigcontext * context) -{ - /* Recover young_ptr and caml_exception_pointer from registers 31 and 29 */ - caml_exception_pointer = (char *) context->regs->gpr[29]; - young_ptr = (char *) context->regs->gpr[31]; - array_bound_error(); -} -#endif - -#if defined(TARGET_power) && defined(SYS_rhapsody) -static void trap_handler(int sig, int code, STRUCT_SIGCONTEXT * context) -{ - /* Unblock SIGTRAP */ - sigset_t mask; - sigemptyset(&mask); - sigaddset(&mask, SIGTRAP); - sigprocmask(SIG_UNBLOCK, &mask, NULL); - /* Recover young_ptr and caml_exception_pointer from registers 31 and 29 */ - caml_exception_pointer = (char *) CONTEXT_GPR(context, 29); - young_ptr = (char *) CONTEXT_GPR(context, 31); - array_bound_error(); -} -#endif - -#if defined(TARGET_power) && defined(SYS_bsd) -static void trap_handler(int sig, int code, struct sigcontext * context) -{ - /* Recover young_ptr and caml_exception_pointer from registers 31 and 29 */ - caml_exception_pointer = (char *) context->sc_frame.fixreg[29]; - young_ptr = (char *) context->sc_frame.fixreg[31]; - array_bound_error(); -} -#endif - - -/* Machine- and OS-dependent handling of stack overflow */ - -#ifdef HAS_STACK_OVERFLOW_DETECTION - -static char * system_stack_top; -static char sig_alt_stack[SIGSTKSZ]; - -static int is_stack_overflow(char * fault_addr) -{ - struct rlimit limit; - struct sigaction act; - - /* Sanity checks: - - faulting address is word-aligned - - faulting address is within the stack */ - if (((long) fault_addr & (sizeof(long) - 1)) == 0 && - getrlimit(RLIMIT_STACK, &limit) == 0 && - fault_addr < system_stack_top && - fault_addr >= system_stack_top - limit.rlim_cur - 0x2000) { - /* OK, caller can turn this into a Stack_overflow exception */ - return 1; - } else { - /* Otherwise, deactivate our exception handler. Caller will - return, causing fatal signal to be generated at point of error. */ - act.sa_handler = SIG_DFL; - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigaction(SIGSEGV, &act, NULL); - return 0; - } -} - -#if defined(TARGET_i386) && defined(SYS_linux_elf) -static void segv_handler(int signo, struct sigcontext sc) -{ - if (is_stack_overflow((char *) sc.cr2)) - raise_stack_overflow(); -} -#endif - -#if defined(TARGET_i386) && !defined(SYS_linux_elf) -static void segv_handler(int signo, siginfo_t * info, void * arg) -{ - if (is_stack_overflow((char *) info->si_addr)) - raise_stack_overflow(); -} -#endif - -#endif - -/* Initialization of signal stuff */ - -void init_signals(void) -{ - /* Bound-check trap handling */ -#if defined(TARGET_sparc) && \ - (defined(SYS_sunos) || defined(SYS_bsd) || defined(SYS_linux)) - { - struct sigaction act; - act.sa_handler = (void (*)(int)) trap_handler; - sigemptyset(&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGILL, &act, NULL); - } -#endif -#if defined(TARGET_sparc) && defined(SYS_solaris) - { - struct sigaction act; - act.sa_sigaction = trap_handler; - sigemptyset(&act.sa_mask); - act.sa_flags = SA_SIGINFO | SA_NODEFER; - sigaction(SIGILL, &act, NULL); - } -#endif -#if defined(TARGET_power) - { - struct sigaction act; - act.sa_handler = (void (*)(int)) trap_handler; - sigemptyset(&act.sa_mask); -#if defined (SYS_rhapsody) - act.sa_flags = SA_SIGINFO; -#elif defined (SYS_aix) - act.sa_flags = 0; -#else - act.sa_flags = SA_NODEFER; -#endif - sigaction(SIGTRAP, &act, NULL); - } -#endif - /* Stack overflow handling */ -#ifdef HAS_STACK_OVERFLOW_DETECTION - { - struct sigaltstack stk; - struct sigaction act; - stk.ss_sp = sig_alt_stack; - stk.ss_size = SIGSTKSZ; - stk.ss_flags = 0; -#if defined(TARGET_i386) && defined(SYS_linux_elf) - act.sa_handler = (void (*)(int)) segv_handler; - act.sa_flags = SA_ONSTACK | SA_NODEFER; -#else - act.sa_sigaction = segv_handler; - act.sa_flags = SA_SIGINFO | SA_ONSTACK | SA_NODEFER; -#endif - sigemptyset(&act.sa_mask); - system_stack_top = (char *) &act; - if (sigaltstack(&stk, NULL) == 0) { sigaction(SIGSEGV, &act, NULL); } - } -#endif -} diff --git a/asmrun/sparc.S b/asmrun/sparc.S deleted file mode 100644 index 1ac331d962..0000000000 --- a/asmrun/sparc.S +++ /dev/null @@ -1,398 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -/* Asm part of the runtime system for the Sparc processor. */ -/* Must be preprocessed by cpp */ - -/* SunOS 4 prefixes identifiers with _ */ - -#if defined(SYS_sunos) - - .common _caml_required_size, 4, "bss" - -#define Young_limit _young_limit -#define Young_ptr _young_ptr -#define Caml_bottom_of_stack _caml_bottom_of_stack -#define Caml_last_return_address _caml_last_return_address -#define Caml_gc_regs _caml_gc_regs -#define Caml_exception_pointer _caml_exception_pointer -#define Caml_required_size _caml_required_size -#define Caml_alloc _caml_alloc -#define Caml_call_gc _caml_call_gc -#define Garbage_collection _garbage_collection -#define Caml_c_call _caml_c_call -#define Caml_start_program _caml_start_program -#define Caml_program _caml_program -#define Raise_caml_exception _raise_caml_exception -#define Callback_exn _callback_exn -#define Callback2_exn _callback2_exn -#define Callback3_exn _callback3_exn -#define Caml_apply2 _caml_apply2 -#define Caml_apply3 _caml_apply3 -#define Mlraise _mlraise -#define System_frametable _system__frametable - -#else - - .common caml_required_size, 4, 4 - -#define Young_limit young_limit -#define Young_ptr young_ptr -#define Caml_bottom_of_stack caml_bottom_of_stack -#define Caml_last_return_address caml_last_return_address -#define Caml_gc_regs caml_gc_regs -#define Caml_exception_pointer caml_exception_pointer -#define Caml_required_size caml_required_size -#define Caml_alloc caml_alloc -#define Caml_call_gc caml_call_gc -#define Garbage_collection garbage_collection -#define Caml_c_call caml_c_call -#define Caml_start_program caml_start_program -#define Caml_program caml_program -#define Raise_caml_exception raise_caml_exception -#define Callback_exn callback_exn -#define Callback2_exn callback2_exn -#define Callback3_exn callback3_exn -#define Caml_apply2 caml_apply2 -#define Caml_apply3 caml_apply3 -#define Mlraise mlraise -#define System_frametable system__frametable - -#endif - -#ifndef SYS_solaris -#define INDIRECT_LIMIT -#endif - -#define Exn_ptr %l5 -#define Alloc_ptr %l6 -#define Alloc_limit %l7 - -#define Load(symb,reg) sethi %hi(symb), %g1; ld [%g1 + %lo(symb)], reg -#define Store(reg,symb) sethi %hi(symb), %g1; st reg, [%g1 + %lo(symb)] -#define Address(symb,reg) sethi %hi(symb), reg; or reg, %lo(symb), reg - -/* Allocation functions */ - - .text - .global Caml_alloc - .global Caml_call_gc - -/* Required size in %g2 */ -Caml_alloc: -#ifdef INDIRECT_LIMIT - ld [Alloc_limit], %g1 - sub Alloc_ptr, %g2, Alloc_ptr - cmp Alloc_ptr, %g1 -#else - sub Alloc_ptr, %g2, Alloc_ptr - cmp Alloc_ptr, Alloc_limit -#endif - /*blu,pt %icc, Caml_call_gc*/ - blu Caml_call_gc - nop - retl - nop - -/* Required size in %g2 */ -Caml_call_gc: - /* Save %g2 (required size) */ - Store(%g2, Caml_required_size) - /* Save exception pointer if GC raises */ - Store(Exn_ptr, Caml_exception_pointer) - /* Save current allocation pointer for debugging purposes */ - Store(Alloc_ptr, Young_ptr) - /* Record lowest stack address */ - Store(%sp, Caml_bottom_of_stack) - /* Record last return address */ - Store(%o7, Caml_last_return_address) - /* Allocate space on stack for caml_context structure and float regs */ - sub %sp, 20*4 + 15*8, %sp - /* Save int regs on stack and save it into caml_gc_regs */ -L100: add %sp, 96 + 15*8, %g2 - st %o0, [%g2] - st %o1, [%g2 + 0x4] - st %o2, [%g2 + 0x8] - st %o3, [%g2 + 0xc] - st %o4, [%g2 + 0x10] - st %o5, [%g2 + 0x14] - st %i0, [%g2 + 0x18] - st %i1, [%g2 + 0x1c] - st %i2, [%g2 + 0x20] - st %i3, [%g2 + 0x24] - st %i4, [%g2 + 0x28] - st %i5, [%g2 + 0x2c] - st %l0, [%g2 + 0x30] - st %l1, [%g2 + 0x34] - st %l2, [%g2 + 0x38] - st %l3, [%g2 + 0x3c] - st %l4, [%g2 + 0x40] - st %g3, [%g2 + 0x44] - st %g4, [%g2 + 0x48] - Store(%g2, Caml_gc_regs) - /* Save the floating-point registers */ - add %sp, 96, %g1 - std %f0, [%g1] - std %f2, [%g1 + 0x8] - std %f4, [%g1 + 0x10] - std %f6, [%g1 + 0x18] - std %f8, [%g1 + 0x20] - std %f10, [%g1 + 0x28] - std %f12, [%g1 + 0x30] - std %f14, [%g1 + 0x38] - std %f16, [%g1 + 0x40] - std %f18, [%g1 + 0x48] - std %f20, [%g1 + 0x50] - std %f22, [%g1 + 0x58] - std %f24, [%g1 + 0x60] - std %f26, [%g1 + 0x68] - std %f28, [%g1 + 0x70] - /* Call the garbage collector */ - call Garbage_collection - nop - /* Restore all regs used by the code generator */ - add %sp, 96 + 15*8, %g2 - ld [%g2], %o0 - ld [%g2 + 0x4], %o1 - ld [%g2 + 0x8], %o2 - ld [%g2 + 0xc], %o3 - ld [%g2 + 0x10], %o4 - ld [%g2 + 0x14], %o5 - ld [%g2 + 0x18], %i0 - ld [%g2 + 0x1c], %i1 - ld [%g2 + 0x20], %i2 - ld [%g2 + 0x24], %i3 - ld [%g2 + 0x28], %i4 - ld [%g2 + 0x2c], %i5 - ld [%g2 + 0x30], %l0 - ld [%g2 + 0x34], %l1 - ld [%g2 + 0x38], %l2 - ld [%g2 + 0x3c], %l3 - ld [%g2 + 0x40], %l4 - ld [%g2 + 0x44], %g3 - ld [%g2 + 0x48], %g4 - add %sp, 96, %g1 - ldd [%g1], %f0 - ldd [%g1 + 0x8], %f2 - ldd [%g1 + 0x10], %f4 - ldd [%g1 + 0x18], %f6 - ldd [%g1 + 0x20], %f8 - ldd [%g1 + 0x28], %f10 - ldd [%g1 + 0x30], %f12 - ldd [%g1 + 0x38], %f14 - ldd [%g1 + 0x40], %f16 - ldd [%g1 + 0x48], %f18 - ldd [%g1 + 0x50], %f20 - ldd [%g1 + 0x58], %f22 - ldd [%g1 + 0x60], %f24 - ldd [%g1 + 0x68], %f26 - ldd [%g1 + 0x70], %f28 - /* Reload alloc ptr */ - Load(Young_ptr, Alloc_ptr) - /* Allocate space for block */ - Load(Caml_required_size, %g2) -#ifdef INDIRECT_LIMIT - ld [Alloc_limit], %g1 - sub Alloc_ptr, %g2, Alloc_ptr - cmp Alloc_ptr, %g1 /* Check that we have enough free space */ -#else - Load(Young_limit,Alloc_limit) - sub Alloc_ptr, %g2, Alloc_ptr - cmp Alloc_ptr, Alloc_limit -#endif - blu L100 /* If not, call GC again */ - nop - /* Return to caller */ - Load(Caml_last_return_address, %o7) - retl - add %sp, 20*4 + 15*8, %sp /* in delay slot */ - -/* Call a C function from Caml */ - - .global Caml_c_call -/* Function to call is in %g2 */ -Caml_c_call: - /* Record lowest stack address and return address */ - Store(%sp, Caml_bottom_of_stack) - Store(%o7, Caml_last_return_address) - /* Save the exception handler and alloc pointer */ - Store(Exn_ptr, Caml_exception_pointer) - sethi %hi(Young_ptr), %g1 - /* Call the C function */ - call %g2 - st Alloc_ptr, [%g1 + %lo(Young_ptr)] /* in delay slot */ - /* Reload return address */ - Load(Caml_last_return_address, %o7) - /* Reload alloc pointer */ - sethi %hi(Young_ptr), %g1 - /* Return to caller */ - retl - ld [%g1 + %lo(Young_ptr)], Alloc_ptr /* in delay slot */ - -/* Start the Caml program */ - - .global Caml_start_program -Caml_start_program: - /* Save all callee-save registers */ - save %sp, -96, %sp - /* Address of code to call */ - Address(Caml_program, %l2) - - /* Code shared with callback* */ -L108: - /* Set up a callback link on the stack. */ - sub %sp, 16, %sp - Load(Caml_bottom_of_stack, %l0) - Load(Caml_last_return_address, %l1) - Load(Caml_gc_regs, %l3) - st %l0, [%sp + 96] - st %l1, [%sp + 100] - /* Set up a trap frame to catch exceptions escaping the Caml code */ - call L111 - st %l3, [%sp + 104] - b L110 - nop -L111: sub %sp, 8, %sp - Load(Caml_exception_pointer, Exn_ptr) - st %o7, [%sp + 96] - st Exn_ptr, [%sp + 100] - mov %sp, Exn_ptr - /* Reload allocation pointers */ - Load(Young_ptr, Alloc_ptr) -#ifdef INDIRECT_LIMIT - Address(Young_limit, Alloc_limit) -#else - Load(Young_limit, Alloc_limit) -#endif - /* Call the Caml code */ -L109: call %l2 - nop - /* Pop trap frame and restore caml_exception_pointer */ - ld [%sp + 100], Exn_ptr - add %sp, 8, %sp - Store(Exn_ptr, Caml_exception_pointer) - /* Pop callback link, restoring the global variables */ -L112: ld [%sp + 96], %l0 - ld [%sp + 100], %l1 - ld [%sp + 104], %l2 - Store(%l0, Caml_bottom_of_stack) - Store(%l1, Caml_last_return_address) - Store(%l2, Caml_gc_regs) - add %sp, 16, %sp - /* Save allocation pointer */ - Store(Alloc_ptr, Young_ptr) - /* Reload callee-save registers and return */ - ret - restore %o0, 0, %o0 /* copy %o0 in this window to caller's %o0 */ -L110: - /* The trap handler */ - Store(Exn_ptr, Caml_exception_pointer) - /* Encode exception bucket as an exception result */ - b L112 - or %o0, 2, %o0 - -/* Raise an exception from C */ - - .global Raise_caml_exception -Raise_caml_exception: - /* Save exception bucket in a register outside the reg windows */ - mov %o0, %g2 - /* Load exception pointer in a register outside the reg windows */ - Load(Caml_exception_pointer, %g3) - /* Pop some frames until the trap pointer is in the current frame. */ - cmp %g3, %fp - blt L107 /* if Exn_ptr < %fp, over */ - nop -L106: restore - cmp %fp, %g3 /* if %fp <= Exn_ptr, loop */ - ble L106 - nop -L107: - /* Reload allocation registers */ - Load(Young_ptr, Alloc_ptr) -#ifdef INDIRECT_LIMIT - Address(Young_limit, Alloc_limit) -#else - Load(Young_limit, Alloc_limit) -#endif - /* Branch to exception handler */ - mov %g3, %sp - ld [%sp + 96], %g1 - ld [%sp + 100], Exn_ptr - add %sp, 8, %sp - jmp %g1 + 8 - /* Restore bucket, in delay slot */ - mov %g2, %o0 - -/* Callbacks C -> ML */ - - .global Callback_exn -Callback_exn: - /* Save callee-save registers and return address */ - save %sp, -96, %sp - /* Initial shuffling of arguments */ - mov %i0, %g1 - mov %i1, %i0 /* first arg */ - mov %g1, %i1 /* environment */ - b L108 - ld [%g1], %l2 /* code pointer */ - - .global Callback2_exn -Callback2_exn: - /* Save callee-save registers and return address */ - save %sp, -104, %sp - /* Initial shuffling of arguments */ - mov %i0, %g1 - mov %i1, %i0 /* first arg */ - mov %i2, %i1 /* second arg */ - mov %g1, %i2 /* environment */ - sethi %hi(Caml_apply2), %l2 - b L108 - or %l2, %lo(Caml_apply2), %l2 - - .global Callback3_exn -Callback3_exn: - /* Save callee-save registers and return address */ - save %sp, -104, %sp - /* Initial shuffling of arguments */ - mov %i0, %g1 - mov %i1, %i0 /* first arg */ - mov %i2, %i1 /* second arg */ - mov %i3, %i2 /* third arg */ - mov %g1, %i3 /* environment */ - sethi %hi(Caml_apply3), %l2 - b L108 - or %l2, %lo(Caml_apply3), %l2 - -#ifdef SYS_solaris - .section ".rodata" -#else - .data -#endif - .global System_frametable -System_frametable: - .word 1 /* one descriptor */ - .word L109 /* return address into callback */ - .half -1 /* negative frame size => use callback link */ - .half 0 /* no roots */ - -#ifdef SYS_solaris - .type Caml_alloc, #function - .type Caml_call_gc, #function - .type Caml_c_call, #function - .type Caml_start_program, #function - .type Raise_caml_exception, #function - .type System_frametable, #object -#endif diff --git a/asmrun/stack.h b/asmrun/stack.h deleted file mode 100644 index 265b42d26f..0000000000 --- a/asmrun/stack.h +++ /dev/null @@ -1,105 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -/* Machine-dependent interface with the asm code */ - -#ifndef _stack_ -#define _stack_ - -/* Macros to access the stack frame */ -#ifdef TARGET_alpha -#define Saved_return_address(sp) *((long *)((sp) - 8)) -#define Already_scanned(sp, retaddr) ((retaddr) & 1L) -#define Mark_scanned(sp, retaddr) (*((long *)((sp) - 8)) = (retaddr) | 1L) -#define Mask_already_scanned(retaddr) ((retaddr) & ~1L) -#define Callback_link(sp) ((struct caml_context *)((sp) + 16)) -#endif - -#ifdef TARGET_sparc -#define Saved_return_address(sp) *((long *)((sp) + 92)) -#define Callback_link(sp) ((struct caml_context *)((sp) + 104)) -#endif - -#ifdef TARGET_i386 -#define Saved_return_address(sp) *((long *)((sp) - 4)) -#define Callback_link(sp) ((struct caml_context *)((sp) + 8)) -#endif - -#ifdef TARGET_mips -#define Saved_return_address(sp) *((long *)((sp) - 4)) -#define Callback_link(sp) ((struct caml_context *)((sp) + 16)) -#endif - -#ifdef TARGET_hppa -#define Stack_grows_upwards -#define Saved_return_address(sp) *((long *)(sp)) -#define Callback_link(sp) ((struct caml_context *)((sp) - 24)) -#endif - -#ifdef TARGET_power -#define Saved_return_address(sp) *((long *)((sp) - 4)) -#define Already_scanned(sp, retaddr) ((retaddr) & 1) -#define Mark_scanned(sp, retaddr) (*((long *)((sp) - 4)) = (retaddr) | 1) -#define Mask_already_scanned(retaddr) ((retaddr) & ~1) -#ifdef SYS_aix -#define Trap_frame_size 32 -#else -#define Trap_frame_size 16 -#endif -#define Callback_link(sp) ((struct caml_context *)((sp) + Trap_frame_size)) -#endif - -#ifdef TARGET_m68k -#define Saved_return_address(sp) *((long *)((sp) - 4)) -#define Callback_link(sp) ((struct caml_context *)((sp) + 8)) -#endif - -#ifdef TARGET_arm -#define Saved_return_address(sp) *((long *)((sp) - 4)) -#define Callback_link(sp) ((struct caml_context *)((sp) + 8)) -#endif - -#ifdef TARGET_ia64 -#define Saved_return_address(sp) *((long *)((sp) + 8)) -#define Already_scanned(sp, retaddr) ((retaddr) & 1L) -#define Mark_scanned(sp, retaddr) (*((long *)((sp) + 8)) = (retaddr) | 1L) -#define Mask_already_scanned(retaddr) ((retaddr) & ~1L) -#define Callback_link(sp) ((struct caml_context *)((sp) + 32)) -#endif - -#ifdef TARGET_amd64 -#define Saved_return_address(sp) *((long *)((sp) - 8)) -#define Callback_link(sp) ((struct caml_context *)((sp) + 16)) -#endif - -/* Structure of Caml callback contexts */ - -struct caml_context { - char * bottom_of_stack; /* beginning of Caml stack chunk */ - unsigned long last_retaddr; /* last return address in Caml code */ - value * gc_regs; /* pointer to register block */ -}; - -/* Declaration of variables used in the asm code */ -extern char * caml_bottom_of_stack; -extern unsigned long caml_last_return_address; -extern value * caml_gc_regs; -extern char * caml_exception_pointer; -extern value caml_globals[]; -extern long caml_globals_inited; -extern long * caml_frametable[]; - - -#endif /* _stack_ */ diff --git a/asmrun/startup.c b/asmrun/startup.c deleted file mode 100644 index b3ae46d3c1..0000000000 --- a/asmrun/startup.c +++ /dev/null @@ -1,158 +0,0 @@ -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy and Damien Doligez, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id$ */ - -/* Start-up code */ - -#include <stdio.h> -#include <stdlib.h> -#include "callback.h" -#include "custom.h" -#include "fail.h" -#include "gc.h" -#include "gc_ctrl.h" -#include "misc.h" -#include "mlvalues.h" -#include "osdeps.h" -#include "printexc.h" -#include "sys.h" -#ifdef HAS_UI -#include "ui.h" -#endif - -extern int parser_trace; -header_t atom_table[256]; -char * static_data_start, * static_data_end; -char * code_area_start, * code_area_end; - -/* Initialize the atom table and the static data and code area limits. */ - -struct segment { char * begin; char * end; }; - -static void minmax_table(struct segment *table, char **min, char **max) -{ - int i; - *min = table[0].begin; - *max = table[0].end; - for (i = 1; table[i].begin != 0; i++) { - if (table[i].begin < *min) *min = table[i].begin; - if (table[i].end > *max) *max = table[i].end; - } -} - -static void init_atoms(void) -{ - int i; - extern struct segment caml_data_segments[], caml_code_segments[]; - - for (i = 0; i < 256; i++) atom_table[i] = Make_header(0, i, Caml_white); - minmax_table(caml_data_segments, &static_data_start, &static_data_end); - minmax_table(caml_code_segments, &code_area_start, &code_area_end); -} - -/* Configuration parameters and flags */ - -static unsigned long percent_free_init = Percent_free_def; -static unsigned long max_percent_free_init = Max_percent_free_def; -static unsigned long minor_heap_init = Minor_heap_def; -static unsigned long heap_chunk_init = Heap_chunk_def; -static unsigned long heap_size_init = Init_heap_def; -static unsigned long max_stack_init = Max_stack_def; - -/* Parse the CAMLRUNPARAM variable */ -/* The option letter for each runtime option is the first letter of the - last word of the ML name of the option (see [stdlib/gc.mli]). - Except for l (maximum stack size) and h (initial heap size). -*/ -/* Note: option l is irrelevant to the native-code runtime. */ - -/* If you change these functions, see also their copy in byterun/startup.c */ - -static void scanmult (char *opt, long unsigned int *var) -{ - char mult = ' '; - sscanf (opt, "=%lu%c", var, &mult); - sscanf (opt, "=0x%lx%c", var, &mult); - if (mult == 'k') *var = *var * 1024; - if (mult == 'M') *var = *var * (1024 * 1024); - if (mult == 'G') *var = *var * (1024 * 1024 * 1024); -} - -static void parse_camlrunparam(void) -{ - char *opt = getenv ("OCAMLRUNPARAM"); - - if (opt == NULL) opt = getenv ("CAMLRUNPARAM"); - - if (opt != NULL){ - while (*opt != '\0'){ - switch (*opt++){ - case 's': scanmult (opt, &minor_heap_init); break; - case 'i': scanmult (opt, &heap_chunk_init); break; - case 'h': scanmult (opt, &heap_size_init); break; - case 'l': scanmult (opt, &max_stack_init); break; - case 'o': scanmult (opt, &percent_free_init); break; - case 'O': scanmult (opt, &max_percent_free_init); break; - case 'v': scanmult (opt, &verb_gc); break; - case 'p': parser_trace = 1; break; - } - } - } -} - -/* These are termination hooks used by the systhreads library */ -struct longjmp_buffer caml_termination_jmpbuf; -void (*caml_termination_hook)(void *) = NULL; - -extern value caml_start_program (void); -extern void init_ieee_floats (void); -extern void init_signals (void); - -void caml_main(char **argv) -{ - char * exe_name; -#ifdef __linux__ - static char proc_self_exe[256]; -#endif - value res; - - init_ieee_floats(); - init_custom_operations(); -#ifdef DEBUG - verb_gc = 63; -#endif - parse_camlrunparam(); - init_gc (minor_heap_init, heap_size_init, heap_chunk_init, - percent_free_init, max_percent_free_init); - init_atoms(); - init_signals(); - exe_name = argv[0]; -#ifdef __linux__ - if (executable_name(proc_self_exe, sizeof(proc_self_exe)) == 0) - exe_name = proc_self_exe; -#endif - sys_init(exe_name, argv); - if (sigsetjmp(caml_termination_jmpbuf.buf, 0)) { - if (caml_termination_hook != NULL) caml_termination_hook(NULL); - return; - } - res = caml_start_program(); - if (Is_exception_result(res)) - fatal_uncaught_exception(Extract_exception(res)); -} - -void caml_startup(char **argv) -{ - caml_main(argv); -} |
