diff --git a/libnix/Makefile.in b/libnix/Makefile.in index 9918cc7..dc9cf0e 100644 --- a/libnix/Makefile.in +++ b/libnix/Makefile.in @@ -31,15 +31,15 @@ INSTALL_DATA = @INSTALL_DATA@ #### End system configuration section #### -V=VER: libnix 2.0 BETA (12.4.2000) +V=VER: libnix 2.1 (11.09.2004) CURDIR := $(shell pwd) MAK2=$(MAKE) -f $(CURDIR)/sources/Makefile -SUBDIRS=startup lib libb lib020 libb020 lib881 libb881#lib060 libb060 libb32 libb32881 libb32060 +SUBDIRS=startup lib libb lib020 libb020 lib881 libb881 libb32 #lib060 libb060 libb32 libb32881 libb32060 -all: libnix.guide libnix.info $(SUBDIRS) +all: $(SUBDIRS) cd sources; $(MAKE) filelists cd startup; $(MAKE) -f $(CURDIR)/sources/startup/Makefile V="$(V)" cd lib; $(MAK2) V="$(V)" CFLAGS="-Wall -O3 -fomit-frame-pointer" @@ -50,7 +50,7 @@ all: libnix.guide libnix.info $(SUBDIRS) cd libb881; $(MAK2) V="$(V)" CFLAGS="-Wall -O3 -fomit-frame-pointer -fbaserel -DSMALL_DATA -m68020 -m68881" # cd lib060; $(MAK2) V="$(V)" CFLAGS="-Wall -O3 -fomit-frame-pointer -m68060 -m68881" # cd libb060; $(MAK2) V="$(V)" CFLAGS="-Wall -O3 -fomit-frame-pointer -fbaserel -DSMALL_DATA -m68060 -m68881" -# cd libb32; $(MAK2) V="$(V)" CFLAGS="-Wall -O3 -fomit-frame-pointer -fbaserel32 -DSMALL_DATA -m68020" + cd libb32; $(MAK2) V="$(V)" CFLAGS="-Wall -O3 -fomit-frame-pointer -fbaserel32 -DSMALL_DATA -m68020" # cd libb32881; $(MAK2) V="$(V)" CFLAGS="-Wall -O3 -fomit-frame-pointer -fbaserel32 -DSMALL_DATA -m68020 -m68881" # cd libb32060; $(MAK2) V="$(V)" CFLAGS="-Wall -O3 -fomit-frame-pointer -fbaserel32 -DSMALL_DATA -m68060 -m68881" # cd libix; $(MAK2) V="$(V)" CFLAGS="-Wall -O3 -fomit-frame-pointer -DIXPATHS" @@ -65,7 +65,7 @@ libamiga: cd sources; $(MAK2) filelists cd lib; $(MAK2) libamiga CFLAGS="-O3 -fomit-frame-pointer" cd libb; $(MAK2) libamiga CFLAGS="-O3 -fomit-frame-pointer -fbaserel" -# cd libb32; $(MAK2) libamiga CFLAGS="-O3 -fomit-frame-pointer -fbaserel32 -m68020" + cd libb32; $(MAK2) libamiga CFLAGS="-O3 -fomit-frame-pointer -fbaserel32 -m68020" clean: cd lib; $(MAK2) clean @@ -76,7 +76,7 @@ clean: cd libb881; $(MAK2) clean # cd lib060; $(MAK2) clean # cd libb060; $(MAK2) clean -# cd lib32; $(MAK2) clean + cd libb32; $(MAK2) clean # cd libb32881; $(MAK2) clean # cd libb32060; $(MAK2) clean # cd libix; $(MAK2) clean @@ -91,7 +91,7 @@ veryclean: cd libb881; $(MAK2) veryclean # cd lib060; $(MAK2) veryclean # cd libb060; $(MAK2) veryclean -# cd lib32; $(MAK2) veryclean + cd libb32; $(MAK2) veryclean # cd libb32881; $(MAK2) veryclean # cd libb32060; $(MAK2) veryclean # cd libix; $(MAK2) veryclean @@ -121,14 +121,14 @@ install: installdirs # $(INSTALL) lib060/misc/*.o $(prefix)/lib/libm060/libnix # $(INSTALL) libb060/*/lib*.a $(prefix)/lib/libb/libm060/libnix # $(INSTALL) libb060/misc/*.o $(prefix)/lib/libb/libm060/libnix -# $(INSTALL) libb32/*/lib*.a $(prefix)/lib/libb32/libm020/libnix -# $(INSTALL) libb32/misc/*.o $(prefix)/lib/libb32/libm020/libnix + $(INSTALL) libb32/*/lib*.a $(prefix)/lib/libb32/libm020/libnix + $(INSTALL) libb32/misc/*.o $(prefix)/lib/libb32/libm020/libnix # $(INSTALL) libb32881/*/lib*.a $(prefix)/lib/libb32/libm020/libm881/libnix # $(INSTALL) libb32881/misc/*.o $(prefix)/lib/libb32/libm020/libm881/libnix # $(INSTALL) libb32060/*/lib*.a $(prefix)/lib/libb32/libm060/libnix # $(INSTALL) libb32060/misc/*.o $(prefix)/lib/libb32/libm060/libnix - $(INSTALL_DATA) *.info* $(infodir) - $(INSTALL_DATA) libnix.guide $(guidedir)/libnix.guide +# $(INSTALL_DATA) *.info* $(infodir) +# $(INSTALL_DATA) libnix.guide $(guidedir)/libnix.guide installdirs: mkinstalldirs $(srcdir)/mkinstalldirs \ @@ -145,7 +145,11 @@ installdirs: mkinstalldirs $(libdir)/libb/libm020 \ $(libdir)/libb/libm020/libnix \ $(libdir)/libb/libm020/libm881 \ - $(libdir)/libb/libm020/libm881/libnix + $(libdir)/libb/libm020/libm881/libnix \ + $(libdir)/libb32 \ + $(libdir)/libb32/libnix \ + $(libdir)/libb32/libm020 \ + $(libdir)/libb32/libm020/libnix # $(libdir)/libm060 \ # $(libdir)/libm060/libnix \ # $(libdir)/libb/libm060 \ diff --git a/libnix/configure b/libnix/configure index e9a945b..386e8af 100755 --- a/libnix/configure +++ b/libnix/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12.1 +# Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -44,10 +44,6 @@ libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' -guidedir='${prefix}/guide' -htmldir='${prefix}/html' -psdir='${prefix}/ps' -dvidir='${prefix}/dvi' mandir='${prefix}/man' # Initialize some other variables. @@ -165,10 +161,6 @@ Directory and file names: --includedir=DIR C header files in DIR [PREFIX/include] --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] --infodir=DIR info documentation in DIR [PREFIX/info] - --guidedir=DIR Amigaguide documentation in DIR [PREFIX/guide] - --htmldir=DIR HTML documentation in DIR [PREFIX/html] - --psdir=DIR postscript documentation in DIR [PREFIX/ps] - --dvidir=DIR TeX dvi documentation in DIR [PREFIX/dvi] --mandir=DIR man documentation in DIR [PREFIX/man] --srcdir=DIR find the sources in DIR [configure dir or ..] --program-prefix=PREFIX prepend PREFIX to installed program names @@ -211,22 +203,6 @@ EOF -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir="$ac_optarg" ;; - -guidedir | --guidedir | --guidedi | --guided | --guide | --gui) - ac_prev=guidedir ;; - -guidedir=* | --guidedir=* | --guidedi=* | --guided=* | --guide=* |--gui=*)+ guidedir="$ac_optarg" ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* |--htm=*)+ htmldir="$ac_optarg" ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)+ psdir="$ac_optarg" ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* |--dv=*)+ dvidir="$ac_optarg" ;; - -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) @@ -357,7 +333,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12.1" + echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) @@ -527,9 +503,11 @@ ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross +ac_exeext= +ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then @@ -547,15 +525,16 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:551: checking for $ac_word" >&5 +echo "configure:529: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" @@ -572,80 +551,21 @@ else echo "$ac_t""no" 1>&6 fi -if test -z "$CC"; then - # Extract the first word of "bcc", so it can be a program name with args. -set dummy bcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:580: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="bcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -fi -if test -z "$CC"; then - # Extract the first word of "mwcc", so it can be a program name with args. -set dummy mwcc; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:610: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_CC="mwcc" - break - fi - done - IFS="$ac_save_ifs" -fi -fi -CC="$ac_cv_prog_CC" -if test -n "$CC"; then - echo "$ac_t""$CC" 1>&6 -else - echo "$ac_t""no" 1>&6 -fi - -fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:640: checking for $ac_word" >&5 +echo "configure:559: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then @@ -680,25 +600,61 @@ else echo "$ac_t""no" 1>&6 fi + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:610: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi -test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:688: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:642: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross -cat > conftest.$ac_ext < conftest.$ac_ext << EOF + +#line 653 "configure" #include "confdefs.h" + main(){return(0);} EOF -if { (eval echo configure:702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -712,18 +668,24 @@ else ac_cv_prog_cc_works=no fi rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:722: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:684: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:727: checking whether we are using GNU C" >&5 +echo "configure:689: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -732,7 +694,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:736: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:698: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -743,11 +705,15 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:751: checking whether ${CC-cc} accepts -g" >&5 +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:717: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -762,28 +728,115 @@ rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then CFLAGS="-g -O2" else - CFLAGS="-O2" + CFLAGS="-g" fi else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" -fi -if test "$CC" = "mwcc"; then - CC="mwcc -I- -I. -I/boot/apps/GeekGadgets/include -L/boot/apps/GeekGadgets/lib -opt global -nodup" - AR="mwld" - RANLIB="true" -elif test "$CC" = "bcc"; then - AR="mwld" - RANLIB="true" + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi fi +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:751: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:781: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AR="ar" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AR" && ac_cv_prog_AR="ar" +fi +fi +AR="$ac_cv_prog_AR" +if test -n "$AR"; then + echo "$ac_t""$AR" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +# Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:811: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AS="as" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_AS" && ac_cv_prog_AS="as" +fi +fi +AS="$ac_cv_prog_AS" +if test -n "$AS"; then + echo "$ac_t""$AS" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:787: checking how to run the C preprocessor" >&5 +echo "configure:840: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -798,14 +851,14 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` +{ (eval echo configure:861: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else @@ -815,14 +868,31 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` +{ (eval echo configure:878: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:895: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else @@ -834,6 +904,8 @@ else fi rm -f conftest* fi +rm -f conftest* +fi rm -f conftest* ac_cv_prog_CPP="$CPP" fi @@ -843,20 +915,21 @@ else fi echo "$ac_t""$CPP" 1>&6 -for ac_prog in mawk gawk nawk awk +for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:852: checking for $ac_word" >&5 +echo "configure:924: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_AWK="$ac_prog" @@ -879,15 +952,16 @@ done # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:883: checking for $ac_word" >&5 +echo "configure:956: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_RANLIB="ranlib" @@ -931,22 +1005,21 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install -# AmigaOS /c/install # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:941: checking for a BSD compatible install" >&5 +echo "configure:1014: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" for ac_dir in $PATH; do # Account for people who put trailing slashes in PATH elements. case "$ac_dir/" in - /|./|.//|/etc/*|/c/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root @@ -985,6 +1058,8 @@ echo "$ac_t""$INSTALL" 1>&6 # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' @@ -1011,7 +1086,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set) 2>&1 | grep ac_space` in + case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -1054,24 +1129,41 @@ trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\_ACEOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +_ACEOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} echo creating $CONFIG_STATUS -# Some systems, like AmigaOS, won't allow you to remove a script that is -# being executed, so just move it out of the way instead. -if test -f $CONFIG_STATUS; then mv $CONFIG_STATUS $CONFIG_STATUS.old; else true; fi +rm -f $CONFIG_STATUS cat > $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF exit 0 EOF chmod +x $CONFIG_STATUS -rm -f CONFIG.STATUS.old rm -fr confdefs* $ac_clean_files test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 diff --git a/libnix/configure.in b/libnix/configure.in index 73c7f2a..c82860e 100644 --- a/libnix/configure.in +++ b/libnix/configure.in @@ -3,6 +3,10 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT() AC_PROG_CC +AC_PROG_RANLIB +AC_CHECK_PROG(AR, ar, ar, ar) +AC_CHECK_PROG(AS, as, as, as) + AC_PROG_CPP AC_PROG_AWK AC_PROG_RANLIB diff --git a/libnix/sources/Makefile.in b/libnix/sources/Makefile.in index 37e01f9..e350662 100644 --- a/libnix/sources/Makefile.in +++ b/libnix/sources/Makefile.in @@ -42,20 +42,20 @@ libamiga: cd amiga;$(MAKE) -f $(CURDIR)/../sources/amiga/Makefile CFLAGS="$(CFLAGS)" filelists: - -cd $(srcdir)/math; $(MAKELIST) SOURCEFILES="*/*" FLDIR=$(CURDIR)/math $(CURDIR)/math/filelist - -cd $(srcdir)/nix; $(MAKELIST) SOURCEFILES="*/*" FLDIR=$(CURDIR)/nix $(CURDIR)/nix/filelist - -cd $(srcdir)/nix13; $(MAKELIST) SOURCEFILES="*/*" FLDIR=$(CURDIR)/nix13 $(CURDIR)/nix13/filelist - -cd $(srcdir)/socket; $(MAKELIST) SOURCEFILES="*/*" FLDIR=$(CURDIR)/socket $(CURDIR)/socket/filelist + -cd $(srcdir)/math; $(MAKELIST) SOURCEFILES="*/*.[cSCh]" FLDIR=$(CURDIR)/math $(CURDIR)/math/filelist + -cd $(srcdir)/nix; $(MAKELIST) SOURCEFILES="*/*.[cSCh]" FLDIR=$(CURDIR)/nix $(CURDIR)/nix/filelist + -cd $(srcdir)/nix13; $(MAKELIST) SOURCEFILES="*/*.[cSCh]" FLDIR=$(CURDIR)/nix13 $(CURDIR)/nix13/filelist + -cd $(srcdir)/socket; $(MAKELIST) SOURCEFILES="*/*.[cSCh]" FLDIR=$(CURDIR)/socket $(CURDIR)/socket/filelist -cd $(srcdir)/stack; $(MAKELIST) SOURCEFILES="*.c" FLDIR=$(CURDIR)/stack $(CURDIR)/stack/filelist -cd $(srcdir)/stubs; $(MAKE) -f $(CURDIR)/Makefile STUBDIR=$(CURDIR)/stubs libbases/dos.c; \ $(MAKELIST) SOURCEFILES=" \ - libbases/* misc/__DOSBase.c misc/__UtilityBase.c \ + libbases/*.[cSCh] misc/__DOSBase.c misc/__UtilityBase.c \ misc/__MathIeeeSingBasBase.c misc/__MathIeeeDoubBasBase.c \ misc/__MathIeeeSingTransBase.c misc/__MathIeeeDoubTransBase.c \ misc/__cpucheck.c misc/__flush_cache.c misc/__initlibraries.c \ - libnames/* stubs/*" \ + libnames/* stubs/*.[cSCh]" \ FLDIR=$(CURDIR)/stubs $(CURDIR)/stubs/filelist - -cd $(srcdir)/amiga; $(MAKELIST) SOURCEFILES="*/*" FLDIR=$(CURDIR)/amiga $(CURDIR)/amiga/filelist + -cd $(srcdir)/amiga; $(MAKELIST) SOURCEFILES="*/*.[cSCh]" FLDIR=$(CURDIR)/amiga $(CURDIR)/amiga/filelist $(FLDIR)/filelist: echo "#Computer generated partial Makefile-do not edit" >$(FLDIR)/filelist diff --git a/libnix/sources/amiga/Makefile.in b/libnix/sources/amiga/Makefile.in index a95c1cf..5ba3aec 100644 --- a/libnix/sources/amiga/Makefile.in +++ b/libnix/sources/amiga/Makefile.in @@ -5,9 +5,9 @@ VPATH = @srcdir@ CC = @CC@ CPP = @CPP@ -AS = as +AS = @AS@ -AR = ar +AR = @AR@ RANLIB = @RANLIB@ AWK = @AWK@ diff --git a/libnix/sources/headers/bases.h b/libnix/sources/headers/bases.h index c2f44bf..b2bb9a4 100755 --- a/libnix/sources/headers/bases.h +++ b/libnix/sources/headers/bases.h @@ -3,6 +3,8 @@ #ifndef SMALL_DATA #define A4(x) #x +#elif defined(mc68020) +#define A4(x) "a4@(" #x ":L)" #else #define A4(x) "a4@(" #x ":W)" #endif diff --git a/libnix/sources/headers/strsup.h b/libnix/sources/headers/strsup.h index 21ecd09..70c74bd 100755 --- a/libnix/sources/headers/strsup.h +++ b/libnix/sources/headers/strsup.h @@ -2,25 +2,11 @@ #define _STRSUP_H #include +#include #ifdef __OPTIMIZE__ -extern __inline__ void *memcpy(void *s1,const void *s2,size_t n) -{ - #ifndef __NOLIBBASE__ - extern struct ExecBase *SysBase; - #endif - register char *a6 __asm("a6") = (char *)SysBase; - register const void *a0 __asm("a0") = s2; - register const void *a1 __asm("a1") = s1; - register size_t d0 __asm("d0") = n; - __asm __volatile ("jsr a6@(-0x270)" - : /* no output */ - : "r" (a6), "r" (a0), "r" (a1), "r" (d0) - : "a0","a1","d0","d1", "memory"); - return s1; -} - +#define memcpy(s1, s2, n) CopyMem(s2, s1, n) extern __inline__ void *memmove(void *s1,const void *s2,size_t n) { extern void bcopy(); diff --git a/libnix/sources/math/Makefile.in b/libnix/sources/math/Makefile.in index e85d436..17c5468 100644 --- a/libnix/sources/math/Makefile.in +++ b/libnix/sources/math/Makefile.in @@ -5,9 +5,9 @@ VPATH = @srcdir@ CC = @CC@ CPP = @CPP@ -AS = as +AS = @AS@ -AR = ar +AR = @AR@ RANLIB = @RANLIB@ AWK = @AWK@ diff --git a/libnix/sources/misc/Makefile.in b/libnix/sources/misc/Makefile.in index eeec0a5..6417e9e 100644 --- a/libnix/sources/misc/Makefile.in +++ b/libnix/sources/misc/Makefile.in @@ -5,9 +5,9 @@ VPATH = @srcdir@ CC = @CC@ CPP = @CPP@ -AS = as +AS = @AS@ -AR = ar +AR = @AR@ RANLIB = @RANLIB@ AWK = @AWK@ diff --git a/libnix/sources/nix/Makefile.in b/libnix/sources/nix/Makefile.in index 9342a72..9aa1323 100644 --- a/libnix/sources/nix/Makefile.in +++ b/libnix/sources/nix/Makefile.in @@ -5,9 +5,9 @@ VPATH = @srcdir@ CC = @CC@ CPP = @CPP@ -AS = as +AS = @AS@ -AR = ar +AR = @AR@ RANLIB = @RANLIB@ AWK = @AWK@ diff --git a/libnix/sources/nix/extra/mktemp.c b/libnix/sources/nix/extra/mktemp.c index 80d983e..78ace68 100755 --- a/libnix/sources/nix/extra/mktemp.c +++ b/libnix/sources/nix/extra/mktemp.c @@ -1,4 +1,5 @@ #include +#include #include char *mktemp(char *buf) @@ -23,3 +24,8 @@ char *mktemp(char *buf) return buf; } + +int mkstemp(char *template) { + char *buf = mktemp(template); + return open(buf, O_CREAT | O_TRUNC | O_EXCL); +} diff --git a/libnix/sources/nix/extra/readlink.c b/libnix/sources/nix/extra/readlink.c new file mode 100644 index 0000000..3f999d1 --- /dev/null +++ b/libnix/sources/nix/extra/readlink.c @@ -0,0 +1,37 @@ +#include +#include +#include +#include + +int readlink(const char *path, char *buf, int bufsiz) { + struct DevProc *dp = NULL; + BPTR lock = NULL; + int retval = -1; + + lock = Open(path, MODE_OLDFILE); + if (lock == NULL) { + errno = ENOENT; + goto done; + } + + dp = GetDeviceProc(path, NULL); + if (dp == NULL) { + errno = EINVAL; + goto done; + } + + + retval = ReadLink(dp->dvp_Port, lock, path, buf, bufsiz); + if (retval == TRUE) + retval = strlen(buf); + else + retval = -1; + +done: + if (dp != NULL) + FreeDeviceProc(dp); + + if (lock != NULL) + UnLock(lock); + return retval; +} diff --git a/libnix/sources/nix/extra/truncate.c b/libnix/sources/nix/extra/truncate.c new file mode 100644 index 0000000..0a30ee7 --- /dev/null +++ b/libnix/sources/nix/extra/truncate.c @@ -0,0 +1,17 @@ +#include +#include +#include +#include +int truncate(const char *path, off_t length) { + int retval; + BPTR fd = Open(path, MODE_OLDFILE); + if (fd != NULL) { + retval = (SetFileSize(fd, length, OFFSET_BEGINNING) >= 0) ? 0 : -1; + Close(fd); + } else { + errno = ENOENT; + retval = -1; + } + + return retval; +} diff --git a/libnix/sources/nix/math/__divsi3.c b/libnix/sources/nix/math/__divsi3.c index c66288b..0170862 100755 --- a/libnix/sources/nix/math/__divsi3.c +++ b/libnix/sources/nix/math/__divsi3.c @@ -1,23 +1,23 @@ #include "bases.h" -asm(" - .globl _div - .globl _ldiv - .globl ___modsi3 - .globl ___divsi3 +asm( +" .globl _div;" +" .globl _ldiv;" +" .globl ___modsi3;" +" .globl ___divsi3;" -| D1.L = D0.L % D1.L signed +"| D1.L = D0.L % D1.L signed" -___modsi3: moveml sp@(4:W),d0/d1 - jbsr ___divsi4 - movel d1,d0 - rts +"___modsi3: moveml sp@(4:W),d0/d1;" +" jbsr ___divsi4;" +" movel d1,d0;" +" rts;" -| D0.L = D0.L / D1.L signed +"| D0.L = D0.L / D1.L signed" -_div: -_ldiv: -___divsi3: moveml sp@(4:W),d0/d1 -___divsi4: movel "A4(_UtilityBase)",a0 - jmp a0@(-150:W) -"); +"_div:;" +"_ldiv:;" +"___divsi3: moveml sp@(4:W),d0/d1;" +"___divsi4: movel "A4(_UtilityBase)",a0;" +" jmp a0@(-150:W);" +); diff --git a/libnix/sources/nix/math/__mulsi3.c b/libnix/sources/nix/math/__mulsi3.c index 126b769..d3ee8f7 100755 --- a/libnix/sources/nix/math/__mulsi3.c +++ b/libnix/sources/nix/math/__mulsi3.c @@ -1,11 +1,11 @@ #include "bases.h" -asm(" - .globl ___mulsi3 +asm( +" .globl ___mulsi3;" -| D0 = D0 * D1 +"| D0 = D0 * D1;" -___mulsi3: moveml sp@(4),d0/d1 - movel "A4(_UtilityBase)",a0 - jmp a0@(-138:W) -"); +"___mulsi3: moveml sp@(4),d0/d1;" +" movel "A4(_UtilityBase)",a0;" +" jmp a0@(-138:W);" +); diff --git a/libnix/sources/nix/math/__udivsi3.c b/libnix/sources/nix/math/__udivsi3.c index d26c00d..0dfa09c 100755 --- a/libnix/sources/nix/math/__udivsi3.c +++ b/libnix/sources/nix/math/__udivsi3.c @@ -1,19 +1,19 @@ #include "bases.h" -asm(" - .globl ___umodsi3 - .globl ___udivsi3 +asm( +" .globl ___umodsi3;" +" .globl ___udivsi3;" -| D1.L = D0.L % D1.L unsigned +"| D1.L = D0.L % D1.L unsigned;" -___umodsi3: moveml sp@(4:W),d0/d1 - jbsr ___udivsi4 - movel d1,d0 - rts +"___umodsi3: moveml sp@(4:W),d0/d1;" +" jbsr ___udivsi4;" +" movel d1,d0;" +" rts;" -| D0.L = D0.L / D1.L unsigned +"| D0.L = D0.L / D1.L unsigned;" -___udivsi3: moveml sp@(4:W),d0/d1 -___udivsi4: movel "A4(_UtilityBase)",a0 - jmp a0@(-156:W) -"); +"___udivsi3: moveml sp@(4:W),d0/d1;" +"___udivsi4: movel "A4(_UtilityBase)",a0;" +" jmp a0@(-156:W);" +); diff --git a/libnix/sources/nix/misc/__request.c b/libnix/sources/nix/misc/__request.c index 8741d2d..c8d9988 100755 --- a/libnix/sources/nix/misc/__request.c +++ b/libnix/sources/nix/misc/__request.c @@ -1,51 +1,49 @@ #include "bases.h" -asm(" - .data - .even +asm( + ".data;" + ".even;" +"body: .byte 0,0,0,0;" +" .word 15,5;" +" .long 0,0,0;" -body: .byte 0,0,0,0 - .word 15,5 - .long 0,0,0 +"ok: .byte 0,0,0,0;" +" .word 6,3;" +" .long 0,oktext,0;" +" .text;" +"oktext: .byte 79,107,0;" -ok: .byte 0,0,0,0 - .word 6,3 - .long 0,oktext,0 - - .text -oktext: .byte 79,107,0 - - .even - .globl ___request -___request: - moveml #0x3832,sp@- - movel 4:W,a6 - subal a1,a1 - jsr a6@(-0x126) | FindTask(a1:nam) - movel d0,a1 - moveq #-1,d1 - cmpl a1@(0xb8:W),d1 - jeq l_fail | Dont put requesters up - lea "A4(___intuitionname)",a1 - moveq #0,d0 - jsr a6@(-0x228) | OpenLibrary(a1:nam,d0:ver) - movel d0,d4 - jeq l_fail - lea "A4(ok)",a3 - lea "A4(body)",a1 - subl a2,a2 - movel sp@(28),a1@(12:W) - subl a0,a0 - moveq #0,d0 - moveq #0,d1 - moveq #(640>>4),d2 - lslw #4,d2 - moveq #72,d3 - exg d4,a6 - jsr a6@(-0x15c) | AutoRequest(a0,a1,a2,a3,d0,d1,d2,d3) - movel a6,a1 - movel d4,a6 - jsr a6@(-0x19e) | CloseLibrary(a1:lib) -l_fail: moveml sp@+,#0x4c1c - rts -"); +" .even;" +" .globl ___request;" +"___request:" +" moveml #0x3832,sp@-;" +" movel 4:W,a6;" +" subal a1,a1;" +" jsr a6@(-0x126); | FindTask(a1:nam)" +" movel d0,a1;" +" moveq #-1,d1;" +" cmpl a1@(0xb8:W),d1;" +" jeq l_fail; | Dont put requesters up" +" lea "A4(___intuitionname)",a1;" +" moveq #0,d0;" +" jsr a6@(-0x228); | OpenLibrary(a1:nam,d0:ver)" +" movel d0,d4;" +" jeq l_fail;" +" lea "A4(ok)",a3;" +" lea "A4(body)",a1;" +" subl a2,a2;" +" movel sp@(2;8),a1@(12:W);" +" subl a0,a0;" +" moveq #0,d0;" +" moveq #0,d1;" +" moveq #(640>>4),d2;" +" lslw #4,d2;" +" moveq #72,d3;" +" exg d4,a6;" +" jsr a6@(-0x15c); | AutoRequest(a0,a1,a2,a3,d0,d1,d2,d3)" +" movel a6,a1;" +" movel d4,a6;" +" jsr a6@(-0x19e); | CloseLibrary(a1:lib)" +"l_fail: moveml sp@+,#0x4c1c;" +" rts;" +); diff --git a/libnix/sources/nix/setjmp/longjmp.c b/libnix/sources/nix/setjmp/longjmp.c index 89d93e7..ab2c38c 100755 --- a/libnix/sources/nix/setjmp/longjmp.c +++ b/libnix/sources/nix/setjmp/longjmp.c @@ -1,16 +1,16 @@ -asm(" - .text - .even - .globl _longjmp +asm( +" .text;" +" .even;" +" .globl _longjmp;" -_longjmp: - addql #4,sp | returns to another address - movel sp@+,a0 | get address of jmp_buf - movel sp@+,d0 | get returncode - jne l0 | != 0 -> ok - moveql #1,d0 -l0: movel a0@(48:W),sp | restore sp - movel a0@+,sp@ | set returnaddress - moveml a0@,d2-d7/a2-a6 | restore all registers except scratch and sp - rts -"); +"_longjmp:;" +" addql #4,sp | returns to another address;" +" movel sp@+,a0 | get address of jmp_buf;" +" movel sp@+,d0 | get returncode;" +" jne l0 | != 0 -> ok;" +" moveql #1,d0;" +"l0: movel a0@(48:W),sp | restore sp;" +" movel a0@+,sp@ | set returnaddress;" +" moveml a0@,d2-d7/a2-a6 | restore all registers except scratch and sp;" +" rts;" +); diff --git a/libnix/sources/nix/setjmp/setjmp.c b/libnix/sources/nix/setjmp/setjmp.c index c6eba67..e473e2f 100755 --- a/libnix/sources/nix/setjmp/setjmp.c +++ b/libnix/sources/nix/setjmp/setjmp.c @@ -1,12 +1,12 @@ -asm(" - .text - .even - .globl _setjmp +asm( +" .text;" +" .even;" +" .globl _setjmp;" -_setjmp: - movel sp@(4),a0 | get address of jmp_buf - movel sp@,a0@+ | store returnaddress - moveml d2-d7/a2-a6/sp,a0@ | store all registers except scratch - moveql #0,d0 | return 0 - rts -"); +"_setjmp:;" +" movel sp@(4),a0 | get address of jmp_buf;" +" movel sp@,a0@+ | store returnaddress;" +" moveml d2-d7/a2-a6/sp,a0@ | store all registers except scratch;" +" moveql #0,d0 | return 0;" +" rts;" +); diff --git a/libnix/sources/nix/stdio/puts.c b/libnix/sources/nix/stdio/puts.c index 479e984..ebc3962 100755 --- a/libnix/sources/nix/stdio/puts.c +++ b/libnix/sources/nix/stdio/puts.c @@ -9,3 +9,7 @@ int puts(const char *s) return EOF; return 0; } + +int putchar(int c) { + return fputc(c, stdout); +} diff --git a/libnix/sources/nix/stdlib/free.c b/libnix/sources/nix/stdlib/free.c index 420dde7..8b60396 100755 --- a/libnix/sources/nix/stdlib/free.c +++ b/libnix/sources/nix/stdlib/free.c @@ -5,6 +5,7 @@ #include "debuglib.h" extern struct MinList __memorylist; +extern struct SignalSemaphore *__memsema; void free(void *ptr) { struct MemHeader *a; @@ -13,6 +14,7 @@ void free(void *ptr) { DB( BUG("NULL pointer free'd\n"); ) return; } + ObtainSemaphore(__memsema); a=(struct MemHeader *)__memorylist.mlh_Head; for(;;) { @@ -31,5 +33,7 @@ void free(void *ptr) Deallocate(a,(ULONG *)ptr-1,((ULONG *)ptr)[-1]); if(a->mh_Free==(char *)a->mh_Upper-(char *)a->mh_Lower) /* All free ? */ { Remove(&a->mh_Node); - FreeMem(a,(char *)a->mh_Upper-(char *)a); } + FreeMem(a,(char *)a->mh_Upper-(char *)a); + } + ReleaseSemaphore(__memsema); } diff --git a/libnix/sources/nix/stdlib/malloc.c b/libnix/sources/nix/stdlib/malloc.c index 180f160..0c977bd 100755 --- a/libnix/sources/nix/stdlib/malloc.c +++ b/libnix/sources/nix/stdlib/malloc.c @@ -5,33 +5,33 @@ */ #include +#include #include #include #include +#include +#include #include "stabs.h" extern ULONG _MSTEP; -struct MinList __memorylist= /* memorylist (empty): free needs also access */ -{ - (struct MinNode *)&__memorylist.mlh_Tail, - NULL, - (struct MinNode *)&__memorylist.mlh_Head -}; - +struct MinList __memorylist; /* memorylist (empty): free needs also access */ +struct SignalSemaphore *__memsema; void *malloc(size_t size) { - struct MinNode *node=__memorylist.mlh_Head; + struct MinNode *node; struct MemHeader *b; - ULONG size2,*a; + ULONG size2,*a = NULL; + ObtainSemaphore(__memsema); + node=__memorylist.mlh_Head; size+=sizeof(ULONG); while(node->mln_Succ) /* yet some memory in my list ? */ { if((a=Allocate((struct MemHeader *)node,size))!=NULL) { *a++=size; - return a; + goto end; } node=node->mln_Succ; } @@ -47,16 +47,30 @@ void *malloc(size_t size) b->mh_Upper=(char *)b+size2; AddHead((struct List *)&__memorylist,&b->mh_Node); a=Allocate(b,size); /* It has to work this time */ - *a++=size; - return a; + if (a != NULL) { + *a++=size; + } } - return NULL; + + end: + ReleaseSemaphore(__memsema); + return a; +} + +void __initmalloc(void) +{ + struct Library *DOSBase = OpenLibrary("dos.library", 0); + NewList((struct List *)&__memorylist); + __memsema = AllocMem(sizeof(struct SignalSemaphore), MEMF_PUBLIC | MEMF_CLEAR); + InitSemaphore(__memsema); } void __exitmalloc(void) { struct MemHeader *a; while((a=(struct MemHeader *)RemHead((struct List *)&__memorylist))!=NULL) FreeMem(a,(char *)a->mh_Upper-(char *)a); /* free all memory */ + FreeMem(__memsema, sizeof(struct SignalSemaphore)); } ADD2EXIT(__exitmalloc,-50); +ADD2INIT(__initmalloc,-50); diff --git a/libnix/sources/nix/stdlib/putenv.c b/libnix/sources/nix/stdlib/putenv.c new file mode 100644 index 0000000..cef7deb --- /dev/null +++ b/libnix/sources/nix/stdlib/putenv.c @@ -0,0 +1,38 @@ +#include +#include +#include +#include + +int setenv(const char *name, const char *value, int overwrite) { + char *old = getenv(name); + int retval = 0; + if (old == NULL || overwrite) { + retval = SetVar(name, value, strlen(value), GVF_LOCAL_ONLY) == TRUE ? 0 : -1; + } + return retval; +} + +void unsetenv(const char *name) { + DeleteVar(name, GVF_LOCAL_ONLY); +} +int putenv(const char *str) { + char *tmp = malloc(strlen(str) + 1); + int retval = -1; + char *pos; + if (tmp == NULL) { + goto end; + } + strcpy(tmp, str); + pos = strchr(tmp, '='); + if (pos == NULL) + goto end; + *pos++ = '\0'; + + retval = setenv(str, pos, 1); + +end: + if (tmp != NULL) + free(tmp); + return retval; +} + diff --git a/libnix/sources/nix/string/strcat.c b/libnix/sources/nix/string/strcat.c index 89128dd..d711237 100755 --- a/libnix/sources/nix/string/strcat.c +++ b/libnix/sources/nix/string/strcat.c @@ -10,17 +10,17 @@ char *strcat(char *s1,const char *s2) #else -asm(" - .globl _strcat -_strcat: - movml sp@(4:W),d0/a0 - movel d0,a1 -L2: tstb a1@+ - jne L2 - subql #1,a1 -L1: moveb a0@+,a1@+ - jne L1 - rts -"); +asm( +" .globl _strcat;" +"_strcat:;" +" movml sp@(4:W),d0/a0;" +" movel d0,a1;" +"L2: tstb a1@+;" +" jne L2;" +" subql #1,a1;" +"L1: moveb a0@+,a1@+;" +" jne L1;" +" rts;" +); #endif diff --git a/libnix/sources/nix/string/strcpy.c b/libnix/sources/nix/string/strcpy.c index 56508b0..48f3260 100755 --- a/libnix/sources/nix/string/strcpy.c +++ b/libnix/sources/nix/string/strcpy.c @@ -14,14 +14,14 @@ char *strcpy(char *s1,const char *s2) #else -asm(" - .globl _strcpy -_strcpy: - moveml sp@(4:W),d0/a0 - movel d0,a1 -L1: moveb a0@+,a1@+ - jne L1 - rts -"); +asm( +" .globl _strcpy;" +"_strcpy:;" +" moveml sp@(4:W),d0/a0;" +" movel d0,a1;" +"L1: moveb a0@+,a1@+;" +" jne L1;" +" rts;" +); #endif diff --git a/libnix/sources/nix/string/strncat.c b/libnix/sources/nix/string/strncat.c index 50b1d8a..eb8b984 100755 --- a/libnix/sources/nix/string/strncat.c +++ b/libnix/sources/nix/string/strncat.c @@ -20,22 +20,22 @@ char *strncat(char *s1,const char *s2,size_t n) #else -asm(" - .globl _strncat -_strncat: - moveml sp@(4:W),d0/a0 - movel d0,a1 - movel sp@(12),d1 - jeq L1 -L3: tstb a1@+ - jne L3 - subql #1,a1 -L2: moveb a0@+,a1@+ - jeq L1 - subql #1,d1 - jne L2 - clrb a1@ -L1: rts -"); +asm( +" .globl _strncat;" +"_strncat:;" +" moveml sp@(4:W),d0/a0;" +" movel d0,a1;" +" movel sp@(12),d1;" +" jeq L1;" +"L3: tstb a1@+;" +" jne L3;" +" subql #1,a1;" +"L2: moveb a0@+,a1@+;" +" jeq L1;" +" subql #1,d1;" +" jne L2;" +" clrb a1@;" +"L1: rts;" +); #endif diff --git a/libnix/sources/nix/string/strncpy.c b/libnix/sources/nix/string/strncpy.c index 1c1c3f5..62db05a 100755 --- a/libnix/sources/nix/string/strncpy.c +++ b/libnix/sources/nix/string/strncpy.c @@ -15,21 +15,21 @@ char *strncpy(char *s1,const char *s2,size_t n) #else -asm(" - .globl _strncpy -_strncpy: - moveml sp@(4:W),d0/a0 - movel d0,a1 - movel sp@(12:W),d1 -L4: subql #1,d1 - bcs L1 - moveb a0@+,a1@+ - bne L4 - .word 0x0c40 -L3: clrb a1@+ - subql #1,d1 - bcc L3 -L1: rts -"); +asm( +" .globl _strncpy;" +"_strncpy:;" +" moveml sp@(4:W),d0/a0;" +" movel d0,a1;" +" movel sp@(12:W),d1;" +"L4: subql #1,d1;" +" bcs L1;" +" moveb a0@+,a1@+;" +" bne L4;" +" .word 0x0c40;" +"L3: clrb a1@+;" +" subql #1,d1;" +" bcc L3;" +"L1: rts;" +); #endif diff --git a/libnix/sources/nix13/Makefile.in b/libnix/sources/nix13/Makefile.in index 0aa7aea..f023ece 100644 --- a/libnix/sources/nix13/Makefile.in +++ b/libnix/sources/nix13/Makefile.in @@ -5,9 +5,9 @@ VPATH = @srcdir@ CC = @CC@ CPP = @CPP@ -AS = as +AS = @AS@ -AR = ar +AR = @AR@ RANLIB = @RANLIB@ AWK = @AWK@ diff --git a/libnix/sources/nix13/math/__divsi3.c b/libnix/sources/nix13/math/__divsi3.c index 5798a37..dc01ae5 100644 --- a/libnix/sources/nix13/math/__divsi3.c +++ b/libnix/sources/nix13/math/__divsi3.c @@ -1,41 +1,41 @@ -asm(" - .globl _div - .globl _ldiv - .globl ___modsi3 - .globl ___divsi3 +asm( +" .globl _div;" +" .globl _ldiv;" +" .globl ___modsi3;" +" .globl ___divsi3;" -| D1.L = D0.L % D1.L signed +" | D1.L = D0.L % D1.L signed;" -___modsi3: moveml sp@(4:W),d0/d1 - jbsr ___divsi4 - movel d1,d0 - rts +"___modsi3: moveml sp@(4:W),d0/d1;" +" jbsr ___divsi4;" +" movel d1,d0;" +" rts;" -| D0.L = D0.L / D1.L signed +"| D0.L = D0.L / D1.L signed;" -_div: -_ldiv: -___divsi3: moveml sp@(4:W),d0/d1 -___divsi4: movel d3,sp@- - movel d2,sp@- - moveq #0,d2 - tstl d0 - bpls LC5 - negl d0 - addql #1,d2 -LC5: movel d2,d3 - tstl d1 - bpls LC4 - negl d1 - eoriw #1,d3 -LC4: jbsr ___udivsi4 -LC3: tstw d2 - beqs LC2 - negl d0 -LC2: tstw d3 - beqs LC1 - negl d1 -LC1: movel sp@+,d2 - movel sp@+,d3 - rts -"); +"_div:;" +"_ldiv:;" +"___divsi3: moveml sp@(4:W),d0/d1;" +"___divsi4: movel d3,sp@-;" +" movel d2,sp@-;" +" moveq #0,d2;" +" tstl d0;" +" bpls LC5;" +" negl d0;" +" addql #1,d2;" +"LC5: movel d2,d3;" +" tstl d1;" +" bpls LC4;" +" negl d1;" +" eoriw #1,d3;" +"LC4: jbsr ___udivsi4;" +"LC3: tstw d2;" +" beqs LC2;" +" negl d0;" +"LC2: tstw d3;" +" beqs LC1;" +" negl d1;" +"LC1: movel sp@+,d2;" +" movel sp@+,d3;" +" rts;" +); diff --git a/libnix/sources/nix13/math/__mulsi3.c b/libnix/sources/nix13/math/__mulsi3.c index a91186d..23a96bf 100644 --- a/libnix/sources/nix13/math/__mulsi3.c +++ b/libnix/sources/nix13/math/__mulsi3.c @@ -1,25 +1,25 @@ -asm(" - .globl ___mulsi3 +asm( +" .globl ___mulsi3;" -| D0 = D0 * D1 +"| D0 = D0 * D1;" -___mulsi3: moveml sp@(4),d0/d1 - movel d3,sp@- - movel d2,sp@- - movew d1,d2 - mulu d0,d2 - movel d1,d3 - swap d3 - mulu d0,d3 - swap d3 - clrw d3 - addl d3,d2 - swap d0 - mulu d1,d0 - swap d0 - clrw d0 - addl d2,d0 - movel sp@+,d2 - movel sp@+,d3 - rts -"); +"___mulsi3: moveml sp@(4),d0/d1;" +" movel d3,sp@-;" +" movel d2,sp@-;" +" movew d1,d2;" +" mulu d0,d2;" +" movel d1,d3;" +" swap d3;" +" mulu d0,d3;" +" swap d3;" +" clrw d3;" +" addl d3,d2;" +" swap d0;" +" mulu d1,d0;" +" swap d0;" +" clrw d0;" +" addl d2,d0;" +" movel sp@+,d2;" +" movel sp@+,d3;" +" rts;" +); diff --git a/libnix/sources/nix13/math/__udivsi3.c b/libnix/sources/nix13/math/__udivsi3.c index 7a41031..99f0958 100644 --- a/libnix/sources/nix13/math/__udivsi3.c +++ b/libnix/sources/nix13/math/__udivsi3.c @@ -1,50 +1,50 @@ -asm(" - .globl ___umodsi3 - .globl ___udivsi3 - .globl ___udivsi4 +asm( +" .globl ___umodsi3;" +" .globl ___udivsi3;" +" .globl ___udivsi4;" -| D1.L = D0.L % D1.L unsigned +"| D1.L = D0.L % D1.L unsigned;" -___umodsi3: moveml sp@(4:W),d0/d1 - jbsr ___udivsi4 - movel d1,d0 - rts +"___umodsi3: moveml sp@(4:W),d0/d1;" +" jbsr ___udivsi4;" +" movel d1,d0;" +" rts;" -| D0.L = D0.L / D1.L unsigned +"| D0.L = D0.L / D1.L unsigned;" -___udivsi3: moveml sp@(4:W),d0/d1 -___udivsi4: movel d3,sp@- - movel d2,sp@- - movel d1,d3 - swap d1 - tstw d1 - bnes LC4 - movew d0,d2 - clrw d0 - swap d0 - divu d3,d0 - movel d0,d1 - swap d0 - movew d2,d1 - divu d3,d1 - movew d1,d0 - clrw d1 - swap d1 - jra LC1 -LC4: movel d0,d1 - swap d0 - clrw d0 - clrw d1 - swap d1 - moveq #16-1,d2 -LC3: addl d0,d0 - addxl d1,d1 - cmpl d1,d3 - bhis LC2 - subl d3,d1 - addqw #1,d0 -LC2: dbra d2,LC3 -LC1: movel sp@+,d2 - movel sp@+,d3 - rts -"); +"___udivsi3: moveml sp@(4:W),d0/d1;" +"___udivsi4: movel d3,sp@-;" +" movel d2,sp@-;" +" movel d1,d3;" +" swap d1;" +" tstw d1;" +" bnes LC4;" +" movew d0,d2;" +" clrw d0;" +" swap d0;" +" divu d3,d0;" +" movel d0,d1;" +" swap d0;" +" movew d2,d1;" +" divu d3,d1;" +" movew d1,d0;" +" clrw d1;" +" swap d1;" +" jra LC1;" +"LC4: movel d0,d1;" +" swap d0;" +" clrw d0;" +" clrw d1;" +" swap d1;" +" moveq #16-1,d2;" +"LC3: addl d0,d0;" +" addxl d1,d1;" +" cmpl d1,d3;" +" bhis LC2;" +" subl d3,d1;" +" addqw #1,d0;" +"LC2: dbra d2,LC3;" +"LC1: movel sp@+,d2;" +" movel sp@+,d3;" +" rts;" +); diff --git a/libnix/sources/nix_main/Makefile.in b/libnix/sources/nix_main/Makefile.in index 6e7447f..c8cb024 100644 --- a/libnix/sources/nix_main/Makefile.in +++ b/libnix/sources/nix_main/Makefile.in @@ -5,9 +5,9 @@ VPATH = @srcdir@ CC = @CC@ CPP = @CPP@ -AS = as +AS = @AS@ -AR = ar +AR = @AR@ RANLIB = @RANLIB@ AWK = @AWK@ diff --git a/libnix/sources/nixmain/Makefile.in b/libnix/sources/nixmain/Makefile.in index bfac275..238ded8 100644 --- a/libnix/sources/nixmain/Makefile.in +++ b/libnix/sources/nixmain/Makefile.in @@ -5,9 +5,9 @@ VPATH = @srcdir@ CC = @CC@ CPP = @CPP@ -AS = as +AS = @AS@ -AR = ar +AR = @AR@ RANLIB = @RANLIB@ AWK = @AWK@ diff --git a/libnix/sources/socket/Makefile.in b/libnix/sources/socket/Makefile.in index 67246e4..1bc2b15 100644 --- a/libnix/sources/socket/Makefile.in +++ b/libnix/sources/socket/Makefile.in @@ -5,9 +5,9 @@ VPATH = @srcdir@ CC = @CC@ CPP = @CPP@ -AS = as +AS = @AS@ -AR = ar +AR = @AR@ RANLIB = @RANLIB@ AWK = @AWK@ diff --git a/libnix/sources/socket/socket/ioctl.c b/libnix/sources/socket/socket/ioctl.c index 9166e2a..254c384 100644 --- a/libnix/sources/socket/socket/ioctl.c +++ b/libnix/sources/socket/socket/ioctl.c @@ -68,6 +68,7 @@ int ioctl(int s, unsigned long cmd, ...) /* we really don't have to bother the library with cmds we can't even * map over... */ + break; } rc = SOCK_ioctl(fp->lx_sock,cmd,data); break; diff --git a/libnix/sources/socket/unistd/getgrent.c b/libnix/sources/socket/unistd/getgrent.c index 6c32c90..d76ea63 100644 --- a/libnix/sources/socket/unistd/getgrent.c +++ b/libnix/sources/socket/unistd/getgrent.c @@ -153,6 +153,7 @@ struct group *getgrent(void) return (struct group *)&builtin_nogroup; case (gid_t)(-1): //return NULL; + break; } } diff --git a/libnix/sources/stack/Makefile.in b/libnix/sources/stack/Makefile.in index 0eaf709..7982664 100644 --- a/libnix/sources/stack/Makefile.in +++ b/libnix/sources/stack/Makefile.in @@ -5,9 +5,9 @@ VPATH = @srcdir@ CC = @CC@ CPP = @CPP@ -AS = as +AS = @AS@ -AR = ar +AR = @AR@ RANLIB = @RANLIB@ AWK = @AWK@ diff --git a/libnix/sources/stack/link_a5_0_f.c b/libnix/sources/stack/link_a5_0_f.c index 8cf8bde..ccf4424 100755 --- a/libnix/sources/stack/link_a5_0_f.c +++ b/libnix/sources/stack/link_a5_0_f.c @@ -1,27 +1,27 @@ #include "bases.h" -asm(" - .text - .even - .globl ___link_a5_0_f - .globl ___sub_0_sp_f +asm( +" .text;" +" .even;" +" .globl ___link_a5_0_f;" +" .globl ___sub_0_sp_f;" -___link_a5_0_f: - movel sp@+,a0 - cmpl "A4(___stk_limit)",sp - jcc l0 - jbsr l2 -l0: link a5,#0:W - jmp a0@ +"___link_a5_0_f:" +" movel sp@+,a0;" +" cmpl "A4(___stk_limit)",sp;" +" jcc l0;" +" jbsr l2;" +"l0: link a5,#0:W;" +" jmp a0@;" -___sub_0_sp_f: - movel sp@+,a0 - cmpl "A4(___stk_limit)",sp - jcc l1 - jbsr l2 -l1: jmp a0@ +"___sub_0_sp_f:" +" movel sp@+,a0;" +" cmpl "A4(___stk_limit)",sp;" +" jcc l1;" +" jbsr l2;" +"l1: jmp a0@;" -l2: moveq #0,d0 - moveq #0,d1 - jra ___stkext_f -"); +"l2: moveq #0,d0;" +" moveq #0,d1;" +" jra ___stkext_f;" +); diff --git a/libnix/sources/stack/link_a5_d0_f.c b/libnix/sources/stack/link_a5_d0_f.c index 8f68d3f..8f9ea52 100755 --- a/libnix/sources/stack/link_a5_d0_f.c +++ b/libnix/sources/stack/link_a5_d0_f.c @@ -1,32 +1,32 @@ #include "bases.h" -asm(" - .text - .even - .globl ___link_a5_d0_f - .globl ___sub_d0_sp_f +asm( +" .text;" +" .even;" +" .globl ___link_a5_d0_f;" +" .globl ___sub_d0_sp_f;" -___link_a5_d0_f: - movel sp@+,a0 - movel sp,d1 - subl d0,d1 - cmpl "A4(___stk_limit)",d1 - jcc l0 - jbsr l2 -l0: link a5,#0:W - subl d0,sp - jmp a0@ +"___link_a5_d0_f:" +" movel sp@+,a0;" +" movel sp,d1;" +" subl d0,d1;" +" cmpl "A4(___stk_limit)",d1;" +" jcc l0;" +" jbsr l2;" +"l0: link a5,#0:W;" +" subl d0,sp;" +" jmp a0@;" -___sub_d0_sp_f: - movel sp@+,a0 - movel sp,d1 - subl d0,d1 - cmpl "A4(___stk_limit)",d1 - jcc l1 - jbsr l2 -l1: subl d0,sp - jmp a0@ +"___sub_d0_sp_f:" +" movel sp@+,a0;" +" movel sp,d1;" +" subl d0,d1;" +" cmpl "A4(___stk_limit)",d1;" +" jcc l1;" +" jbsr l2;" +"l1: subl d0,sp;" +" jmp a0@;" -l2: moveq #0,d1 - jra ___stkext_f -"); +"l2: moveq #0,d1;" +" jra ___stkext_f;" +); diff --git a/libnix/sources/stack/longjmp.c b/libnix/sources/stack/longjmp.c index d3f656d..5c3cd75 100755 --- a/libnix/sources/stack/longjmp.c +++ b/libnix/sources/stack/longjmp.c @@ -1,18 +1,18 @@ -asm(" - .text - .even - .globl _longjmp +asm( +" .text;" +" .even;" +" .globl _longjmp;" -_longjmp: - addql #4,sp | returns to another address - movel sp@+,a0 | get address of jmp_buf - movel sp@+,d2 | get returncode - movel a0@(48:W),d0 - jbsr ___stkrst | restore sp - movel d2,d0 - jne l0 | != 0 -> ok - moveql #1,d0 -l0: movel a0@+,sp@ | set returnaddress - moveml a0@,#0x7cfc | restore all registers except scratch and sp - rts -"); +"_longjmp:" +" addql #4,sp | returns to another address" +" movel sp@+,a0 | get address of jmp_buf" +" movel sp@+,d2 | get returncode" +" movel a0@(48:W),d0;" +" jbsr ___stkrst | restore sp" +" movel d2,d0;" +" jne l0 | != 0 -> ok" +" moveql #1,d0;" +"l0: movel a0@+,sp@ | set returnaddress" +" moveml a0@,#0x7cfc | restore all registers except scratch and sp" +" rts" +); diff --git a/libnix/sources/stack/stkchk_d0.c b/libnix/sources/stack/stkchk_d0.c index 3d9fbcb..a9269bd 100755 --- a/libnix/sources/stack/stkchk_d0.c +++ b/libnix/sources/stack/stkchk_d0.c @@ -1,22 +1,22 @@ #include "bases.h" -asm(" - .text - .even - .globl ___stkchk_d0 - .globl ___stkchk_0 +asm( +" .text;" +" .even;" +" .globl ___stkchk_d0;" +" .globl ___stkchk_0;" -___stkchk_d0: - negl d0 - addl sp,d0 - cmpl "A4(___stk_limit)",d0 - jcs L0 - rts +"__stkchk_d0:;" +" negl d0;" +" addl sp,d0;" +" cmpl "A4(___stk_limit)",d0;" +" jcs L0;" +" rts;" -___stkchk_0: - cmpl "A4(___stk_limit)",sp - jcs L0 - rts +"___stkchk_0:;" +" cmpl "A4(___stk_limit)",sp;" +" jcs L0;" +" rts;" -L0: jra ___stkovf -"); +"L0: jra ___stkovf;" +); diff --git a/libnix/sources/stack/stkext.c b/libnix/sources/stack/stkext.c index 254ddf1..baf014b 100755 --- a/libnix/sources/stack/stkext.c +++ b/libnix/sources/stack/stkext.c @@ -1,139 +1,139 @@ #include "bases.h" #include "stabs.h" -asm(" - .text - .even - .globl ___stkext_f - .globl ___stkext - .globl ___exit_stk - .globl ___stk_free +asm( +" .text;" +" .even;" +" .globl ___stkext_f;" +" .globl ___stkext;" +" .globl ___exit_stk;" +" .globl ___stk_free;" -___stkext_f: - movel a0,sp@- - movel sp,a0 | memorize sp - moveml #0xc062,sp@- | preserves all registers - movel sp,a2 | memorize sp - addl #28:W,d1 | Used by this function itself - movel "A4(___stackborders)",a1| get upper border of stack in a1 - movel a1@(4:W),a1 - tstl "A4(___used_stack)" - bne l0 - movel "A4(___SaveSP)",a1 -l0: jbsr ___stkext | change to a stackframe with d0 bytes - movel "A4(___used_stack)",a6 | fix stored sp - addl d1,a6@(12:W) - movel a2,d0 | calculate number of bytes to copy - addl "A4(___stk_argbytes)",d0| to new stackframe in d0 - addl d1,d0 - cmpl a1,d0 | never copy over the bottom of the stack - jls l1 - movel a1,d0 -l1: subl a0,d0 | copy - subl d0,sp - movel sp,a1 - movel "A4(_SysBase)",a6 - jsr a6@(-0x270) | CopyMem(src:a0,dst:a1,siz:d0) - movel a2,a0 - moveml a0@+,#0x4603 - movel sp,a0 | Prepare cleanup - addl d1,a0 - movel #___stkrst_f,a0@(8:W) - movel sp@+,a0 - rts +"___stkext_f:;" +" movel a0,sp@-;" +" movel sp,a0 | memorize sp;" +" moveml #0xc062,sp@- | preserves all registers;" +" movel sp,a2 | memorize sp;" +" addl #28:W,d1 | Used by this function itself;" +" movel "A4(___stackborders)",a1| get upper border of stack in a1;" +" movel a1@(4:W),a1;" +" tstl "A4(___used_stack)";" +" bne l0;" +" movel "A4(___SaveSP)",a1;" +"l0: jbsr ___stkext | change to a stackframe with d0 bytes;" +" movel "A4(___used_stack)",a6 | fix stored sp;" +" addl d1,a6@(12:W);" +" movel a2,d0 | calculate number of bytes to copy;" +" addl "A4(___stk_argbytes)",d0| to new stackframe in d0;" +" addl d1,d0;" +" cmpl a1,d0 | never copy over the bottom of the stack;" +" jls l1;" +" movel a1,d0;" +"l1: subl a0,d0 | copy;" +" subl d0,sp;" +" movel sp,a1;" +" movel "A4(_SysBase)",a6;" +" jsr a6@(-0x270) | CopyMem(src:a0,dst:a1,siz:d0);" +" movel a2,a0;" +" moveml a0@+,#0x4603;" +" movel sp,a0 | Prepare cleanup;" +" addl d1,a0;" +" movel #___stkrst_f,a0@(8:W);" +" movel sp@+,a0;" +" rts;" -___stkext: - movel a0,sp@- - moveml #0xf072,sp@- | preserves all registers - movel "A4(___stk_safezone)",d3 - lea "A4(___stk_limit)",a2 - lea "A4(___used_stack)",a3 - addql #4,a3 - movel "A4(_SysBase)",a6 - movel d0,d2 - addl d3,d2 - addl "A4(___stk_argbytes)",d2| required stack - movel a3@,d0 | Look for a spare stackframe - jeq l4 -l3: movel d0,a0 - movel a0@,a3@ | Remove spare stackframe from list - movel a0@(8:W),d0 | Test spare stackframe - subl a0@(4:W),d0 - cmpl d0,d2 - jls l7 - moveq #20,d1 | Not big enough - addl d1,d0 - movel a0,a1 - jsr a6@(-0xd2) | FreeMem(mem:a1,siz:d0) - movel a3@,d0 - jne l3 -l4: moveq #20,d0 - addl d0,d2 | no more stackframes - allocate a new one - movel "A4(___stk_minframe)",d0 - cmpl d0,d2 - jge l5 - movel d0,d2 -l5: movel d2,d0 - moveql #1,d1 | MEMF_PUBLIC - jsr a6@(-0xc6) | AllocMem(siz:d0,typ:d1) - movel d0,a0 - movel a0,d0 - jne l6 - jbsr ___stkovf | allocation failed -l6: moveq #20,d0 - addl a0,d0 - movel d0,a0@(4:W) - addl a0,d2 | prepare new frame for use - movel d2,a0@(8:W) -l7: movel a3@-,a0@ | Add it to the used list - movel a0,a3@ - addql #4,a0 - movel a2@,a0@(12:W) - movel a0@,a2@ | Prepare ___top_of_stackframe variable - addl d3,a2@ - lea a0@(4:W),a2 - movel a2@+,a2@ | Prepare target sp - jsr a6@(-0x2dc) | StackSwap(sss:a0) - moveq #40,d0 - movel a2@,a0 - addl d0,a2@ | Fix stored sp - moveml a0@+,#0x4e0f - movel a0@(4:W),sp@- | prepare returnaddress - movel a0@,a0 - rts +"___stkext:;" +" movel a0,sp@-;" +" moveml #0xf072,sp@- | preserves all registers;" +" movel "A4(___stk_safezone)",d3;" +" lea "A4(___stk_limit)",a2;" +" lea "A4(___used_stack)",a3;" +" addql #4,a3;" +" movel "A4(_SysBase)",a6;" +" movel d0,d2;" +" addl d3,d2;" +" addl "A4(___stk_argbytes)",d2| required stack;" +" movel a3@,d0 | Look for a spare stackframe;" +" jeq l4;" +"l3: movel d0,a0;" +" movel a0@,a3@ | Remove spare stackframe from list;" +" movel a0@(8:W),d0 | Test spare stackframe;" +" subl a0@(4:W),d0;" +" cmpl d0,d2;" +" jls l7;" +" moveq #20,d1 | Not big enough;" +" addl d1,d0;" +" movel a0,a1;" +" jsr a6@(-0xd2) | FreeMem(mem:a1,siz:d0);" +" movel a3@,d0;" +" jne l3;" +"l4: moveq #20,d0;" +" addl d0,d2 | no more stackframes - allocate a new one;" +" movel "A4(___stk_minframe)",d0;" +" cmpl d0,d2;" +" jge l5;" +" movel d0,d2;" +"l5: movel d2,d0;" +" moveql #1,d1 | MEMF_PUBLIC;" +" jsr a6@(-0xc6) | AllocMem(siz:d0,typ:d1);" +" movel d0,a0;" +" movel a0,d0;" +" jne l6;" +" jbsr ___stkovf | allocation failed;" +"l6: moveq #20,d0;" +" addl a0,d0;" +" movel d0,a0@(4:W);" +" addl a0,d2 | prepare new frame for use;" +" movel d2,a0@(8:W);" +"l7: movel a3@-,a0@ | Add it to the used list;" +" movel a0,a3@;" +" addql #4,a0;" +" movel a2@,a0@(12:W);" +" movel a0@,a2@ | Prepare ___top_of_stackframe variable;" +" addl d3,a2@;" +" lea a0@(4:W),a2;" +" movel a2@+,a2@ | Prepare target sp;" +" jsr a6@(-0x2dc) | StackSwap(sss:a0);" +" moveq #40,d0;" +" movel a2@,a0;" +" addl d0,a2@ | Fix stored sp;" +" moveml a0@+,#0x4e0f;" +" movel a0@(4:W),sp@- | prepare returnaddress;" +" movel a0@,a0;" +" rts;" -___exit_stk: - tstl "A4(___used_stack)" - jeq ___stk_free - lea sp@(12:W),a0 - movel "A4(___SaveSP)",d0 | Go back to first stackframe - jbsr ___stkrst - movel a0@,sp@- | restore argument of exit() - movel a0@-,sp@- | returnaddress for exit() - movel a0@-,sp@- | returnaddress for callfuncs() - movel a0@-,sp@- | our returnaddress -| jbsr ___stk_free -| rts +"___exit_stk:;" +" tstl "A4(___used_stack)";" +" jeq ___stk_free;" +" lea sp@(12:W),a0;" +" movel "A4(___SaveSP)",d0 | Go back to first stackframe;" +" jbsr ___stkrst;" +" movel a0@,sp@- | restore argument of exit();" +" movel a0@-,sp@- | returnaddress for exit();" +" movel a0@-,sp@- | returnaddress for callfuncs();" +" movel a0@-,sp@- | our returnaddress;" +"| jbsr ___stk_free;" +"| rts;" -___stk_free: - movel a2,sp@- - movel a6,sp@- | Free all unused stackframes - movel "A4(_SysBase)",a6 - lea "A4(___used_stack)",a2 - addql #4,a2 - movel a2@,d0 | Remove spare stackframe from list - jeq l9 -l8: movel d0,a1 - movel a1@,a2@ - moveq #20,d0 - addl a1@(8:W),d0 | Calculate size - subl a1@(4:W),d0 - jsr a6@(-0xd2) | FreeMem(mem:a1,siz:d0) - movel a2@,d0 - jne l8 -l9: movel sp@+,a6 - movel sp@+,a2 - rts -"); +"___stk_free:;" +" movel a2,sp@-;" +" movel a6,sp@- | Free all unused stackframes;" +" movel "A4(_SysBase)",a6;" +" lea "A4(___used_stack)",a2;" +" addql #4,a2;" +" movel a2@,d0 | Remove spare stackframe from list;" +" jeq l9;" +"l8: movel d0,a1;" +" movel a1@,a2@;" +" moveq #20,d0;" +" addl a1@(8:W),d0 | Calculate size;" +" subl a1@(4:W),d0;" +" jsr a6@(-0xd2) | FreeMem(mem:a1,siz:d0);" +" movel a2@,d0;" +" jne l8;" +"l9: movel sp@+,a6;" +" movel sp@+,a2;" +" rts;" +); ADD2EXIT(__exit_stk,-50); diff --git a/libnix/sources/stack/stkovf.c b/libnix/sources/stack/stkovf.c index 5a8d2cf..82a4d0b 100755 --- a/libnix/sources/stack/stkovf.c +++ b/libnix/sources/stack/stkovf.c @@ -1,11 +1,11 @@ #include "bases.h" -asm(" - .text - .even - .globl ___stkovf +asm( +" .text;" +" .even;" +" .globl ___stkovf;" -___stkovf: - clrl "A4(___stk_limit)" | generate no more stackoverflows - jra __XCOVF -"); +"___stkovf:;" +" clrl "A4(___stk_limit)" | generate no more stackoverflows;" +" jra __XCOVF;" +); diff --git a/libnix/sources/stack/stkrst.c b/libnix/sources/stack/stkrst.c index 469f5ed..4757d5c 100755 --- a/libnix/sources/stack/stkrst.c +++ b/libnix/sources/stack/stkrst.c @@ -1,68 +1,66 @@ -#include "bases.h" + #include "bases.h" -asm(" -| the stack consists of a single linked linear list like this: -| -| struct stack -| { struct stack *next; points to the next underlying structure -| struct StackSwapStruct sss; holds previous stackframe when used, -| itself when unused, the current stackborders -| are in the task structure ;-) -| APTR top_of_stackframe; } previous variable value -| Note: stack->sss.stk_Lower is not reliable -| -| For better performance stackframes are cached in a 'unused' list when -| not in use. (AllocMem() is really a performance killer). -| +asm( + "| the stack consists of a single linked linear list like this:" + "|" + "| struct stack" + "| { struct stack *next; points to the next underlying structure" + "| struct StackSwapStruct sss; holds previous stackframe when used," + "| itself when unused, the current stackborders" + "| are in the task structure ;-)" + "| APTR top_of_stackframe; } previous variable value" + "| Note: stack->sss.stk_Lower is not reliable" + "|" + "| For better performance stackframes are cached in a 'unused' list when" + "| not in use. (AllocMem() is really a performance killer)." + "|" + "|" + "| Caution:" + "| Race condition ahead! exec might preempt our task at any time storing" + "| the current register set on top of the free stack. NEVER set a sp higher" + "| than the location of important data." + "|" + " .comm ___used_stack,8 | pointer to used stackframes," + " | pointer to unused stackframes" + " .text;" + " .even;" + " .globl ___stkrst;" -| -| Caution: -| Race condition ahead! exec might preempt our task at any time storing -| the current register set on top of the free stack. NEVER set a sp higher -| than the location of important data. -| - .comm ___used_stack,8 | pointer to used stackframes, - | pointer to unused stackframes - .text - .even - .globl ___stkrst - -___stkrst: - exg d0,a3 | better use an address register - movel a2,sp@- - moveml d0/d1/a0/a1/a5/a6,sp@- - movel sp,a2 - lea "A4(___used_stack)",a5 - tstl a5@ - jeq l0 | No previous stackframe -l2: movel "A4(___stackborders)",a0 - cmpl a0@,a3 - jcs l1 - cmpl a0@(4:W),a3 - jle l0 | Stackpointer points to current frame -l1: movel "A4(_SysBase)",a6 | Go to previous stack - movel a5,a1 - movel a1@,a0 - movel a0@,a1@+ - movel a1@,a0@ - movel a0,a1@ - addql #4,a0 - movel a0@(12:W),"A4(___stk_limit)" - jsr a6@(-0x2dc) | StackSwap(sss:a0) - tstl a5@ - jne l2 -l0: moveml a2@+,d0/d1/a0/a1/a5/a6 | Restore registers - movel a2@(4:W),sp@- | preserve returnaddress on current stackframe - movel a2@,a2 | be careful to not clobber any registers now - cmpl sp,a3 | Depending on whether sp moves up or down - jls l3 | use one of two possible routines - movel sp@,a3@- | moves up (pop): copy returnaddress first - movel a3,sp | then set sp - jra l4 -l3: exg a3,sp | moves down (push): set sp first - movel a3@,sp@- | then copy returnaddress - movel sp,a3 -l4: exg d0,a3 | move back - addql #4,d0 | compensate for returnaddress - rts -"); + "__stkrst:;" + " exg d0,a3 | better use an address register;" + " movel a2,sp@-;" + " moveml d0/d1/a0/a1/a5/a6,sp@-;" + " movel sp,a2;" + " lea "A4(___used_stack)",a5;" + " tstl a5@;" + " jeq l0 | No previous stackframe;" + "l2: movel "A4(___stackborders)",a0;" + " cmpl a0@,a3;" + " jcs l1;" + " cmpl a0@(4:W),a3;" + " jle l0 | Stackpointer points to current frame;" + "l1: movel "A4(_SysBase)",a6 | Go to previous stack;" + " movel a5,a1;" + " movel a1@,a0;" + " movel a0@,a1@+;" + " movel a1@,a0@;" + " movel a0,a1@;" + " addql #4,a0;" + " movel a0@(12:W),"A4(___stk_limit)";" + " jsr a6@(-0x2dc) | StackSwap(sss:a0);" + " tstl a5@;" + " jne l2;" + "l0: moveml a2@+,d0/d1/a0/a1/a5/a6 | Restore registers;" + " movel a2@(4:W),sp@- | preserve returnaddress on current stackframe;" + " movel a2@,a2 | be careful to not clobber any registers now;" + " cmpl sp,a3 | Depending on whether sp moves up or down;" + " jls l3 | use one of two possible routines;" + " movel sp@,a3@- | moves up (pop): copy returnaddress first;" + " movel a3,sp | then set sp;" + " jra l4;" + "l3: exg a3,sp | moves down (push): set sp first;" + " movel a3@,sp@- | then copy returnaddress;" + " movel sp,a3;" "l4: exg d0,a3 | move back;" + " addql #4,d0 | compensate for returnaddress;" + " rts;" +); diff --git a/libnix/sources/stack/stkrst_f.c b/libnix/sources/stack/stkrst_f.c index 20271b0..58a2f36 100755 --- a/libnix/sources/stack/stkrst_f.c +++ b/libnix/sources/stack/stkrst_f.c @@ -1,24 +1,24 @@ #include "bases.h" -asm(" - .text - .even - .globl ___stkrst_f +asm( +" .text;" +" .even;" +" .globl ___stkrst_f;" -___stkrst_f: - movel a2,sp@- - moveml #0xc0c2,sp@- | Preserve all registers - movel sp,a2 - lea "A4(___used_stack)",a1 | Move current stackframe to the spares list - movel a1@,a0 - movel a0@,a1@+ - movel a1@,a0@ - movel a0,a1@ - addql #4,a0 | Return to old stackframe - movel a0@(12:W),"A4(___stk_limit)" - movel "A4(_SysBase)",a6 - jsr a6@(-0x2dc) | StackSwap(sss:a0) - moveml a2@+,#0x4303 - movel a2@,a2 - rts -"); +"___stkrst_f:;" +" movel a2,sp@-;" +" moveml #0xc0c2,sp@- | Preserve all registers;" +" movel sp,a2;" +" lea "A4(___used_stack)",a1 | Move current stackframe to the spares list;" +" movel a1@,a0;" +" movel a0@,a1@+;" +" movel a1@,a0@;" +" movel a0,a1@;" +" addql #4,a0 | Return to old stackframe;" +" movel a0@(12:W),"A4(___stk_limit)";" +" movel "A4(_SysBase)",a6;" +" jsr a6@(-0x2dc) | StackSwap(sss:a0);" +" moveml a2@+,#0x4303;" +" movel a2@,a2;" +" rts;" +); diff --git a/libnix/sources/stack/sub_d0_sp.c b/libnix/sources/stack/sub_d0_sp.c index 45576a6..e3ab195 100755 --- a/libnix/sources/stack/sub_d0_sp.c +++ b/libnix/sources/stack/sub_d0_sp.c @@ -1,29 +1,29 @@ #include "bases.h" #include "stabs.h" -asm(" - .text - .even - .globl ___sub_d0_sp - .globl ___unlk_a5_rts +asm( +" .text;" +" .even;" +" .globl ___sub_d0_sp;" +" .globl ___unlk_a5_rts;" -___sub_d0_sp: - movel sp@+,a0 - movel sp,d1 - subl d0,d1 - cmpl "A4(___stk_limit)",d1 - jcc l0 - jbsr ___stkext -l0: subl d0,sp - jmp a0@ +"___sub_d0_sp:;" +" movel sp@+,a0;" +" movel sp,d1;" +" subl d0,d1;" +" cmpl "A4(___stk_limit)",d1;" +" jcc l0;" +" jbsr ___stkext;" +"l0: subl d0,sp;" +" jmp a0@;" -___unlk_a5_rts: - movel d0,a0 - movel a5,d0 - jbsr ___stkrst - movel a0,d0 - movel sp@+,a5 - rts -"); +"___unlk_a5_rts:;" +" movel d0,a0;" +" movel a5,d0;" +" jbsr ___stkrst;" +" movel a0,d0;" +" movel sp@+,a5;" +" rts;" +); ALIAS(__move_d0_sp,__stkrst); diff --git a/libnix/sources/startup/Makefile.in b/libnix/sources/startup/Makefile.in index d5674dd..8d5f07d 100644 --- a/libnix/sources/startup/Makefile.in +++ b/libnix/sources/startup/Makefile.in @@ -9,9 +9,9 @@ VPATH = @srcdir@ CC = @CC@ CPP = @CPP@ -AS = as +AS = @AS@ -AR = ar +AR = @AR@ RANLIB = @RANLIB@ AWK = @AWK@ @@ -26,7 +26,7 @@ OPTIONS=-I$(srcdir)/../headers -O -fomit-frame-pointer .PHONY: all filelist subdirs clean veryclean -all: nrcrt0.o nbcrt0.o ncrt0.o libinit.o libinitr.o devinit.o +all: nrcrt0.o nbcrt0.o nlrcrt0.o nlbcrt0.o ncrt0.o libinit.o libinitr.o devinit.o subdirs: @@ -43,12 +43,24 @@ nrcrt0.o: nrcrt0.S $(CC) -c $^ echo "\$$$(V)" >>$@ +# large baserelative resident startup-code + +nlrcrt0.o: nlrcrt0.S + $(CC) -m68020 -c $^ + echo "\$$$(V)" >>$@ # baserelative startup code nbcrt0.o: nbcrt0.S $(CC) -c $^ echo "\$$$(V)" >>$@ +# large baserelative startup code + +nlbcrt0.o: nlbcrt0.S + $(CC) -m68020 -c $^ + echo "\$$$(V)" >>$@ + + # normal (=large) startup code ncrt0.o: ncrt0.S diff --git a/libnix/sources/startup/nbcrt0.S b/libnix/sources/startup/nbcrt0.S index fc9fd95..4a399aa 100755 --- a/libnix/sources/startup/nbcrt0.S +++ b/libnix/sources/startup/nbcrt0.S @@ -17,7 +17,7 @@ pr_CLI = 172 .globl __exit .globl _geta4 - + .global ___restore_a4 .text | first entry - init some vars, check for cli or wb start @@ -57,7 +57,6 @@ fromCLI: lea a4@(___INIT_LIST__:W),a2 addqw #4,a2 moveql #-1,d2 jbsr callfuncs - movel a4@(___env:W),sp@- movel a4@(___argv:W),sp@- movel a4@(___argc:W),sp@- @@ -115,6 +114,7 @@ oldpri: movel a3@+,d0 | get baseptr +___restore_a4: _geta4: lea ___a4_init,a4 rts diff --git a/libnix/sources/startup/ncrt0.S b/libnix/sources/startup/ncrt0.S index 773c035..f1d9cc1 100755 --- a/libnix/sources/startup/ncrt0.S +++ b/libnix/sources/startup/ncrt0.S @@ -17,7 +17,6 @@ pr_CLI = 172 .globl __exit .globl _geta4 - .text | first entry - init some vars, check for cli or wb start @@ -48,7 +47,6 @@ fromWB: lea a3@(pr_MsgPort:W),a0 fromCLI: lea ___INIT_LIST__+4,a2 moveql #-1,d2 jbsr callfuncs - movel ___env,sp@- movel ___argv,sp@- movel ___argc,sp@- diff --git a/libnix/sources/startup/nlbcrt0.S b/libnix/sources/startup/nlbcrt0.S new file mode 100644 index 0000000..43ef7fa --- /dev/null +++ b/libnix/sources/startup/nlbcrt0.S @@ -0,0 +1,142 @@ +| baserelative startup code for gcc v2.3.3+ +| (c) by M.Fleischer and G.Nikl Wed Apr 13 17:45 1994 +| No bugs known + +| some specific defines + +_LVOForbid = -132 +_LVOFindTask = -294 +_LVOGetMsg = -372 +_LVOReplyMsg = -378 +_LVOWaitPort = -384 + +pr_MsgPort = 92 +pr_CLI = 172 + +| public symbols + + .globl __exit + .globl _geta4 + .global ___restore_a4 + .text + +| first entry - init some vars, check for cli or wb start + +start: movel #___bss_size,d1 + jbsr _geta4 + beqs nobss + lea a4@(__edata:L),a1 +clrbss: clrl a1@+ + subql #4,d1 + bnes clrbss + +nobss: movel a0,a4@(___commandline:L) + movel d0,a4@(___commandlen:L) + + movel sp,a4@(___SaveSP:L) + movel 4:L,a6 + movel a6,a4@(_SysBase:L) + + subal a1,a1 + jsr a6@(_LVOFindTask:L) + movel d0,a3 + tstl a3@(pr_CLI:L) + bne fromCLI + +| wb start - get wbmsg + +fromWB: lea a3@(pr_MsgPort:L),a0 + jsr a6@(_LVOWaitPort:L) + lea a3@(pr_MsgPort:L),a0 + jsr a6@(_LVOGetMsg:L) + movel d0,a4@(__WBenchMsg:L) + +| execute all init functions then call main + +fromCLI: lea a4@(___INIT_LIST__:L),a2 + addqw #4,a2 + moveql #-1,d2 + jbsr callfuncs + movel a4@(___env:L),sp@- + movel a4@(___argv:L),sp@- + movel a4@(___argc:L),sp@- + jbsr _main + movel d0,sp@(4:L) + +| exit() entry - execute all exit functions, reply wbmsg + +__exit: lea a4@(___EXIT_LIST__:L),a2 + addqw #4,a2 + moveql #0,d2 + jbsr callfuncs + + movel a4@(_SysBase:L),a6 + + movel a4@(__WBenchMsg:L),d2 + beq todos + jsr a6@(_LVOForbid:L) + movel d2,a1 + jsr a6@(_LVOReplyMsg:L) + +| leave - get return val, restore stackptr + +todos: movel sp@(4:L),d0 + movel a4@(___SaveSP:L),sp + rts + +| call all functions in the NULL terminated list pointed to by a2 +| d2 ascending or descending priority mode + +callfuncs: lea a4@(cleanupflag:L),a5 + movel a2,a3 + moveql #0,d3 + jra oldpri +stabloop: movel a3@+,d4 + movel a5@,d5 + cmpl d4,d5 + jne notnow + movel d0,a0 + jsr a0@ +notnow: eorl d2,d4 + eorl d2,d5 + cmpl d5,d4 + jcc oldpri + cmpl d3,d4 + jls oldpri + movel d4,d3 +oldpri: movel a3@+,d0 + jne stabloop + eorl d2,d3 + movel d3,a5@ + cmpl d2,d3 + jne callfuncs + rts + +| get baseptr + +___restore_a4: +_geta4: lea ___a4_init,a4 + rts + +| redirection of _exit + + .stabs "_exit",11,0,0,0 + .stabs "__exit",1,0,0,0 + +| data area + + .data + + .long ___nocommandline + .long ___initlibraries + .long ___cpucheck + +.comm _SysBase,4 +.comm ___SaveSP,4 +.comm __WBenchMsg,4 +.comm ___commandline,4 +.comm ___commandlen,4 +.comm ___argc,4 +.comm ___argv,4 +.comm ___env,4 +.lcomm cleanupflag,4 diff --git a/libnix/sources/startup/nlrcrt0.S b/libnix/sources/startup/nlrcrt0.S new file mode 100644 index 0000000..04e62e5 --- /dev/null +++ b/libnix/sources/startup/nlrcrt0.S @@ -0,0 +1,180 @@ +| residentable baserelative startup code for gcc v2.3.3+ +| (c) by M.Fleischer and G.Nikl Wed Apr 13 17:46 1994 +| No bugs known +| +| Problem: geta4() +| I really donīt know how to implement it with multiple starts +| +| You should use the non-resident startup-code if you need it ! + +| some specific defines + +_LVOForbid = -132 +_LVOAllocMem = -198 +_LVOFindTask = -294 +_LVOFreeMem = -210 +_LVOGetMsg = -372 +_LVOReplyMsg = -378 +_LVOWaitPort = -384 +_LVOCopyMemQuick = -630 + +pr_MsgPort = 92 +pr_CLI = 172 + +ERROR_NO_FREE_STORE = 103 + +| public symbols + + .globl __exit + .text + +| first entry - check for cli or wb start + +start: movel a0,d3 + movel d0,d4 + + movel 4:W,a6 + + subal a1,a1 + jsr a6@(_LVOFindTask:L) + movel d0,a3 + tstl a3@(pr_CLI:L) + subal a2,a2 + bne fromCLI + +| wb start - get our message + +fromWB: lea a3@(pr_MsgPort:L),a0 + jsr a6@(_LVOWaitPort:L) + lea a3@(pr_MsgPort:L),a0 + jsr a6@(_LVOGetMsg:L) + movel d0,a2 + +| resident setup - allocate memory and relocate + +fromCLI: movql #ERROR_NO_FREE_STORE,d7 + movel #___data_size,d5 + movel #___bss_size,d2 + addl d5,d2 + movel d2,d0 + movql #1,d1 + swap d1 + jsr a6@(_LVOAllocMem:L) + movel d0,a4 + movel a4,d0 + beq cleanup + lea ___a4_init-0x7ffe,a5 + movel d5,d0 + movel a5,a0 + movel a4,a1 + jsr a6@(_LVOCopyMemQuick:L) + lea ___datadata_relocs,a0 + movel a0@+,d0 + beq no_reloc + movel a5,d1 + subl a4,d1 +do_reloc: movel a0@+,a1 + subl d1,a4@(a1:l) + subql #1,d0 + bne do_reloc +no_reloc: lea a4@(0x7ffe:L),a4 + + movel sp,a4@(___SaveSP:L) + movel a6,a4@(_SysBase:L) + movel a2,a4@(__WBenchMsg:L) + movel d3,a4@(___commandline:L) + movel d4,a4@(___commandlen:L) + movel d2,a4@(___MemLen:L) + +| call main() - push args onto stack + + lea a4@(___INIT_LIST__:L),a2 + addqw #4,a2 + moveql #-1,d2 + jbsr callfuncs + movel a4@(___env:L),sp@- + movel a4@(___argv:L),sp@- + movel a4@(___argc:L),sp@- + jbsr _main + movel d0,sp@(4:L) + +| exit() entry - get return val, restore stackptr + +__exit: lea a4@(___EXIT_LIST__:L),a2 + addqw #4,a2 + moveql #0,d2 + jbsr callfuncs + + movel sp@(4:L),d7 + movel a4@(___SaveSP:L),sp + +| prepare cleanup - setup regs, free resident memory + + movel a4@(_SysBase:L),a6 + + movel a4@(__WBenchMsg:L),a2 + movel a4@(___MemLen:L),d0 + lea a4@(-0x7ffe:L),a1 + jsr a6@(_LVOFreeMem:L) + +| cleanup - reply wbmsg and exit + +cleanup: movel a2,d0 + beqs todos + jsr a6@(_LVOForbid:L) + movel a2,a1 + jsr a6@(_LVOReplyMsg:L) +todos: movel d7,d0 + rts + +| call all functions in the NULL terminated list pointed to by a2 +| d2 ascending or descending priority mode + +callfuncs: lea a4@(cleanupflag:L),a5 + movel a2,a3 + moveql #0,d3 + jra oldpri +stabloop: movel a3@+,d4 + movel a5@,d5 + cmpl d4,d5 + jne notnow + movel d0,a0 + jsr a0@ +notnow: eorl d2,d4 + eorl d2,d5 + cmpl d5,d4 + jcc oldpri + cmpl d3,d4 + jls oldpri + movel d4,d3 +oldpri: movel a3@+,d0 + jne stabloop + eorl d2,d3 + movel d3,a5@ + cmpl d2,d3 + jne callfuncs + rts + +| redirection of _exit + + .stabs "_exit",11,0,0,0 + .stabs "__exit",1,0,0,0 + +| data area + + .data + + .long ___nocommandline + .long ___initlibraries + .long ___cpucheck + +.comm _SysBase,4 +.comm ___SaveSP,4 +.comm __WBenchMsg,4 +.comm ___commandline,4 +.comm ___commandlen,4 +.comm ___MemLen,4 +.comm ___argc,4 +.comm ___argv,4 +.comm ___env,4 +.lcomm cleanupflag,4 diff --git a/libnix/sources/startup/nrcrt0.S b/libnix/sources/startup/nrcrt0.S index 7a95bcb..7da1eaf 100755 --- a/libnix/sources/startup/nrcrt0.S +++ b/libnix/sources/startup/nrcrt0.S @@ -26,7 +26,6 @@ ERROR_NO_FREE_STORE = 103 | public symbols .globl __exit - .text | first entry - check for cli or wb start @@ -93,7 +92,6 @@ no_reloc: lea a4@(0x7ffe:W),a4 addqw #4,a2 moveql #-1,d2 jbsr callfuncs - movel a4@(___env:W),sp@- movel a4@(___argv:W),sp@- movel a4@(___argc:W),sp@- diff --git a/libnix/sources/stubs/Makefile.in b/libnix/sources/stubs/Makefile.in index 99ac82f..223bb41 100644 --- a/libnix/sources/stubs/Makefile.in +++ b/libnix/sources/stubs/Makefile.in @@ -5,9 +5,9 @@ VPATH = @srcdir@ CC = @CC@ CPP = @CPP@ -AS = as +AS = @AS@ -AR = ar +AR = @AR@ RANLIB = @RANLIB@ AWK = @AWK@ diff --git a/libnix/sources/stubs/misc/__cpucheck.c b/libnix/sources/stubs/misc/__cpucheck.c index 348c881..8b39dff 100755 --- a/libnix/sources/stubs/misc/__cpucheck.c +++ b/libnix/sources/stubs/misc/__cpucheck.c @@ -11,37 +11,37 @@ static const char errtext1[]="Need a 68020 or higher CPU"; static const char errtext2[]="Need some FPU to run"; #endif -asm(" - .text - .even +asm( +" .text;" +" .even;" + +" .globl ___cpucheck;" +"___cpucheck:;" +" movel "A4(_SysBase)",a1;" +" movew a1@(0x128:W),d0;" - .globl ___cpucheck -___cpucheck: - movel "A4(_SysBase)",a1 - movew a1@(0x128:W),d0 -" #ifdef mc68020 -" - lea _errtext1,a0 - btst #1,d0 - jeq error -" + +" lea _errtext1,a0;" +" btst #1,d0;" +" jeq error;" + #endif #ifdef __HAVE_68881__ -" - lea _errtext2,a0 - btst #4,d0 - jeq error -" + +" lea _errtext2,a0;" +" btst #4,d0;" +" jeq error;" + #endif -" - rts -error: - movel a0,sp@- - jsr ___request | jbsr translates to jra which doesn't work on 68000 - pea 20:W - jsr _exit | dito -"); + +" rts;" +"error:" +" movel a0,sp@-;" +" jsr ___request; | jbsr translates to jra which doesn't work on 68000;" +" pea 20:W;" +" jsr _exit; | dito" +); ADD2INIT(__cpucheck,-80); /* Highest priority */