From cbd276e4ce11c883d2b257a06888affdb7bb9e8e Mon Sep 17 00:00:00 2001 From: Arun Thomas Date: Wed, 3 Mar 2010 14:27:30 +0000 Subject: [PATCH] Convert library asm files to GAS syntax --- commands/i386/gas2ack/asm86.h | 2 +- commands/i386/gas2ack/asmconv.h | 4 + commands/i386/gas2ack/emit_ack.c | 19 +- commands/i386/gas2ack/gas2ack.c | 47 ++-- commands/i386/gas2ack/parse_gnu.c | 40 +-- docs/UPDATING | 2 + etc/mk/minix.ack.mk | 14 +- etc/mk/minix.gcc.mk | 8 +- kernel/arch/i386/Makefile | 6 +- kernel/arch/i386/apic_asm.S | 1 + kernel/arch/i386/klib386.S | 1 - lib/csu/Makefile | 2 +- lib/csu/i386/crtso.S | 121 ++++++++ lib/csu/i386/crtso.s | 99 ------- lib/libc/arch/i386/int64/Makefile.inc | 24 +- lib/libc/arch/i386/int64/add64.S | 18 ++ lib/libc/arch/i386/int64/add64.s | 17 -- lib/libc/arch/i386/int64/add64u.S | 20 ++ lib/libc/arch/i386/int64/add64u.s | 18 -- lib/libc/arch/i386/int64/cmp64.S | 35 +++ lib/libc/arch/i386/int64/cmp64.s | 31 -- lib/libc/arch/i386/int64/cv64u.S | 18 ++ lib/libc/arch/i386/int64/cv64u.s | 15 - lib/libc/arch/i386/int64/cvu64.S | 17 ++ lib/libc/arch/i386/int64/cvu64.s | 15 - lib/libc/arch/i386/int64/diff64.S | 13 + lib/libc/arch/i386/int64/diff64.s | 12 - lib/libc/arch/i386/int64/div64u.S | 24 ++ lib/libc/arch/i386/int64/div64u.s | 22 -- lib/libc/arch/i386/int64/ex64.S | 18 ++ lib/libc/arch/i386/int64/ex64.s | 16 -- lib/libc/arch/i386/int64/make64.S | 17 ++ lib/libc/arch/i386/int64/make64.s | 16 -- lib/libc/arch/i386/int64/mul64u.S | 18 ++ lib/libc/arch/i386/int64/mul64u.s | 17 -- lib/libc/arch/i386/int64/sub64.S | 18 ++ lib/libc/arch/i386/int64/sub64.s | 17 -- lib/libc/arch/i386/int64/sub64u.S | 20 ++ lib/libc/arch/i386/int64/sub64u.s | 18 -- lib/libc/arch/i386/math/Makefile.inc | 6 +- lib/libc/arch/i386/math/fpu_cw.S | 20 ++ lib/libc/arch/i386/math/fpu_cw.s | 20 -- lib/libc/arch/i386/math/fpu_round.S | 37 +++ lib/libc/arch/i386/math/fpu_round.s | 36 --- lib/libc/arch/i386/math/fpu_sw.S | 37 +++ lib/libc/arch/i386/math/fpu_sw.s | 38 --- lib/libc/arch/i386/misc/Makefile.inc | 36 +-- lib/libc/arch/i386/misc/_cpuid.S | 41 +++ lib/libc/arch/i386/misc/_cpuid.s | 40 --- lib/libc/arch/i386/misc/alloca.S | 32 +++ lib/libc/arch/i386/misc/alloca.s | 33 --- lib/libc/arch/i386/misc/get_bp.S | 14 + lib/libc/arch/i386/misc/get_bp.s | 16 -- lib/libc/arch/i386/misc/getprocessor.S | 55 ++++ lib/libc/arch/i386/misc/getprocessor.s | 56 ---- lib/libc/arch/i386/misc/io_inb.S | 14 + lib/libc/arch/i386/misc/io_inb.s | 14 - lib/libc/arch/i386/misc/io_inl.S | 13 + lib/libc/arch/i386/misc/io_inl.s | 13 - lib/libc/arch/i386/misc/io_insb.S | 18 ++ lib/libc/arch/i386/misc/io_insb.s | 18 -- lib/libc/arch/i386/misc/io_insl.S | 19 ++ lib/libc/arch/i386/misc/io_insl.s | 19 -- lib/libc/arch/i386/misc/io_insw.S | 19 ++ lib/libc/arch/i386/misc/io_insw.s | 19 -- lib/libc/arch/i386/misc/io_intr.S | 16 ++ lib/libc/arch/i386/misc/io_intr.s | 16 -- lib/libc/arch/i386/misc/io_inw.S | 14 + lib/libc/arch/i386/misc/io_inw.s | 14 - lib/libc/arch/i386/misc/io_outb.S | 14 + lib/libc/arch/i386/misc/io_outb.s | 14 - lib/libc/arch/i386/misc/io_outl.S | 14 + lib/libc/arch/i386/misc/io_outl.s | 14 - lib/libc/arch/i386/misc/io_outsb.S | 18 ++ lib/libc/arch/i386/misc/io_outsb.s | 18 -- lib/libc/arch/i386/misc/io_outsl.S | 19 ++ lib/libc/arch/i386/misc/io_outsl.s | 19 -- lib/libc/arch/i386/misc/io_outsw.S | 19 ++ lib/libc/arch/i386/misc/io_outsw.s | 19 -- lib/libc/arch/i386/misc/io_outw.S | 14 + lib/libc/arch/i386/misc/io_outw.s | 14 - lib/libc/arch/i386/misc/oneC_sum.S | 91 ++++++ lib/libc/arch/i386/misc/oneC_sum.s | 80 ------ lib/libc/arch/i386/rts/Makefile.inc | 8 +- lib/libc/arch/i386/rts/__sigreturn.S | 9 + lib/libc/arch/i386/rts/__sigreturn.s | 10 - lib/libc/arch/i386/rts/_ipc.S | 83 ++++++ lib/libc/arch/i386/rts/_ipc.s | 84 ------ lib/libc/arch/i386/rts/_senda.S | 21 ++ lib/libc/arch/i386/rts/_senda.s | 22 -- lib/libc/arch/i386/rts/brksize.S | 5 + lib/libc/arch/i386/rts/brksize.s | 5 - lib/libc/arch/i386/string/Makefile.inc | 50 ++-- lib/libc/arch/i386/string/_memmove.S | 60 ++++ lib/libc/arch/i386/string/_memmove.s | 58 ---- lib/libc/arch/i386/string/_strncat.S | 41 +++ lib/libc/arch/i386/string/_strncat.s | 41 --- lib/libc/arch/i386/string/_strncmp.S | 35 +++ lib/libc/arch/i386/string/_strncmp.s | 35 --- lib/libc/arch/i386/string/_strncpy.S | 23 ++ lib/libc/arch/i386/string/_strncpy.s | 24 -- lib/libc/arch/i386/string/_strnlen.S | 28 ++ lib/libc/arch/i386/string/_strnlen.s | 28 -- lib/libc/arch/i386/string/bcmp.S | 28 ++ lib/libc/arch/i386/string/bcmp.s | 28 -- lib/libc/arch/i386/string/bcopy.S | 15 + lib/libc/arch/i386/string/bcopy.s | 16 -- lib/libc/arch/i386/string/bzero.S | 19 ++ lib/libc/arch/i386/string/bzero.s | 20 -- lib/libc/arch/i386/string/index.S | 12 + lib/libc/arch/i386/string/index.s | 13 - lib/libc/arch/i386/string/memchr.S | 30 ++ lib/libc/arch/i386/string/memchr.s | 30 -- lib/libc/arch/i386/string/memcmp.S | 58 ++++ lib/libc/arch/i386/string/memcmp.s | 56 ---- lib/libc/arch/i386/string/memcpy.S | 23 ++ lib/libc/arch/i386/string/memcpy.s | 24 -- lib/libc/arch/i386/string/memmove.S | 11 + lib/libc/arch/i386/string/memmove.s | 12 - lib/libc/arch/i386/string/memset.S | 46 +++ lib/libc/arch/i386/string/memset.s | 44 --- lib/libc/arch/i386/string/rindex.S | 12 + lib/libc/arch/i386/string/rindex.s | 13 - lib/libc/arch/i386/string/strcat.S | 12 + lib/libc/arch/i386/string/strcat.s | 13 - lib/libc/arch/i386/string/strchr.S | 42 +++ lib/libc/arch/i386/string/strchr.s | 41 --- lib/libc/arch/i386/string/strcmp.S | 12 + lib/libc/arch/i386/string/strcmp.s | 13 - lib/libc/arch/i386/string/strcpy.S | 21 ++ lib/libc/arch/i386/string/strcpy.s | 22 -- lib/libc/arch/i386/string/strlen.S | 12 + lib/libc/arch/i386/string/strlen.s | 13 - lib/libc/arch/i386/string/strncat.S | 12 + lib/libc/arch/i386/string/strncat.s | 13 - lib/libc/arch/i386/string/strncmp.S | 12 + lib/libc/arch/i386/string/strncmp.s | 13 - lib/libc/arch/i386/string/strncpy.S | 24 ++ lib/libc/arch/i386/string/strncpy.s | 25 -- lib/libc/arch/i386/string/strnlen.S | 12 + lib/libc/arch/i386/string/strnlen.s | 13 - lib/libc/arch/i386/string/strrchr.S | 36 +++ lib/libc/arch/i386/string/strrchr.s | 36 --- lib/libc/gnu/arch/i386/rts/Makefile.inc | 4 +- lib/libc/gnu/arch/i386/rts/__setjmp.S | 31 ++ lib/libc/gnu/arch/i386/rts/__setjmp.gs | 31 -- lib/libc/gnu/arch/i386/rts/longjmp.S | 38 +++ lib/libc/gnu/arch/i386/rts/longjmp.gs | 38 --- lib/libc/syscall/Makefile.inc | 264 +++++++++--------- lib/libc/syscall/{_exit.s => _exit.S} | 6 +- .../{_pm_findproc.s => _pm_findproc.S} | 6 +- lib/libc/syscall/{access.s => access.S} | 6 +- lib/libc/syscall/{adddma.s => adddma.S} | 6 +- lib/libc/syscall/{alarm.s => alarm.S} | 6 +- lib/libc/syscall/brk.S | 7 + lib/libc/syscall/brk.s | 7 - .../syscall/{cfgetispeed.s => cfgetispeed.S} | 6 +- .../syscall/{cfgetospeed.s => cfgetospeed.S} | 6 +- .../syscall/{cfsetispeed.s => cfsetispeed.S} | 6 +- .../syscall/{cfsetospeed.s => cfsetospeed.S} | 6 +- lib/libc/syscall/{chdir.s => chdir.S} | 8 +- lib/libc/syscall/{chmod.s => chmod.S} | 6 +- lib/libc/syscall/{chown.s => chown.S} | 6 +- lib/libc/syscall/{chroot.s => chroot.S} | 6 +- lib/libc/syscall/{close.s => close.S} | 6 +- lib/libc/syscall/{closedir.s => closedir.S} | 6 +- lib/libc/syscall/{cprofile.s => cprofile.S} | 6 +- lib/libc/syscall/{creat.s => creat.S} | 6 +- lib/libc/syscall/{deldma.s => deldma.S} | 6 +- lib/libc/syscall/dup.S | 7 + lib/libc/syscall/dup.s | 7 - lib/libc/syscall/{dup2.s => dup2.S} | 6 +- lib/libc/syscall/{execl.s => execl.S} | 6 +- lib/libc/syscall/{execle.s => execle.S} | 6 +- lib/libc/syscall/{execlp.s => execlp.S} | 6 +- lib/libc/syscall/{execv.s => execv.S} | 6 +- lib/libc/syscall/{execve.s => execve.S} | 6 +- lib/libc/syscall/{execvp.s => execvp.S} | 6 +- lib/libc/syscall/{fchmod.s => fchmod.S} | 6 +- lib/libc/syscall/{fchown.s => fchown.S} | 6 +- lib/libc/syscall/{fcntl.s => fcntl.S} | 6 +- lib/libc/syscall/{fork.s => fork.S} | 6 +- lib/libc/syscall/{fpathconf.s => fpathconf.S} | 6 +- lib/libc/syscall/{fstat.s => fstat.S} | 6 +- lib/libc/syscall/{fstatfs.s => fstatfs.S} | 6 +- lib/libc/syscall/{getcwd.s => getcwd.S} | 6 +- lib/libc/syscall/{getdents.s => getdents.S} | 6 +- lib/libc/syscall/{getdma.s => getdma.S} | 6 +- lib/libc/syscall/{getegid.s => getegid.S} | 6 +- lib/libc/syscall/{geteuid.s => geteuid.S} | 6 +- lib/libc/syscall/{getgid.s => getgid.S} | 6 +- lib/libc/syscall/{getgroups.s => getgroups.S} | 6 +- lib/libc/syscall/getitimer.S | 7 + lib/libc/syscall/getitimer.s | 7 - lib/libc/syscall/{getngid.s => getngid.S} | 6 +- lib/libc/syscall/{getnpid.s => getnpid.S} | 6 +- .../syscall/{getnprocnr.s => getnprocnr.S} | 6 +- lib/libc/syscall/{getnuid.s => getnuid.S} | 6 +- lib/libc/syscall/{getpgrp.s => getpgrp.S} | 6 +- lib/libc/syscall/{getpid.s => getpid.S} | 6 +- lib/libc/syscall/{getppid.s => getppid.S} | 6 +- .../syscall/{getpprocnr.s => getpprocnr.S} | 6 +- lib/libc/syscall/{getprocnr.s => getprocnr.S} | 6 +- lib/libc/syscall/{getsigset.s => getsigset.S} | 6 +- .../syscall/{getsysinfo.s => getsysinfo.S} | 8 +- lib/libc/syscall/{getuid.s => getuid.S} | 6 +- lib/libc/syscall/{ioctl.s => ioctl.S} | 6 +- lib/libc/syscall/{isatty.s => isatty.S} | 6 +- lib/libc/syscall/{kill.s => kill.S} | 6 +- lib/libc/syscall/{killpg.s => killpg.S} | 6 +- lib/libc/syscall/{link.s => link.S} | 6 +- lib/libc/syscall/{lseek.s => lseek.S} | 6 +- lib/libc/syscall/{lseek64.s => lseek64.S} | 6 +- lib/libc/syscall/{lstat.s => lstat.S} | 6 +- lib/libc/syscall/{mapdriver.s => mapdriver.S} | 6 +- lib/libc/syscall/{mkdir.s => mkdir.S} | 6 +- lib/libc/syscall/{mkfifo.s => mkfifo.S} | 6 +- lib/libc/syscall/{mknod.s => mknod.S} | 6 +- lib/libc/syscall/{mmap.s => mmap.S} | 10 +- lib/libc/syscall/{mount.s => mount.S} | 6 +- lib/libc/syscall/{nanosleep.s => nanosleep.S} | 4 +- lib/libc/syscall/{open.s => open.S} | 6 +- lib/libc/syscall/{opendir.s => opendir.S} | 6 +- lib/libc/syscall/{pathconf.s => pathconf.S} | 6 +- lib/libc/syscall/{pause.s => pause.S} | 6 +- lib/libc/syscall/{pipe.s => pipe.S} | 6 +- lib/libc/syscall/{ptrace.s => ptrace.S} | 6 +- lib/libc/syscall/{read.s => read.S} | 6 +- lib/libc/syscall/{readdir.s => readdir.S} | 6 +- lib/libc/syscall/{readlink.s => readlink.S} | 6 +- lib/libc/syscall/{reboot.s => reboot.S} | 6 +- lib/libc/syscall/{rename.s => rename.S} | 6 +- lib/libc/syscall/{rewinddir.s => rewinddir.S} | 6 +- lib/libc/syscall/{rmdir.s => rmdir.S} | 6 +- lib/libc/syscall/{sbrk.s => sbrk.S} | 6 +- lib/libc/syscall/{seekdir.s => seekdir.S} | 6 +- lib/libc/syscall/{select.s => select.S} | 6 +- lib/libc/syscall/{setgid.s => setgid.S} | 8 +- lib/libc/syscall/{setgroups.s => setgroups.S} | 6 +- lib/libc/syscall/setitimer.S | 7 + lib/libc/syscall/setitimer.s | 7 - lib/libc/syscall/{setsid.s => setsid.S} | 6 +- lib/libc/syscall/{setuid.s => setuid.S} | 8 +- lib/libc/syscall/{sigaction.s => sigaction.S} | 6 +- lib/libc/syscall/{sigaddset.s => sigaddset.S} | 6 +- lib/libc/syscall/{sigdelset.s => sigdelset.S} | 6 +- .../syscall/{sigemptyset.s => sigemptyset.S} | 6 +- .../syscall/{sigfillset.s => sigfillset.S} | 6 +- .../syscall/{sigismember.s => sigismember.S} | 6 +- .../syscall/{sigpending.s => sigpending.S} | 6 +- .../syscall/{sigprocmask.s => sigprocmask.S} | 6 +- lib/libc/syscall/{sigreturn.s => sigreturn.S} | 6 +- .../syscall/{sigsuspend.s => sigsuspend.S} | 6 +- lib/libc/syscall/{sleep.s => sleep.S} | 7 +- lib/libc/syscall/{sprofile.s => sprofile.S} | 6 +- lib/libc/syscall/{stat.s => stat.S} | 6 +- lib/libc/syscall/{stime.s => stime.S} | 6 +- lib/libc/syscall/{svrctl.s => svrctl.S} | 6 +- lib/libc/syscall/{symlink.s => symlink.S} | 6 +- lib/libc/syscall/{sync.s => sync.S} | 6 +- lib/libc/syscall/{sysuname.s => sysuname.S} | 6 +- lib/libc/syscall/{tcdrain.s => tcdrain.S} | 6 +- lib/libc/syscall/{tcflow.s => tcflow.S} | 6 +- lib/libc/syscall/{tcflush.s => tcflush.S} | 6 +- lib/libc/syscall/{tcgetattr.s => tcgetattr.S} | 6 +- .../syscall/{tcsendbreak.s => tcsendbreak.S} | 6 +- lib/libc/syscall/{tcsetattr.s => tcsetattr.S} | 6 +- lib/libc/syscall/{time.s => time.S} | 6 +- lib/libc/syscall/{times.s => times.S} | 6 +- lib/libc/syscall/{truncate.s => truncate.S} | 10 +- lib/libc/syscall/{umask.s => umask.S} | 6 +- lib/libc/syscall/{umount.s => umount.S} | 6 +- lib/libc/syscall/{uname.s => uname.S} | 6 +- lib/libc/syscall/{unlink.s => unlink.S} | 6 +- lib/libc/syscall/{utime.s => utime.S} | 6 +- .../syscall/{vm_dmacalls.s => vm_dmacalls.S} | 11 +- .../syscall/{vm_getphys.s => vm_getphys.S} | 6 +- .../{vm_getrefcount.s => vm_getrefcount.S} | 6 +- lib/libc/syscall/vm_query_exit.S | 7 + lib/libc/syscall/vm_query_exit.s | 7 - lib/libc/syscall/{vm_remap.s => vm_remap.S} | 6 +- lib/libc/syscall/vm_set_priv.S | 7 + lib/libc/syscall/vm_set_priv.s | 7 - lib/libc/syscall/{vm_unmap.s => vm_unmap.S} | 6 +- lib/libc/syscall/{wait.s => wait.S} | 6 +- lib/libc/syscall/{waitpid.s => waitpid.S} | 6 +- lib/libc/syscall/{write.s => write.S} | 6 +- lib/libend/Makefile | 8 +- lib/libend/edata.S | 10 + lib/libend/edata.s | 7 - lib/libend/em_end.S | 26 ++ lib/libend/em_end.s | 21 -- lib/libend/end.S | 13 + lib/libend/end.s | 7 - lib/libend/etext.S | 4 + lib/libend/etext.s | 5 - lib/libend/gnu/Makefile.inc | 2 +- lib/libend/gnu/{gnu_end.gs => gnu_end.S} | 0 lib/libsys/Makefile | 2 +- lib/libsys/read_tsc.S | 46 +++ lib/libsys/read_tsc.s | 49 ---- servers/hgfs/libhgfs/Makefile | 2 +- 302 files changed, 2544 insertions(+), 2451 deletions(-) create mode 100644 lib/csu/i386/crtso.S delete mode 100644 lib/csu/i386/crtso.s create mode 100644 lib/libc/arch/i386/int64/add64.S delete mode 100644 lib/libc/arch/i386/int64/add64.s create mode 100644 lib/libc/arch/i386/int64/add64u.S delete mode 100644 lib/libc/arch/i386/int64/add64u.s create mode 100644 lib/libc/arch/i386/int64/cmp64.S delete mode 100644 lib/libc/arch/i386/int64/cmp64.s create mode 100644 lib/libc/arch/i386/int64/cv64u.S delete mode 100644 lib/libc/arch/i386/int64/cv64u.s create mode 100644 lib/libc/arch/i386/int64/cvu64.S delete mode 100644 lib/libc/arch/i386/int64/cvu64.s create mode 100644 lib/libc/arch/i386/int64/diff64.S delete mode 100644 lib/libc/arch/i386/int64/diff64.s create mode 100644 lib/libc/arch/i386/int64/div64u.S delete mode 100644 lib/libc/arch/i386/int64/div64u.s create mode 100644 lib/libc/arch/i386/int64/ex64.S delete mode 100644 lib/libc/arch/i386/int64/ex64.s create mode 100644 lib/libc/arch/i386/int64/make64.S delete mode 100644 lib/libc/arch/i386/int64/make64.s create mode 100644 lib/libc/arch/i386/int64/mul64u.S delete mode 100644 lib/libc/arch/i386/int64/mul64u.s create mode 100644 lib/libc/arch/i386/int64/sub64.S delete mode 100644 lib/libc/arch/i386/int64/sub64.s create mode 100644 lib/libc/arch/i386/int64/sub64u.S delete mode 100644 lib/libc/arch/i386/int64/sub64u.s create mode 100644 lib/libc/arch/i386/math/fpu_cw.S delete mode 100644 lib/libc/arch/i386/math/fpu_cw.s create mode 100644 lib/libc/arch/i386/math/fpu_round.S delete mode 100644 lib/libc/arch/i386/math/fpu_round.s create mode 100644 lib/libc/arch/i386/math/fpu_sw.S delete mode 100644 lib/libc/arch/i386/math/fpu_sw.s create mode 100644 lib/libc/arch/i386/misc/_cpuid.S delete mode 100644 lib/libc/arch/i386/misc/_cpuid.s create mode 100644 lib/libc/arch/i386/misc/alloca.S delete mode 100644 lib/libc/arch/i386/misc/alloca.s create mode 100644 lib/libc/arch/i386/misc/get_bp.S delete mode 100644 lib/libc/arch/i386/misc/get_bp.s create mode 100644 lib/libc/arch/i386/misc/getprocessor.S delete mode 100644 lib/libc/arch/i386/misc/getprocessor.s create mode 100644 lib/libc/arch/i386/misc/io_inb.S delete mode 100644 lib/libc/arch/i386/misc/io_inb.s create mode 100644 lib/libc/arch/i386/misc/io_inl.S delete mode 100644 lib/libc/arch/i386/misc/io_inl.s create mode 100644 lib/libc/arch/i386/misc/io_insb.S delete mode 100644 lib/libc/arch/i386/misc/io_insb.s create mode 100644 lib/libc/arch/i386/misc/io_insl.S delete mode 100644 lib/libc/arch/i386/misc/io_insl.s create mode 100644 lib/libc/arch/i386/misc/io_insw.S delete mode 100644 lib/libc/arch/i386/misc/io_insw.s create mode 100644 lib/libc/arch/i386/misc/io_intr.S delete mode 100644 lib/libc/arch/i386/misc/io_intr.s create mode 100644 lib/libc/arch/i386/misc/io_inw.S delete mode 100644 lib/libc/arch/i386/misc/io_inw.s create mode 100644 lib/libc/arch/i386/misc/io_outb.S delete mode 100644 lib/libc/arch/i386/misc/io_outb.s create mode 100644 lib/libc/arch/i386/misc/io_outl.S delete mode 100644 lib/libc/arch/i386/misc/io_outl.s create mode 100644 lib/libc/arch/i386/misc/io_outsb.S delete mode 100644 lib/libc/arch/i386/misc/io_outsb.s create mode 100644 lib/libc/arch/i386/misc/io_outsl.S delete mode 100644 lib/libc/arch/i386/misc/io_outsl.s create mode 100644 lib/libc/arch/i386/misc/io_outsw.S delete mode 100644 lib/libc/arch/i386/misc/io_outsw.s create mode 100644 lib/libc/arch/i386/misc/io_outw.S delete mode 100644 lib/libc/arch/i386/misc/io_outw.s create mode 100644 lib/libc/arch/i386/misc/oneC_sum.S delete mode 100644 lib/libc/arch/i386/misc/oneC_sum.s create mode 100644 lib/libc/arch/i386/rts/__sigreturn.S delete mode 100644 lib/libc/arch/i386/rts/__sigreturn.s create mode 100644 lib/libc/arch/i386/rts/_ipc.S delete mode 100644 lib/libc/arch/i386/rts/_ipc.s create mode 100644 lib/libc/arch/i386/rts/_senda.S delete mode 100644 lib/libc/arch/i386/rts/_senda.s create mode 100644 lib/libc/arch/i386/rts/brksize.S delete mode 100644 lib/libc/arch/i386/rts/brksize.s create mode 100644 lib/libc/arch/i386/string/_memmove.S delete mode 100644 lib/libc/arch/i386/string/_memmove.s create mode 100644 lib/libc/arch/i386/string/_strncat.S delete mode 100644 lib/libc/arch/i386/string/_strncat.s create mode 100644 lib/libc/arch/i386/string/_strncmp.S delete mode 100644 lib/libc/arch/i386/string/_strncmp.s create mode 100644 lib/libc/arch/i386/string/_strncpy.S delete mode 100644 lib/libc/arch/i386/string/_strncpy.s create mode 100644 lib/libc/arch/i386/string/_strnlen.S delete mode 100644 lib/libc/arch/i386/string/_strnlen.s create mode 100644 lib/libc/arch/i386/string/bcmp.S delete mode 100644 lib/libc/arch/i386/string/bcmp.s create mode 100644 lib/libc/arch/i386/string/bcopy.S delete mode 100644 lib/libc/arch/i386/string/bcopy.s create mode 100644 lib/libc/arch/i386/string/bzero.S delete mode 100644 lib/libc/arch/i386/string/bzero.s create mode 100644 lib/libc/arch/i386/string/index.S delete mode 100644 lib/libc/arch/i386/string/index.s create mode 100644 lib/libc/arch/i386/string/memchr.S delete mode 100644 lib/libc/arch/i386/string/memchr.s create mode 100644 lib/libc/arch/i386/string/memcmp.S delete mode 100644 lib/libc/arch/i386/string/memcmp.s create mode 100644 lib/libc/arch/i386/string/memcpy.S delete mode 100644 lib/libc/arch/i386/string/memcpy.s create mode 100644 lib/libc/arch/i386/string/memmove.S delete mode 100644 lib/libc/arch/i386/string/memmove.s create mode 100644 lib/libc/arch/i386/string/memset.S delete mode 100644 lib/libc/arch/i386/string/memset.s create mode 100644 lib/libc/arch/i386/string/rindex.S delete mode 100644 lib/libc/arch/i386/string/rindex.s create mode 100644 lib/libc/arch/i386/string/strcat.S delete mode 100644 lib/libc/arch/i386/string/strcat.s create mode 100644 lib/libc/arch/i386/string/strchr.S delete mode 100644 lib/libc/arch/i386/string/strchr.s create mode 100644 lib/libc/arch/i386/string/strcmp.S delete mode 100644 lib/libc/arch/i386/string/strcmp.s create mode 100644 lib/libc/arch/i386/string/strcpy.S delete mode 100644 lib/libc/arch/i386/string/strcpy.s create mode 100644 lib/libc/arch/i386/string/strlen.S delete mode 100644 lib/libc/arch/i386/string/strlen.s create mode 100644 lib/libc/arch/i386/string/strncat.S delete mode 100644 lib/libc/arch/i386/string/strncat.s create mode 100644 lib/libc/arch/i386/string/strncmp.S delete mode 100644 lib/libc/arch/i386/string/strncmp.s create mode 100644 lib/libc/arch/i386/string/strncpy.S delete mode 100644 lib/libc/arch/i386/string/strncpy.s create mode 100644 lib/libc/arch/i386/string/strnlen.S delete mode 100644 lib/libc/arch/i386/string/strnlen.s create mode 100644 lib/libc/arch/i386/string/strrchr.S delete mode 100644 lib/libc/arch/i386/string/strrchr.s create mode 100644 lib/libc/gnu/arch/i386/rts/__setjmp.S delete mode 100644 lib/libc/gnu/arch/i386/rts/__setjmp.gs create mode 100644 lib/libc/gnu/arch/i386/rts/longjmp.S delete mode 100644 lib/libc/gnu/arch/i386/rts/longjmp.gs rename lib/libc/syscall/{_exit.s => _exit.S} (51%) rename lib/libc/syscall/{_pm_findproc.s => _pm_findproc.S} (57%) rename lib/libc/syscall/{access.s => access.S} (52%) rename lib/libc/syscall/{adddma.s => adddma.S} (52%) rename lib/libc/syscall/{alarm.s => alarm.S} (51%) create mode 100644 lib/libc/syscall/brk.S delete mode 100644 lib/libc/syscall/brk.s rename lib/libc/syscall/{cfgetispeed.s => cfgetispeed.S} (57%) rename lib/libc/syscall/{cfgetospeed.s => cfgetospeed.S} (57%) rename lib/libc/syscall/{cfsetispeed.s => cfsetispeed.S} (57%) rename lib/libc/syscall/{cfsetospeed.s => cfsetospeed.S} (57%) rename lib/libc/syscall/{chdir.s => chdir.S} (60%) rename lib/libc/syscall/{chmod.s => chmod.S} (51%) rename lib/libc/syscall/{chown.s => chown.S} (51%) rename lib/libc/syscall/{chroot.s => chroot.S} (52%) rename lib/libc/syscall/{close.s => close.S} (51%) rename lib/libc/syscall/{closedir.s => closedir.S} (54%) rename lib/libc/syscall/{cprofile.s => cprofile.S} (54%) rename lib/libc/syscall/{creat.s => creat.S} (51%) rename lib/libc/syscall/{deldma.s => deldma.S} (52%) create mode 100644 lib/libc/syscall/dup.S delete mode 100644 lib/libc/syscall/dup.s rename lib/libc/syscall/{dup2.s => dup2.S} (50%) rename lib/libc/syscall/{execl.s => execl.S} (51%) rename lib/libc/syscall/{execle.s => execle.S} (52%) rename lib/libc/syscall/{execlp.s => execlp.S} (52%) rename lib/libc/syscall/{execv.s => execv.S} (51%) rename lib/libc/syscall/{execve.s => execve.S} (52%) rename lib/libc/syscall/{execvp.s => execvp.S} (52%) rename lib/libc/syscall/{fchmod.s => fchmod.S} (52%) rename lib/libc/syscall/{fchown.s => fchown.S} (52%) rename lib/libc/syscall/{fcntl.s => fcntl.S} (51%) rename lib/libc/syscall/{fork.s => fork.S} (50%) rename lib/libc/syscall/{fpathconf.s => fpathconf.S} (55%) rename lib/libc/syscall/{fstat.s => fstat.S} (51%) rename lib/libc/syscall/{fstatfs.s => fstatfs.S} (53%) rename lib/libc/syscall/{getcwd.s => getcwd.S} (52%) rename lib/libc/syscall/{getdents.s => getdents.S} (54%) rename lib/libc/syscall/{getdma.s => getdma.S} (52%) rename lib/libc/syscall/{getegid.s => getegid.S} (53%) rename lib/libc/syscall/{geteuid.s => geteuid.S} (53%) rename lib/libc/syscall/{getgid.s => getgid.S} (52%) rename lib/libc/syscall/{getgroups.s => getgroups.S} (55%) create mode 100644 lib/libc/syscall/getitimer.S delete mode 100644 lib/libc/syscall/getitimer.s rename lib/libc/syscall/{getngid.s => getngid.S} (53%) rename lib/libc/syscall/{getnpid.s => getnpid.S} (53%) rename lib/libc/syscall/{getnprocnr.s => getnprocnr.S} (56%) rename lib/libc/syscall/{getnuid.s => getnuid.S} (53%) rename lib/libc/syscall/{getpgrp.s => getpgrp.S} (53%) rename lib/libc/syscall/{getpid.s => getpid.S} (52%) rename lib/libc/syscall/{getppid.s => getppid.S} (53%) rename lib/libc/syscall/{getpprocnr.s => getpprocnr.S} (56%) rename lib/libc/syscall/{getprocnr.s => getprocnr.S} (55%) rename lib/libc/syscall/{getsigset.s => getsigset.S} (55%) rename lib/libc/syscall/{getsysinfo.s => getsysinfo.S} (64%) rename lib/libc/syscall/{getuid.s => getuid.S} (52%) rename lib/libc/syscall/{ioctl.s => ioctl.S} (51%) rename lib/libc/syscall/{isatty.s => isatty.S} (52%) rename lib/libc/syscall/{kill.s => kill.S} (50%) rename lib/libc/syscall/{killpg.s => killpg.S} (52%) rename lib/libc/syscall/{link.s => link.S} (50%) rename lib/libc/syscall/{lseek.s => lseek.S} (51%) rename lib/libc/syscall/{lseek64.s => lseek64.S} (53%) rename lib/libc/syscall/{lstat.s => lstat.S} (51%) rename lib/libc/syscall/{mapdriver.s => mapdriver.S} (55%) rename lib/libc/syscall/{mkdir.s => mkdir.S} (51%) rename lib/libc/syscall/{mkfifo.s => mkfifo.S} (52%) rename lib/libc/syscall/{mknod.s => mknod.S} (51%) rename lib/libc/syscall/{mmap.s => mmap.S} (64%) rename lib/libc/syscall/{mount.s => mount.S} (51%) rename lib/libc/syscall/{nanosleep.s => nanosleep.S} (61%) rename lib/libc/syscall/{open.s => open.S} (50%) rename lib/libc/syscall/{opendir.s => opendir.S} (53%) rename lib/libc/syscall/{pathconf.s => pathconf.S} (54%) rename lib/libc/syscall/{pause.s => pause.S} (51%) rename lib/libc/syscall/{pipe.s => pipe.S} (50%) rename lib/libc/syscall/{ptrace.s => ptrace.S} (52%) rename lib/libc/syscall/{read.s => read.S} (50%) rename lib/libc/syscall/{readdir.s => readdir.S} (53%) rename lib/libc/syscall/{readlink.s => readlink.S} (54%) rename lib/libc/syscall/{reboot.s => reboot.S} (52%) rename lib/libc/syscall/{rename.s => rename.S} (52%) rename lib/libc/syscall/{rewinddir.s => rewinddir.S} (55%) rename lib/libc/syscall/{rmdir.s => rmdir.S} (51%) rename lib/libc/syscall/{sbrk.s => sbrk.S} (50%) rename lib/libc/syscall/{seekdir.s => seekdir.S} (53%) rename lib/libc/syscall/{select.s => select.S} (52%) rename lib/libc/syscall/{setgid.s => setgid.S} (55%) rename lib/libc/syscall/{setgroups.s => setgroups.S} (55%) create mode 100644 lib/libc/syscall/setitimer.S delete mode 100644 lib/libc/syscall/setitimer.s rename lib/libc/syscall/{setsid.s => setsid.S} (52%) rename lib/libc/syscall/{setuid.s => setuid.S} (55%) rename lib/libc/syscall/{sigaction.s => sigaction.S} (55%) rename lib/libc/syscall/{sigaddset.s => sigaddset.S} (55%) rename lib/libc/syscall/{sigdelset.s => sigdelset.S} (55%) rename lib/libc/syscall/{sigemptyset.s => sigemptyset.S} (57%) rename lib/libc/syscall/{sigfillset.s => sigfillset.S} (56%) rename lib/libc/syscall/{sigismember.s => sigismember.S} (57%) rename lib/libc/syscall/{sigpending.s => sigpending.S} (56%) rename lib/libc/syscall/{sigprocmask.s => sigprocmask.S} (57%) rename lib/libc/syscall/{sigreturn.s => sigreturn.S} (55%) rename lib/libc/syscall/{sigsuspend.s => sigsuspend.S} (56%) rename lib/libc/syscall/{sleep.s => sleep.S} (50%) rename lib/libc/syscall/{sprofile.s => sprofile.S} (54%) rename lib/libc/syscall/{stat.s => stat.S} (50%) rename lib/libc/syscall/{stime.s => stime.S} (51%) rename lib/libc/syscall/{svrctl.s => svrctl.S} (52%) rename lib/libc/syscall/{symlink.s => symlink.S} (53%) rename lib/libc/syscall/{sync.s => sync.S} (50%) rename lib/libc/syscall/{sysuname.s => sysuname.S} (54%) rename lib/libc/syscall/{tcdrain.s => tcdrain.S} (53%) rename lib/libc/syscall/{tcflow.s => tcflow.S} (52%) rename lib/libc/syscall/{tcflush.s => tcflush.S} (53%) rename lib/libc/syscall/{tcgetattr.s => tcgetattr.S} (55%) rename lib/libc/syscall/{tcsendbreak.s => tcsendbreak.S} (57%) rename lib/libc/syscall/{tcsetattr.s => tcsetattr.S} (55%) rename lib/libc/syscall/{time.s => time.S} (50%) rename lib/libc/syscall/{times.s => times.S} (51%) rename lib/libc/syscall/{truncate.s => truncate.S} (59%) rename lib/libc/syscall/{umask.s => umask.S} (51%) rename lib/libc/syscall/{umount.s => umount.S} (52%) rename lib/libc/syscall/{uname.s => uname.S} (51%) rename lib/libc/syscall/{unlink.s => unlink.S} (52%) rename lib/libc/syscall/{utime.s => utime.S} (51%) rename lib/libc/syscall/{vm_dmacalls.s => vm_dmacalls.S} (65%) rename lib/libc/syscall/{vm_getphys.s => vm_getphys.S} (56%) rename lib/libc/syscall/{vm_getrefcount.s => vm_getrefcount.S} (59%) create mode 100644 lib/libc/syscall/vm_query_exit.S delete mode 100644 lib/libc/syscall/vm_query_exit.s rename lib/libc/syscall/{vm_remap.s => vm_remap.S} (54%) create mode 100644 lib/libc/syscall/vm_set_priv.S delete mode 100644 lib/libc/syscall/vm_set_priv.s rename lib/libc/syscall/{vm_unmap.s => vm_unmap.S} (54%) rename lib/libc/syscall/{wait.s => wait.S} (50%) rename lib/libc/syscall/{waitpid.s => waitpid.S} (53%) rename lib/libc/syscall/{write.s => write.S} (51%) create mode 100644 lib/libend/edata.S delete mode 100644 lib/libend/edata.s create mode 100644 lib/libend/em_end.S delete mode 100644 lib/libend/em_end.s create mode 100644 lib/libend/end.S delete mode 100644 lib/libend/end.s create mode 100644 lib/libend/etext.S delete mode 100644 lib/libend/etext.s rename lib/libend/gnu/{gnu_end.gs => gnu_end.S} (100%) create mode 100644 lib/libsys/read_tsc.S delete mode 100644 lib/libsys/read_tsc.s diff --git a/commands/i386/gas2ack/asm86.h b/commands/i386/gas2ack/asm86.h index a71bc811b..80a1b2857 100644 --- a/commands/i386/gas2ack/asm86.h +++ b/commands/i386/gas2ack/asm86.h @@ -97,7 +97,7 @@ typedef enum opcode { /* 80486 opcodes, from the i486 reference manual. FSIN, FSINCOS, FSQRT, - FSTD, FSTS, FSTPX, FSTPD, FSTPS, + FSTD, FSTS, FSTP, FSTPX, FSTPD, FSTPS, FSTCW, FSTENV, FSTSW, diff --git a/commands/i386/gas2ack/asmconv.h b/commands/i386/gas2ack/asmconv.h index 4ef2eaae2..061551e5a 100644 --- a/commands/i386/gas2ack/asmconv.h +++ b/commands/i386/gas2ack/asmconv.h @@ -14,11 +14,15 @@ char *copystr(const char *s); int isanumber(const char *s); extern int asm_mode32; /* In 32 bit mode if true. */ +extern int prepend_underscores; /* Prepend underscores to symbols */ #define use16() (!asm_mode32) #define use32() ((int) asm_mode32) #define set_use16() ((void) (asm_mode32= 0)) #define set_use32() ((void) (asm_mode32= 1)) +#define underscore_mode() (prepend_underscores) +#define enable_underscore_mode() ((void)(prepend_underscores= 1)) + extern int err_code; /* Exit code. */ #define set_error() ((void) (err_code= EXIT_FAILURE)) diff --git a/commands/i386/gas2ack/emit_ack.c b/commands/i386/gas2ack/emit_ack.c index 0dd878904..dac676da3 100644 --- a/commands/i386/gas2ack/emit_ack.c +++ b/commands/i386/gas2ack/emit_ack.c @@ -160,6 +160,7 @@ static mnemonic_t mnemtab[] = { { FSTCW, "fstcw" }, { FSTD, "fstd" }, { FSTENV, "fstenv" }, + { FSTP, "fstp" }, { FSTPD, "fstpd" }, { FSTPS, "fstps" }, { FSTPX, "fstpx" }, @@ -311,6 +312,8 @@ static mnemonic_t mnemtab[] = { }; #define farjmp(o) ((o) == JMPF || (o) == CALLF) +#define data_op(o) ((o) == DOT_DATA1 || (o) == DOT_DATA2 || (o) == DOT_DATA4) +#define define_op(o) ((o) == DOT_DEFINE) static FILE *ef; static long eline= 1; @@ -393,11 +396,15 @@ static void ack_put_expression(asm86_t *a, expression_t *e, int deref) assert(e != nil); - isglob = syms_is_global(e->name); + if (underscore_mode()) + isglob = syms_is_global(e->name); + else + isglob = 0; switch (e->operator) { case ',': - if (dialect == NCC && farjmp(a->opcode)) { + if (data_op(a->opcode) || define_op(a->opcode) + || (dialect == NCC && farjmp(a->opcode))) { /* ACK jmpf seg:off -> NCC jmpf off,seg */ ack_put_expression(a, e->right, deref); ack_printf(", "); @@ -546,7 +553,7 @@ void ack_emit_instruction(asm86_t *a) } else if (a->opcode == DOT_LABEL) { assert(a->args->operator == ':'); - if (syms_is_global(a->args->name)) + if (underscore_mode() && syms_is_global(a->args->name)) ack_printf("_%s:", a->args->name); else ack_printf("%s:", a->args->name); @@ -599,7 +606,7 @@ void ack_emit_instruction(asm86_t *a) && a->args->operator == ',' && a->args->left->operator == 'W' ) { - if (syms_is_global(a->args->left->name)) + if (underscore_mode() && syms_is_global(a->args->left->name)) ack_printf(".define\t_%s; ", a->args->left->name); else ack_printf(".define\t%s; ", a->args->left->name); @@ -668,7 +675,9 @@ void ack_emit_instruction(asm86_t *a) /* we are translating from GNU */ if (a->args && a->args->operator == ',' /* don't swap ljmp prefixed with segment */ - && a->opcode != JMPF) { + && a->opcode != JMPF + && !data_op(a->opcode) + && !define_op(a->opcode)) { expression_t * tmp; tmp = a->args->right; diff --git a/commands/i386/gas2ack/gas2ack.c b/commands/i386/gas2ack/gas2ack.c index 422e50a66..2b6088d16 100644 --- a/commands/i386/gas2ack/gas2ack.c +++ b/commands/i386/gas2ack/gas2ack.c @@ -10,6 +10,7 @@ static char version[] = "1.11"; #include #include #include +#include #include "asmconv.h" #include "asm86.h" #include "languages.h" @@ -55,6 +56,8 @@ int isanumber(const char *s) /* "Invisible" globals. */ int asm_mode32= (sizeof(int) == 4); int err_code= EXIT_SUCCESS; +/* Prepend underscores to symbols */ +int prepend_underscores = 0; int main(int argc, char **argv) { @@ -65,28 +68,40 @@ int main(int argc, char **argv) char *lang_parse, *lang_emit, *input_file, *output_file; asm86_t *instr; char banner[80]; + char c; + opterr = 0; - if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'm') { - if (strcmp(argv[1], "-mi86") == 0) { - set_use16(); - } else - if (strcmp(argv[1], "-mi386") == 0) { - set_use32(); - } else { - fprintf(stderr, "asmconv: '%s': unknown machine\n", - argv[1]+2); - } - argc--; - argv++; - } + while ((c = getopt (argc, argv, "m:u")) != -1) + switch (c) + { + case 'm': + if (strcmp(optarg, "i86") == 0) { + set_use16(); + } else + if (strcmp(optarg, "i386") == 0) { + set_use32(); + } + else { + fprintf(stderr, "asmconv: '%s': unknown machine\n", + optarg); + exit(EXIT_FAILURE); + } + break; + case 'u': + enable_underscore_mode(); + break; + default: + fprintf(stderr, "Usage: gas2ack [input-file [output-file]]\n"); + exit(EXIT_FAILURE); + } - if (argc > 3) { + if ((argc - optind < 1) || (argc - optind > 2)) { fprintf(stderr, "Usage: gas2ack [input-file [output-file]]\n"); exit(EXIT_FAILURE); } - input_file= argc < 1 ? nil : argv[1]; - output_file= argc < 2 ? nil : argv[2]; + input_file= (argc - optind) < 1 ? nil : argv[optind]; + output_file= (argc - optind) < 2 ? nil : argv[optind+1]; parse_init= gnu_parse_init; get_instruction= gnu_get_instruction; diff --git a/commands/i386/gas2ack/parse_gnu.c b/commands/i386/gas2ack/parse_gnu.c index 07a165632..4d7f5c4f5 100644 --- a/commands/i386/gas2ack/parse_gnu.c +++ b/commands/i386/gas2ack/parse_gnu.c @@ -20,7 +20,12 @@ typedef struct mnemonic { /* GNU as86 mnemonics translation table. */ optype_t optype; } mnemonic_t; -static mnemonic_t mnemtab[] = { /* This array is sorted. */ +/*************************************************************** + * * + * NOTE: You MUST keep this array sorted by the first column. * + * * + **************************************************************/ +static mnemonic_t mnemtab[] = { { ".ascii", DOT_ASCII, PSEUDO }, { ".asciz", DOT_ASCIZ, PSEUDO }, { ".assert", DOT_ASSERT, PSEUDO }, @@ -30,9 +35,6 @@ static mnemonic_t mnemtab[] = { /* This array is sorted. */ { ".byte", DOT_DATA1, PSEUDO }, { ".comm", DOT_COMM, PSEUDO }, { ".data", DOT_DATA, PSEUDO }, - { ".data1", DOT_DATA1, PSEUDO }, - { ".data2", DOT_DATA2, PSEUDO }, - { ".data4", DOT_DATA4, PSEUDO }, { ".end", DOT_END, PSEUDO }, { ".extern", DOT_EXTERN, PSEUDO }, { ".file", DOT_FILE, PSEUDO }, @@ -85,10 +87,9 @@ static mnemonic_t mnemtab[] = { /* This array is sorted. */ { "cmc", CMC, WORD }, { "cmpb", CMP, BYTE }, { "cmpl", CMP, WORD }, - { "cmps", CMPS, WORD }, { "cmpsb", CMPS, BYTE }, - { "cmpsl", CMPS, OWORD }, - { "cmpsw", CMPS, WORD }, + { "cmpsl", CMPS, WORD }, + { "cmpsw", CMPS, OWORD }, { "cmpw", CMP, OWORD }, { "cmpxchg", CMPXCHG, WORD }, { "cpuid", CPUID, WORD }, @@ -152,8 +153,8 @@ static mnemonic_t mnemtab[] = { /* This array is sorted. */ { "fisubs", FISUBS, WORD }, { "fld1", FLD1, WORD }, { "fldcw", FLDCW, WORD }, - { "fldd", FLDD, WORD }, { "fldenv", FLDENV, WORD }, + { "fldl", FLDD, WORD }, { "fldl2e", FLDL2E, WORD }, { "fldl2t", FLDL2T, WORD }, { "fldlg2", FLDLG2, WORD }, @@ -170,8 +171,8 @@ static mnemonic_t mnemtab[] = { /* This array is sorted. */ { "fnop", FNOP, WORD }, { "fnsave", FNSAVE, WORD }, { "fnstcw", FNSTCW, WORD }, - { "fnstsw", FNSTSW, WORD }, { "fnstenv", FSTENV, WORD }, + { "fnstsw", FNSTSW, WORD }, { "fpatan", FPATAN, WORD }, { "fprem", FPREM, WORD }, { "fprem1", FPREM1, WORD }, @@ -183,12 +184,13 @@ static mnemonic_t mnemtab[] = { /* This array is sorted. */ { "fsin", FSIN, WORD }, { "fsincos", FSINCOS, WORD }, { "fsqrt", FSQRT, WORD }, + { "fstcw", FSTCW, WORD }, { "fstd", FSTD, WORD }, - { "fstpd", FSTPD, WORD }, + { "fstp", FSTP, WORD }, + { "fstpl", FSTPD, WORD }, { "fstps", FSTPS, WORD }, { "fstpx", FSTPX, WORD }, { "fsts", FSTS, WORD }, - { "fstcw", FSTCW, WORD }, { "fstsw", FSTSW, WORD }, { "fsubd", FSUBD, WORD }, { "fsubp", FSUBP, WORD }, @@ -697,6 +699,7 @@ static expression_t *gnu_get_oplist(asm86_t * a, int *pn, int deref) token_t *t; int sreg; + if ((e= gnu_get_operand(a, pn, deref)) == nil) return nil; t = get_token(*pn); @@ -862,13 +865,16 @@ static asm86_t *gnu_get_statement(void) break; case DOT_DEFINE: case DOT_EXTERN: - syms_add_global_csl(a->args); + if (underscore_mode()) + syms_add_global_csl(a->args); break; case DOT_COMM: - syms_add_global(a->args->left->name); + if (underscore_mode()) + syms_add_global(a->args->left->name); break; case DOT_LCOMM: - syms_add(a->args->left->name); + if(underscore_mode()) + syms_add(a->args->left->name); break; case JMPF: case CALLF: @@ -940,7 +946,8 @@ asm86_t *gnu_get_instruction(void) a->args= e= new_expr(); e->operator= ':'; e->name= copystr(t->name); - syms_add(t->name); + if (underscore_mode()) + syms_add(t->name); skip_token(2); } else if (t->type == T_WORD && get_token(1)->symbol == '=') { @@ -971,7 +978,8 @@ asm86_t *gnu_get_instruction(void) a->args= new_expr(); a->args->operator= '='; a->args->name= copystr(t->name); - syms_add(t->name); + if (underscore_mode()) + syms_add(t->name); a->args->middle= e; skip_token(n+1); } diff --git a/docs/UPDATING b/docs/UPDATING index a5e84ed31..40dbef8d4 100644 --- a/docs/UPDATING +++ b/docs/UPDATING @@ -1,3 +1,5 @@ +20100303: + Gas2ack updates: Run 'make install' in commands/i386/gas2ack 20100215: Make(1) has been replaced: Run 'make install' in commands/make Mkdep updates: Copy commands/scripts/mkdep.sh to /usr/bin/mkdep diff --git a/etc/mk/minix.ack.mk b/etc/mk/minix.ack.mk index d2fef931f..1e5f310a1 100644 --- a/etc/mk/minix.ack.mk +++ b/etc/mk/minix.ack.mk @@ -1,4 +1,4 @@ -.SUFFIXES: .o .e +.SUFFIXES: .o .e .S # Treated like a C file .e.o: @@ -8,3 +8,15 @@ # ${OBJCOPY} -x ${.TARGET} # .endif +ASMCONV=gas2ack +AFLAGS+=-D__ASSEMBLY__ -D_EM_WSIZE=4 -D__minix -I/usr/src/include -w -wo +CPP.s=${CC} -E ${AFLAGS} +ASMCONVFLAGS+=-mi386 + +# Need to convert ACK assembly files to GNU assembly before building +.S.o: + ${_MKTARGET_COMPILE} + ${CPP.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.PREFIX}.gnu.s + ${ASMCONV} ${ASMCONVFLAGS} ${.PREFIX}.gnu.s ${.PREFIX}.ack.s + ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.PREFIX}.ack.s -o ${.TARGET} + rm -rf ${.PREFIX}.ack.s ${.PREFIX}.gnu.s diff --git a/etc/mk/minix.gcc.mk b/etc/mk/minix.gcc.mk index 02ce960c4..e08d92fd8 100644 --- a/etc/mk/minix.gcc.mk +++ b/etc/mk/minix.gcc.mk @@ -1,9 +1,8 @@ -.SUFFIXES: .o .s .gs +.SUFFIXES: .o .s ASMCONV=asmconv CPP.s=${CC} ${AFLAGS} -E -x assembler-with-cpp ASMCONVFLAGS+=-mi386 ack gnu -ASSEMBLE=gas ${AFLAGS} # Need to convert ACK assembly files to GNU assembly before building .s.o: @@ -12,8 +11,3 @@ ASSEMBLE=gas ${AFLAGS} ${ASMCONV} ${ASMCONVFLAGS} ${.PREFIX}.ack.s ${.PREFIX}.gnu.s ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.PREFIX}.gnu.s -o ${.TARGET} rm -rf ${.PREFIX}.ack.s ${.PREFIX}.gnu.s - -# GNU Assembly file -.gs.o: - ${_MKTARGET_COMPILE} - ${ASSEMBLE} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET} diff --git a/kernel/arch/i386/Makefile b/kernel/arch/i386/Makefile index 770fe661f..69eb76017 100644 --- a/kernel/arch/i386/Makefile +++ b/kernel/arch/i386/Makefile @@ -43,17 +43,17 @@ clean: # How to build it klib386.o: klib386.S $(CC) $(CFLAGS) -E -D__ASSEMBLY__ -o $@.tmp $< - gas2ack $@.tmp $@.s + gas2ack -u $@.tmp $@.s $(CC) $(CFLAGS) -c -o $@ $@.s mpx386.o: mpx386.S $(CC) $(CFLAGS) -E -D__ASSEMBLY__ -o $@.tmp $< - gas2ack $@.tmp $@.s + gas2ack -u $@.tmp $@.s $(CC) $(CFLAGS) -c -o $@ $@.s apic_asm.o: apic_asm.S $(CC) $(CFLAGS) -E -D__ASSEMBLY__ -o $@.tmp $< - gas2ack $@.tmp $@.s + gas2ack -u $@.tmp $@.s $(CC) $(CFLAGS) -c -o $@ $@.s $(HEAD): mpx386.o diff --git a/kernel/arch/i386/apic_asm.S b/kernel/arch/i386/apic_asm.S index 4025b56db..6c2cef6ac 100644 --- a/kernel/arch/i386/apic_asm.S +++ b/kernel/arch/i386/apic_asm.S @@ -20,6 +20,7 @@ .globl apic_hwint14 .globl apic_hwint15 +.text #define APIC_IRQ_HANDLER(irq) \ push $irq ;\ call irq_handle /* intr_handle(irq_handlers[irq]) */ ;\ diff --git a/kernel/arch/i386/klib386.S b/kernel/arch/i386/klib386.S index 065c62de2..93b8a8f57 100644 --- a/kernel/arch/i386/klib386.S +++ b/kernel/arch/i386/klib386.S @@ -1,6 +1,5 @@ /* sections */ -.text; .data; .data; .bss #include #include diff --git a/lib/csu/Makefile b/lib/csu/Makefile index ee4a75b38..038865eda 100644 --- a/lib/csu/Makefile +++ b/lib/csu/Makefile @@ -4,7 +4,7 @@ AFLAGS+= -O -D_MINIX -D_POSIX_SOURCE -SRCS= crtso.s +SRCS= crtso.S OBJS= crtso.o realall: ${OBJS} diff --git a/lib/csu/i386/crtso.S b/lib/csu/i386/crtso.S new file mode 100644 index 000000000..193853294 --- /dev/null +++ b/lib/csu/i386/crtso.S @@ -0,0 +1,121 @@ +/* This is the C run-time start-off routine. It's job is to take the */ +/* arguments as put on the stack by EXEC, and to parse them and set them up the */ +/* way _main expects them. */ +/* It also initializes environ when this variable isn't defined by the */ +/* programmer. The detection of whether environ belong to us is rather */ +/* simplistic. We simply check for some magic value, but there is no other */ +/* way. */ + +#include + + +.globl begtext, begdata, begbss +.text +begtext: +#ifdef __ACK__ +.rom +#else +.data +#endif +begrom: +.data +begdata: +.bss +begbss: + +.globl crtso, __penviron, __penvp, __fpu_present +.globl __minix_datastart, __minix_mainjump, __minix_unmapzero +.extern _main, _exit + +#if defined(__ELF__) +.section .init +#else +.text +#endif + +#if defined(__ELF__) +.globl __start +__start: +#endif +crtso: + xorl %ebp, %ebp /* clear for backtrace of core files */ + movl (%esp), %eax /* argc */ + leal 4(%esp), %edx /* argv */ + leal 8(%esp,%eax,4), %ecx /* envp */ + +/* Test if environ is in the initialized data area and is set to our */ +/* magic number. If so then it is not redefined by the user. */ + movl $_environ, %ebx + cmpl $__edata, %ebx /* within initialized data? */ + jae 0f + testb $3, %bl /* aligned? */ + jne 0f + cmpl $0x53535353, (%ebx) /* is it our environ? */ + jne 0f + movl %ebx, __penviron /* _penviron = &environ; */ +0: + movl __penviron, %ebx + movl %ecx, (%ebx) /* *_penviron = envp; */ + + push %ecx /* push envp */ + push %edx /* push argv */ + push %eax /* push argc */ + +/* Test the EM bit of the MSW to determine if an FPU is present and */ +/* set __fpu_present if one is found. */ + smsw %ax + testb $0x4, %al /* EM bit in MSW */ + sete __fpu_present /* True if not set */ + jmp __minix_mainjump + +.balign I386_PAGE_SIZE +__minix_mainjump: + /* unmap zero pages */ + call __minix_unmapzero + + call _main /* main(argc, argv, envp) */ + + push %eax /* push exit status */ + call _exit + + hlt /* force a trap if exit fails */ + +__minix_unmapzero: + + /* unmap 0-page code */ + push $I386_PAGE_SIZE + push $crtso + call _munmap_text /* unmap_text(crtso, I386_PAGE_SIZE) */ + add $8, %esp + +#ifdef __ACK__ + /* + * ack uses separate segments for text and data by default. We have a + * common segment when compiling using any other compiler + */ + + /* unmap 0-page data */ + push $I386_PAGE_SIZE + push $romstart + call _munmap /* munmap(romstart, I386_PAGE_SIZE) */ + add $8, %esp +#endif + + ret + +#ifdef __ACK__ +.rom +romstart: +.space I386_PAGE_SIZE +__minix_datastart: +.space 4 +#endif +.data +__penviron: +.long __penvp /* Pointer to environ, or hidden pointer */ + +.bss +.lcomm __penvp, 4 /* Hidden environment vector */ +.lcomm __fpu_present, 4 /* FPU present flag */ + +.extern endtext /* Force loading of end labels. */ diff --git a/lib/csu/i386/crtso.s b/lib/csu/i386/crtso.s deleted file mode 100644 index c78cab14a..000000000 --- a/lib/csu/i386/crtso.s +++ /dev/null @@ -1,99 +0,0 @@ -# -! This is the C run-time start-off routine. It's job is to take the -! arguments as put on the stack by EXEC, and to parse them and set them up the -! way _main expects them. -! It also initializes _environ when this variable isn't defined by the -! programmer. The detection of whether _environ belong to us is rather -! simplistic. We simply check for some magic value, but there is no other -! way. - -#include - -.sect .text; .sect .rom; .sect .data; .sect .bss - -.define begtext, begdata, begbss -.sect .text -begtext: -.sect .rom -begrom: -.sect .data -begdata: -.sect .bss -begbss: - -.define crtso, __penviron, __penvp, __fpu_present -.define __minix_datastart, __minix_mainjump, __minix_unmapzero -.extern _main, _exit -.sect .text -crtso: - xor ebp, ebp ! clear for backtrace of core files - mov eax, (esp) ! argc - lea edx, 4(esp) ! argv - lea ecx, 8(esp)(eax*4) ! envp - - ! Test if environ is in the initialized data area and is set to our - ! magic number. If so then it is not redefined by the user. - mov ebx, _environ - cmp ebx, __edata ! within initialized data? - jae 0f - testb bl, 3 ! aligned? - jnz 0f - cmp (ebx), 0x53535353 ! is it our _environ? - jne 0f - mov (__penviron), ebx ! _penviron = &environ; -0: mov ebx, (__penviron) - mov (ebx), ecx ! *_penviron = envp; - - push ecx ! push envp - push edx ! push argv - push eax ! push argc - - ! Test the EM bit of the MSW to determine if an FPU is present and - ! set __fpu_present if one is found. - smsw ax - testb al, 0x4 ! EM bit in MSW - setz (__fpu_present) ! True if not set - jmp __minix_mainjump - -.align I386_PAGE_SIZE -__minix_mainjump: - ! unmap zero pages - call __minix_unmapzero - - call _main ! main(argc, argv, envp) - - push eax ! push exit status - call _exit - - hlt ! force a trap if exit fails - -__minix_unmapzero: - - ! unmap 0-page code - push I386_PAGE_SIZE - push crtso - call _munmap_text ! munmap_text(crtso, I386_PAGE_SIZE) - add esp, 8 - - ! unmap 0-page data - push I386_PAGE_SIZE - push romstart - call _munmap ! munmap(romstart, I386_PAGE_SIZE) - add esp, 8 - - ret - -.sect .rom -romstart: - .space I386_PAGE_SIZE -__minix_datastart: - .space 4 -.sect .data -__penviron: - .data4 __penvp ! Pointer to environ, or hidden pointer - -.sect .bss - .comm __penvp, 4 ! Hidden environment vector - .comm __fpu_present, 4 ! FPU present flag - -.extern endtext ! Force loading of end labels. diff --git a/lib/libc/arch/i386/int64/Makefile.inc b/lib/libc/arch/i386/int64/Makefile.inc index 259af772c..60e5a7248 100644 --- a/lib/libc/arch/i386/int64/Makefile.inc +++ b/lib/libc/arch/i386/int64/Makefile.inc @@ -2,15 +2,15 @@ .PATH: ${.CURDIR}/arch/${ARCH}/int64 SRCS+= \ - add64.s \ - add64u.s \ - cmp64.s \ - cv64u.s \ - cvu64.s \ - diff64.s \ - div64u.s \ - ex64.s \ - make64.s \ - mul64u.s \ - sub64.s \ - sub64u.s + add64.S \ + add64u.S \ + cmp64.S \ + cv64u.S \ + cvu64.S \ + diff64.S \ + div64u.S \ + ex64.S \ + make64.S \ + mul64u.S \ + sub64.S \ + sub64u.S diff --git a/lib/libc/arch/i386/int64/add64.S b/lib/libc/arch/i386/int64/add64.S new file mode 100644 index 000000000..0518b8d43 --- /dev/null +++ b/lib/libc/arch/i386/int64/add64.S @@ -0,0 +1,18 @@ +/* add64() - 64 bit addition Author: Kees J. Bot */ +/* 7 Dec 1995 */ +.text +.globl _add64 + +_add64: +/* u64_t add64(u64_t i, u64_t j); */ + movl 4(%esp), %eax + movl 8(%esp), %edx + addl 16(%esp), %edx + movl %edx, (%eax) + movl 12(%esp), %edx + adcl 20(%esp), %edx + movl %edx, 4(%eax) + ret + +/* */ +/* $PchId: add64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */ diff --git a/lib/libc/arch/i386/int64/add64.s b/lib/libc/arch/i386/int64/add64.s deleted file mode 100644 index 3cc994f8b..000000000 --- a/lib/libc/arch/i386/int64/add64.s +++ /dev/null @@ -1,17 +0,0 @@ -! add64() - 64 bit addition Author: Kees J. Bot -! 7 Dec 1995 -.sect .text -.define _add64 - -_add64: ! u64_t add64(u64_t i, u64_t j); - mov eax, 4(esp) - mov edx, 8(esp) - add edx, 16(esp) - mov (eax), edx - mov edx, 12(esp) - adc edx, 20(esp) - mov 4(eax), edx - ret - -! -! $PchId: add64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ diff --git a/lib/libc/arch/i386/int64/add64u.S b/lib/libc/arch/i386/int64/add64u.S new file mode 100644 index 000000000..5a63df8fd --- /dev/null +++ b/lib/libc/arch/i386/int64/add64u.S @@ -0,0 +1,20 @@ +/* add64u() - unsigned to 64 bit addition Author: Kees J. Bot */ +/* 7 Dec 1995 */ +.text +.globl _add64u, _add64ul + +_add64u: +/* u64_t add64u(u64_t i, unsigned j); */ +_add64ul: +/* u64_t add64ul(u64_t i, unsigned long j); */ + movl 4(%esp), %eax + movl 8(%esp), %edx + addl 16(%esp), %edx + movl %edx, (%eax) + movl 12(%esp), %edx + adcl $0, %edx + movl %edx, 4(%eax) + ret + +/* */ +/* $PchId: add64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */ diff --git a/lib/libc/arch/i386/int64/add64u.s b/lib/libc/arch/i386/int64/add64u.s deleted file mode 100644 index 58c71fd64..000000000 --- a/lib/libc/arch/i386/int64/add64u.s +++ /dev/null @@ -1,18 +0,0 @@ -! add64u() - unsigned to 64 bit addition Author: Kees J. Bot -! 7 Dec 1995 -.sect .text -.define _add64u, _add64ul - -_add64u: ! u64_t add64u(u64_t i, unsigned j); -_add64ul: ! u64_t add64ul(u64_t i, unsigned long j); - mov eax, 4(esp) - mov edx, 8(esp) - add edx, 16(esp) - mov (eax), edx - mov edx, 12(esp) - adc edx, 0 - mov 4(eax), edx - ret - -! -! $PchId: add64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ diff --git a/lib/libc/arch/i386/int64/cmp64.S b/lib/libc/arch/i386/int64/cmp64.S new file mode 100644 index 000000000..cdcaab3fa --- /dev/null +++ b/lib/libc/arch/i386/int64/cmp64.S @@ -0,0 +1,35 @@ +/* cmp64*() - 64 bit compare Author: Kees J. Bot */ +/* 7 Dec 1995 */ +.text +.globl _cmp64, _cmp64u, _cmp64ul + +_cmp64: +/* int cmp64(u64_t i, u64_t j); */ + movl %esp, %ecx +0: + xorl %eax, %eax + movl 4(%ecx), %edx + subl 12(%ecx), %edx + movl 8(%ecx), %edx + sbbl 16(%ecx), %edx + sbbl %eax, %eax /* eax = - (i < j) */ + movl 12(%ecx), %edx + subl 4(%ecx), %edx + movl 16(%ecx), %edx + sbbl 8(%ecx), %edx + adcl $0, %eax /* eax = (i > j) - (i < j) */ + ret + +_cmp64u: +/* int cmp64u(u64_t i, unsigned j); */ +_cmp64ul: +/* int cmp64ul(u64_t i, unsigned long j); */ + movl %esp, %ecx + push 16(%ecx) + movl $0, 16(%ecx) + call 0b + pop 16(%ecx) + ret + +/* */ +/* $PchId: cmp64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */ diff --git a/lib/libc/arch/i386/int64/cmp64.s b/lib/libc/arch/i386/int64/cmp64.s deleted file mode 100644 index d3ba6bfc8..000000000 --- a/lib/libc/arch/i386/int64/cmp64.s +++ /dev/null @@ -1,31 +0,0 @@ -! cmp64*() - 64 bit compare Author: Kees J. Bot -! 7 Dec 1995 -.sect .text -.define _cmp64, _cmp64u, _cmp64ul - -_cmp64: ! int cmp64(u64_t i, u64_t j); - mov ecx, esp -cmp64: xor eax, eax - mov edx, 4(ecx) - sub edx, 12(ecx) - mov edx, 8(ecx) - sbb edx, 16(ecx) - sbb eax, eax ! eax = - (i < j) - mov edx, 12(ecx) - sub edx, 4(ecx) - mov edx, 16(ecx) - sbb edx, 8(ecx) - adc eax, 0 ! eax = (i > j) - (i < j) - ret - -_cmp64u: ! int cmp64u(u64_t i, unsigned j); -_cmp64ul: ! int cmp64ul(u64_t i, unsigned long j); - mov ecx, esp - push 16(ecx) - mov 16(ecx), 0 - call cmp64 - pop 16(ecx) - ret - -! -! $PchId: cmp64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ diff --git a/lib/libc/arch/i386/int64/cv64u.S b/lib/libc/arch/i386/int64/cv64u.S new file mode 100644 index 000000000..ac8e4451a --- /dev/null +++ b/lib/libc/arch/i386/int64/cv64u.S @@ -0,0 +1,18 @@ +/* cv64u() - 64 bit converted to unsigned Author: Kees J. Bot */ +/* 7 Dec 1995 */ +.text +.globl _cv64u, _cv64ul + +_cv64u: +/* unsigned cv64u(u64_t i); */ +_cv64ul: +/* unsigned long cv64ul(u64_t i); */ + movl 4(%esp), %eax + cmpl $0, 8(%esp) /* return ULONG_MAX if really big */ + je 0f + movl $-1, %eax +0: + ret + +/* */ +/* $PchId: cv64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */ diff --git a/lib/libc/arch/i386/int64/cv64u.s b/lib/libc/arch/i386/int64/cv64u.s deleted file mode 100644 index a4b41f349..000000000 --- a/lib/libc/arch/i386/int64/cv64u.s +++ /dev/null @@ -1,15 +0,0 @@ -! cv64u() - 64 bit converted to unsigned Author: Kees J. Bot -! 7 Dec 1995 -.sect .text -.define _cv64u, _cv64ul - -_cv64u: ! unsigned cv64u(u64_t i); -_cv64ul: ! unsigned long cv64ul(u64_t i); - mov eax, 4(esp) - cmp 8(esp), 0 ! return ULONG_MAX if really big - jz 0f - mov eax, -1 -0: ret - -! -! $PchId: cv64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ diff --git a/lib/libc/arch/i386/int64/cvu64.S b/lib/libc/arch/i386/int64/cvu64.S new file mode 100644 index 000000000..13fa832c1 --- /dev/null +++ b/lib/libc/arch/i386/int64/cvu64.S @@ -0,0 +1,17 @@ +/* cvu64() - unsigned converted to 64 bit Author: Kees J. Bot */ +/* 7 Dec 1995 */ +.text +.globl _cvu64, _cvul64 + +_cvu64: +/* u64_t cvu64(unsigned i); */ +_cvul64: +/* u64_t cvul64(unsigned long i); */ + movl 4(%esp), %eax + movl 8(%esp), %edx + movl %edx, (%eax) + movl $0, 4(%eax) + ret + +/* */ +/* $PchId: cvu64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */ diff --git a/lib/libc/arch/i386/int64/cvu64.s b/lib/libc/arch/i386/int64/cvu64.s deleted file mode 100644 index a35441e5a..000000000 --- a/lib/libc/arch/i386/int64/cvu64.s +++ /dev/null @@ -1,15 +0,0 @@ -! cvu64() - unsigned converted to 64 bit Author: Kees J. Bot -! 7 Dec 1995 -.sect .text -.define _cvu64, _cvul64 - -_cvu64: ! u64_t cvu64(unsigned i); -_cvul64: ! u64_t cvul64(unsigned long i); - mov eax, 4(esp) - mov edx, 8(esp) - mov (eax), edx - mov 4(eax), 0 - ret - -! -! $PchId: cvu64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ diff --git a/lib/libc/arch/i386/int64/diff64.S b/lib/libc/arch/i386/int64/diff64.S new file mode 100644 index 000000000..818459b44 --- /dev/null +++ b/lib/libc/arch/i386/int64/diff64.S @@ -0,0 +1,13 @@ +/* diff64() - 64 bit subtraction giving unsigned Author: Kees J. Bot */ +/* 7 Dec 1995 */ +.text +.globl _diff64 + +_diff64: +/* unsigned diff64(u64_t i, u64_t j); */ + movl 4(%esp), %eax + subl 12(%esp), %eax + ret + +/* */ +/* $PchId: diff64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */ diff --git a/lib/libc/arch/i386/int64/diff64.s b/lib/libc/arch/i386/int64/diff64.s deleted file mode 100644 index e895a75c8..000000000 --- a/lib/libc/arch/i386/int64/diff64.s +++ /dev/null @@ -1,12 +0,0 @@ -! diff64() - 64 bit subtraction giving unsigned Author: Kees J. Bot -! 7 Dec 1995 -.sect .text -.define _diff64 - -_diff64: ! unsigned diff64(u64_t i, u64_t j); - mov eax, 4(esp) - sub eax, 12(esp) - ret - -! -! $PchId: diff64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ diff --git a/lib/libc/arch/i386/int64/div64u.S b/lib/libc/arch/i386/int64/div64u.S new file mode 100644 index 000000000..c66979480 --- /dev/null +++ b/lib/libc/arch/i386/int64/div64u.S @@ -0,0 +1,24 @@ +/* div64u() - 64 bit divided by unsigned giving unsigned long */ +/* Author: Kees J. Bot */ +/* 7 Dec 1995 */ +.text +.globl _div64u, _rem64u + +_div64u: +/* unsigned long div64u(u64_t i, unsigned j); */ + xorl %edx, %edx + movl 8(%esp), %eax /* i = (ih<<32) + il */ + divl 12(%esp) /* ih = q * j + r */ + movl 4(%esp), %eax + divl 12(%esp) /* i / j = (q<<32) + ((r<<32) + il) / j */ + ret + +_rem64u: +/* unsigned rem64u(u64_t i, unsigned j); */ + pop %ecx + call _div64u + movl %edx, %eax + jmp *%ecx + +/* */ +/* $PchId: div64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */ diff --git a/lib/libc/arch/i386/int64/div64u.s b/lib/libc/arch/i386/int64/div64u.s deleted file mode 100644 index 5d3629dc8..000000000 --- a/lib/libc/arch/i386/int64/div64u.s +++ /dev/null @@ -1,22 +0,0 @@ -! div64u() - 64 bit divided by unsigned giving unsigned long -! Author: Kees J. Bot -! 7 Dec 1995 -.sect .text -.define _div64u, _rem64u - -_div64u: ! unsigned long div64u(u64_t i, unsigned j); - xor edx, edx - mov eax, 8(esp) ! i = (ih<<32) + il - div 12(esp) ! ih = q * j + r - mov eax, 4(esp) - div 12(esp) ! i / j = (q<<32) + ((r<<32) + il) / j - ret - -_rem64u: ! unsigned rem64u(u64_t i, unsigned j); - pop ecx - call _div64u - mov eax, edx - jmp ecx - -! -! $PchId: div64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ diff --git a/lib/libc/arch/i386/int64/ex64.S b/lib/libc/arch/i386/int64/ex64.S new file mode 100644 index 000000000..bd224fb0d --- /dev/null +++ b/lib/libc/arch/i386/int64/ex64.S @@ -0,0 +1,18 @@ +/* ex64*() - extract low or high 32 bits of a 64 bit number */ +/* Author: Kees J. Bot */ +/* 7 Dec 1995 */ +.text +.globl _ex64lo, _ex64hi + +_ex64lo: +/* unsigned long ex64lo(u64_t i); */ + movl 4(%esp), %eax + ret + +_ex64hi: +/* unsigned long ex64hi(u64_t i); */ + movl 8(%esp), %eax + ret + +/* */ +/* $PchId: ex64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */ diff --git a/lib/libc/arch/i386/int64/ex64.s b/lib/libc/arch/i386/int64/ex64.s deleted file mode 100644 index 1bfc90d38..000000000 --- a/lib/libc/arch/i386/int64/ex64.s +++ /dev/null @@ -1,16 +0,0 @@ -! ex64*() - extract low or high 32 bits of a 64 bit number -! Author: Kees J. Bot -! 7 Dec 1995 -.sect .text -.define _ex64lo, _ex64hi - -_ex64lo: ! unsigned long ex64lo(u64_t i); - mov eax, 4(esp) - ret - -_ex64hi: ! unsigned long ex64hi(u64_t i); - mov eax, 8(esp) - ret - -! -! $PchId: ex64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ diff --git a/lib/libc/arch/i386/int64/make64.S b/lib/libc/arch/i386/int64/make64.S new file mode 100644 index 000000000..c53474bb1 --- /dev/null +++ b/lib/libc/arch/i386/int64/make64.S @@ -0,0 +1,17 @@ +/* make64() - make a 64 bit number from two 32 bit halves */ +/* Author: Kees J. Bot */ +/* 7 Dec 1995 */ +.text +.globl _make64 + +_make64: +/* u64_t make64(unsigned long lo, unsigned long hi); */ + movl 4(%esp), %eax + movl 8(%esp), %edx + movl %edx, (%eax) + movl 12(%esp), %edx + movl %edx, 4(%eax) + ret + +/* */ +/* $PchId: make64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */ diff --git a/lib/libc/arch/i386/int64/make64.s b/lib/libc/arch/i386/int64/make64.s deleted file mode 100644 index 7e57727c2..000000000 --- a/lib/libc/arch/i386/int64/make64.s +++ /dev/null @@ -1,16 +0,0 @@ -! make64() - make a 64 bit number from two 32 bit halves -! Author: Kees J. Bot -! 7 Dec 1995 -.sect .text -.define _make64 - -_make64: ! u64_t make64(unsigned long lo, unsigned long hi); - mov eax, 4(esp) - mov edx, 8(esp) - mov (eax), edx - mov edx, 12(esp) - mov 4(eax), edx - ret - -! -! $PchId: make64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ diff --git a/lib/libc/arch/i386/int64/mul64u.S b/lib/libc/arch/i386/int64/mul64u.S new file mode 100644 index 000000000..60e8c487c --- /dev/null +++ b/lib/libc/arch/i386/int64/mul64u.S @@ -0,0 +1,18 @@ +/* mul64u() - unsigned long by unsigned multiply giving 64 bit result */ +/* Author: Kees J. Bot */ +/* 7 Dec 1995 */ +.text +.globl _mul64u + +_mul64u: +/* u64_t mul64u(unsigned long i, unsigned j); */ + movl 4(%esp), %ecx + movl 8(%esp), %eax + mull 12(%esp) + movl %eax, (%ecx) + movl %edx, 4(%ecx) + movl %ecx, %eax + ret + +/* */ +/* $PchId: mul64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */ diff --git a/lib/libc/arch/i386/int64/mul64u.s b/lib/libc/arch/i386/int64/mul64u.s deleted file mode 100644 index f28ecf03d..000000000 --- a/lib/libc/arch/i386/int64/mul64u.s +++ /dev/null @@ -1,17 +0,0 @@ -! mul64u() - unsigned long by unsigned multiply giving 64 bit result -! Author: Kees J. Bot -! 7 Dec 1995 -.sect .text -.define _mul64u - -_mul64u: ! u64_t mul64u(unsigned long i, unsigned j); - mov ecx, 4(esp) - mov eax, 8(esp) - mul 12(esp) - mov (ecx), eax - mov 4(ecx), edx - mov eax, ecx - ret - -! -! $PchId: mul64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ diff --git a/lib/libc/arch/i386/int64/sub64.S b/lib/libc/arch/i386/int64/sub64.S new file mode 100644 index 000000000..5100311be --- /dev/null +++ b/lib/libc/arch/i386/int64/sub64.S @@ -0,0 +1,18 @@ +/* sub64() - 64 bit subtraction Author: Kees J. Bot */ +/* 7 Dec 1995 */ +.text +.globl _sub64 + +_sub64: +/* u64_t sub64(u64_t i, u64_t j); */ + movl 4(%esp), %eax + movl 8(%esp), %edx + subl 16(%esp), %edx + movl %edx, (%eax) + movl 12(%esp), %edx + sbbl 20(%esp), %edx + movl %edx, 4(%eax) + ret + +/* */ +/* $PchId: sub64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */ diff --git a/lib/libc/arch/i386/int64/sub64.s b/lib/libc/arch/i386/int64/sub64.s deleted file mode 100644 index 15c7c12c5..000000000 --- a/lib/libc/arch/i386/int64/sub64.s +++ /dev/null @@ -1,17 +0,0 @@ -! sub64() - 64 bit subtraction Author: Kees J. Bot -! 7 Dec 1995 -.sect .text -.define _sub64 - -_sub64: ! u64_t sub64(u64_t i, u64_t j); - mov eax, 4(esp) - mov edx, 8(esp) - sub edx, 16(esp) - mov (eax), edx - mov edx, 12(esp) - sbb edx, 20(esp) - mov 4(eax), edx - ret - -! -! $PchId: sub64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ diff --git a/lib/libc/arch/i386/int64/sub64u.S b/lib/libc/arch/i386/int64/sub64u.S new file mode 100644 index 000000000..84314f275 --- /dev/null +++ b/lib/libc/arch/i386/int64/sub64u.S @@ -0,0 +1,20 @@ +/* sub64() - unsigned from 64 bit subtraction Author: Kees J. Bot */ +/* 7 Dec 1995 */ +.text +.globl _sub64u, _sub64ul + +_sub64u: +/* u64_t sub64u(u64_t i, unsigned j); */ +_sub64ul: +/* u64_t sub64ul(u64_t i, unsigned long j); */ + movl 4(%esp), %eax + movl 8(%esp), %edx + subl 16(%esp), %edx + movl %edx, (%eax) + movl 12(%esp), %edx + sbbl $0, %edx + movl %edx, 4(%eax) + ret + +/* */ +/* $PchId: sub64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */ diff --git a/lib/libc/arch/i386/int64/sub64u.s b/lib/libc/arch/i386/int64/sub64u.s deleted file mode 100644 index 52e209296..000000000 --- a/lib/libc/arch/i386/int64/sub64u.s +++ /dev/null @@ -1,18 +0,0 @@ -! sub64() - unsigned from 64 bit subtraction Author: Kees J. Bot -! 7 Dec 1995 -.sect .text -.define _sub64u, _sub64ul - -_sub64u: ! u64_t sub64u(u64_t i, unsigned j); -_sub64ul: ! u64_t sub64ul(u64_t i, unsigned long j); - mov eax, 4(esp) - mov edx, 8(esp) - sub edx, 16(esp) - mov (eax), edx - mov edx, 12(esp) - sbb edx, 0 - mov 4(eax), edx - ret - -! -! $PchId: sub64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ diff --git a/lib/libc/arch/i386/math/Makefile.inc b/lib/libc/arch/i386/math/Makefile.inc index ad0624576..f682d67b8 100644 --- a/lib/libc/arch/i386/math/Makefile.inc +++ b/lib/libc/arch/i386/math/Makefile.inc @@ -4,9 +4,9 @@ SRCS+= \ arch_compare.c \ arch_round.c \ - fpu_cw.s \ - fpu_sw.s \ - fpu_round.s \ + fpu_cw.S \ + fpu_sw.S \ + fpu_round.S \ fegetround.c \ feholdexcept.c \ fesetround.c diff --git a/lib/libc/arch/i386/math/fpu_cw.S b/lib/libc/arch/i386/math/fpu_cw.S new file mode 100644 index 000000000..804652325 --- /dev/null +++ b/lib/libc/arch/i386/math/fpu_cw.S @@ -0,0 +1,20 @@ +/* fpu_cw_get() - get FPU control word Author: Erik van der Kouwe */ +/* fpu_cw_set() - set FPU control word 9 Dec 2009 */ +.text +.globl _fpu_cw_get +.globl _fpu_cw_set + +/* u16_t fpu_cw_get(void) */ +_fpu_cw_get: +/* clear unused bits just to be sure */ + xor %eax, %eax + push %eax + fstcw (%esp) + pop %eax + ret + +/* void fpu_cw_set(u16_t fpu_cw) */ +_fpu_cw_set: +/* load control word from parameter */ + fldcw 4(%esp) + ret diff --git a/lib/libc/arch/i386/math/fpu_cw.s b/lib/libc/arch/i386/math/fpu_cw.s deleted file mode 100644 index f637497ee..000000000 --- a/lib/libc/arch/i386/math/fpu_cw.s +++ /dev/null @@ -1,20 +0,0 @@ -! fpu_cw_get() - get FPU control word Author: Erik van der Kouwe -! fpu_cw_set() - set FPU control word 9 Dec 2009 -.sect .text -.define _fpu_cw_get -.define _fpu_cw_set - -! u16_t fpu_cw_get(void) -_fpu_cw_get: - ! clear unused bits just to be sure - xor eax, eax - push eax - fstcw (esp) - pop eax - ret - -! void fpu_cw_set(u16_t fpu_cw) -_fpu_cw_set: - ! load control word from parameter - fldcw 4(esp) - ret diff --git a/lib/libc/arch/i386/math/fpu_round.S b/lib/libc/arch/i386/math/fpu_round.S new file mode 100644 index 000000000..0561dd06c --- /dev/null +++ b/lib/libc/arch/i386/math/fpu_round.S @@ -0,0 +1,37 @@ +/* fpu_rndint() - round integer Author: Erik van der Kouwe */ +/* 17 Dec 2009 */ +.text +.globl _fpu_rndint +.globl _fpu_remainder + +/* void fpu_rndint(double *value) */ +_fpu_rndint: +/* move the value onto the floating point stack */ + mov 4(%esp), %eax + fldl (%eax) + +/* round it (beware of precision exception!) */ + frndint + +/* store the result */ + fstpl (%eax) + ret + +/* void fpu_remainder(double *x, double y) */ +_fpu_remainder: +/* move the values onto the floating point stack */ + fldl 8(%esp) + mov 4(%esp), %edx + fldl (%edx) + +/* compute remainder, multiple iterations may be needed */ +1: + fprem1 +.byte 0xdf, 0xe0 /* fnstsw ax */ + sahf + jp 1b + +/* store the result and pop the divisor */ + fstpl (%edx) + fstp %st + ret diff --git a/lib/libc/arch/i386/math/fpu_round.s b/lib/libc/arch/i386/math/fpu_round.s deleted file mode 100644 index 404f2fd82..000000000 --- a/lib/libc/arch/i386/math/fpu_round.s +++ /dev/null @@ -1,36 +0,0 @@ -! fpu_rndint() - round integer Author: Erik van der Kouwe -! 17 Dec 2009 -.sect .text -.define _fpu_rndint -.define _fpu_remainder - -! void fpu_rndint(double *value) -_fpu_rndint: - ! move the value onto the floating point stack - mov eax, 4(esp) - fldd (eax) - - ! round it (beware of precision exception!) - frndint - - ! store the result - fstpd (eax) - ret - -! void fpu_remainder(double *x, double y) -_fpu_remainder: - ! move the values onto the floating point stack - fldd 8(esp) - mov edx, 4(esp) - fldd (edx) - - ! compute remainder, multiple iterations may be needed -1: fprem1 - .data1 0xdf, 0xe0 ! fnstsw ax - sahf - jp 1b - - ! store the result and pop the divisor - fstpd (edx) - fstp st - ret diff --git a/lib/libc/arch/i386/math/fpu_sw.S b/lib/libc/arch/i386/math/fpu_sw.S new file mode 100644 index 000000000..ce36acacd --- /dev/null +++ b/lib/libc/arch/i386/math/fpu_sw.S @@ -0,0 +1,37 @@ +/* fpu_compare() - compare doubles Author: Erik van der Kouwe */ +/* fpu_sw_get() - get FPU status 17 Dec 2009 */ +/* fpu_xam() - examine double */ +.text +.globl _fpu_compare +.globl _fpu_sw_get +.globl _fpu_xam + +/* u16_t fpu_compare(double x, double y) */ +_fpu_compare: +/* move the values onto the floating point stack */ + fldl 12(%esp) + fldl 4(%esp) + +/* compare values and return status word */ + fcompp + jmp _fpu_sw_get + +/* u16_t fpu_sw_get(void) */ +_fpu_sw_get: +/* clear unused high-order word and get status word */ + xor %eax, %eax +.byte 0xdf, 0xe0 /* fnstsw ax */ + ret + +/* u16_t fpu_xam(double value) */ +_fpu_xam: +/* move the value onto the floating point stack */ + fldl 4(%esp) + +/* examine value and get status word */ + fxam + call _fpu_sw_get + +/* pop the value */ + fstp %st + ret diff --git a/lib/libc/arch/i386/math/fpu_sw.s b/lib/libc/arch/i386/math/fpu_sw.s deleted file mode 100644 index 3d6f30da5..000000000 --- a/lib/libc/arch/i386/math/fpu_sw.s +++ /dev/null @@ -1,38 +0,0 @@ -! fpu_compare() - compare doubles Author: Erik van der Kouwe -! fpu_sw_get() - get FPU status 17 Dec 2009 -! fpu_xam() - examine double -.sect .text -.define _fpu_compare -.define _fpu_sw_get -.define _fpu_xam - -! u16_t fpu_compare(double x, double y) -_fpu_compare: - ! move the values onto the floating point stack - fldd 12(esp) - fldd 4(esp) - - ! compare values and return status word - fcompp - jmp _fpu_sw_get - -! u16_t fpu_sw_get(void) -_fpu_sw_get: - ! clear unused high-order word and get status word - xor eax, eax - .data1 0xdf, 0xe0 ! fnstsw ax - ret - -! u16_t fpu_xam(double value) -_fpu_xam: - ! move the value onto the floating point stack - fldd 4(esp) - - ! examine value and get status word - fxam - call _fpu_sw_get - - ! pop the value - fstp st - ret - diff --git a/lib/libc/arch/i386/misc/Makefile.inc b/lib/libc/arch/i386/misc/Makefile.inc index 8530d8017..d915c3a94 100644 --- a/lib/libc/arch/i386/misc/Makefile.inc +++ b/lib/libc/arch/i386/misc/Makefile.inc @@ -2,22 +2,22 @@ .PATH: ${.CURDIR}/arch/${ARCH}/misc SRCS+= \ - _cpuid.s \ + _cpuid.S \ _cpufeature.c \ - alloca.s \ - get_bp.s \ - getprocessor.s \ - io_inb.s \ - io_inl.s \ - io_insb.s \ - io_insl.s \ - io_insw.s \ - io_intr.s \ - io_inw.s \ - io_outb.s \ - io_outl.s \ - io_outsb.s \ - io_outsl.s \ - io_outsw.s \ - io_outw.s \ - oneC_sum.s + alloca.S \ + get_bp.S \ + getprocessor.S \ + io_inb.S \ + io_inl.S \ + io_insb.S \ + io_insl.S \ + io_insw.S \ + io_intr.S \ + io_inw.S \ + io_outb.S \ + io_outl.S \ + io_outsb.S \ + io_outsl.S \ + io_outsw.S \ + io_outw.S \ + oneC_sum.S diff --git a/lib/libc/arch/i386/misc/_cpuid.S b/lib/libc/arch/i386/misc/_cpuid.S new file mode 100644 index 000000000..92d7ca926 --- /dev/null +++ b/lib/libc/arch/i386/misc/_cpuid.S @@ -0,0 +1,41 @@ +/* _cpuid() - interface to cpuid instruction */ + + +/* void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx); */ +/* 0 for OK, nonzero for unsupported */ + +.globl __cpuid + +.text +__cpuid: +/* save work registers */ + push %ebp + push %ebx + +/* set eax parameter to cpuid and execute cpuid */ + movl 12(%esp), %ebp + mov (%ebp), %eax + movl 16(%esp), %ebp + mov (%ebp), %ebx + movl 20(%esp), %ebp + mov (%ebp), %ecx + movl 24(%esp), %ebp + mov (%ebp), %edx + +.byte 0x0F, 0xA2 /* CPUID */ + +/* store results in pointer arguments */ + movl 12(%esp), %ebp + movl %eax, (%ebp) + movl 16(%esp), %ebp + movl %ebx, (%ebp) + movl 20(%esp), %ebp + movl %ecx, (%ebp) + movl 24(%esp), %ebp + movl %edx, (%ebp) + +/* restore registers */ + pop %ebx + pop %ebp + + ret diff --git a/lib/libc/arch/i386/misc/_cpuid.s b/lib/libc/arch/i386/misc/_cpuid.s deleted file mode 100644 index c967fe0fb..000000000 --- a/lib/libc/arch/i386/misc/_cpuid.s +++ /dev/null @@ -1,40 +0,0 @@ -! _cpuid() - interface to cpuid instruction - -.sect .text; .sect .rom; .sect .data; .sect .bss -.sect .text - -! void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx); - -.define __cpuid - -__cpuid: - ! save registers - push ebp - push ebx - - ! set parameters to cpuid and execute cpuid - mov ebp, 12(esp) - mov eax, (ebp) - mov ebp, 16(esp) - mov ebx, (ebp) - mov ebp, 20(esp) - mov ecx, (ebp) - mov ebp, 24(esp) - mov edx, (ebp) - .data1 0x0F, 0xA2 ! CPUID - - ! store results in pointer arguments - mov ebp, 12(esp) - mov (ebp), eax - mov ebp, 16(esp) - mov (ebp), ebx - mov ebp, 20(esp) - mov (ebp), ecx - mov ebp, 24(esp) - mov (ebp), edx - - ! restore registers - pop ebx - pop ebp - - ret diff --git a/lib/libc/arch/i386/misc/alloca.S b/lib/libc/arch/i386/misc/alloca.S new file mode 100644 index 000000000..24de081fb --- /dev/null +++ b/lib/libc/arch/i386/misc/alloca.S @@ -0,0 +1,32 @@ +/* */ +/* alloca() - allocate space on the stack Author: Kees J. Bot */ +/* 2 Dec 1993 */ + +.text +.balign 16 +.globl _alloca +_alloca: +#if __ACK__ + pop %ecx /* Return address */ + pop %eax /* Bytes to allocate */ + addl $2*4+3, %eax /* Add space for two saved register variables */ + andb $0xFC, %al /* Align */ + movl %esp, %ebx /* Keep current esp */ + subl %eax, %esp /* Lower stack */ + movl %esp, %eax /* Return value */ + push 4(%ebx) /* Push what is probably the saved esi */ + push (%ebx) /* Saved edi */ +/* Now ACK can still do: */ +/* pop edi; pop esi; leave; ret */ + push %eax /* Dummy argument */ + jmp *%ecx +#else + pop %ecx /* Return address */ + pop %eax /* Bytes to allocate */ + addl $3, %eax + andb $0xFC, %al /* Align */ + subl %eax, %esp /* Lower stack */ + movl %esp, %eax /* Return value */ + push %eax /* Dummy argument */ + jmp *%ecx +#endif diff --git a/lib/libc/arch/i386/misc/alloca.s b/lib/libc/arch/i386/misc/alloca.s deleted file mode 100644 index 8147ac6e9..000000000 --- a/lib/libc/arch/i386/misc/alloca.s +++ /dev/null @@ -1,33 +0,0 @@ -# -! alloca() - allocate space on the stack Author: Kees J. Bot -! 2 Dec 1993 -.sect .text; .sect .rom; .sect .data; .sect .bss - -.sect .text - .align 16 -.define _alloca -_alloca: -#if __ACK__ - pop ecx ! Return address - pop eax ! Bytes to allocate - add eax, 2*4+3 ! Add space for two saved register variables - andb al, 0xFC ! Align - mov ebx, esp ! Keep current esp - sub esp, eax ! Lower stack - mov eax, esp ! Return value - push 4(ebx) ! Push what is probably the saved esi - push (ebx) ! Saved edi - ! Now ACK can still do: - ! pop edi; pop esi; leave; ret - push eax ! Dummy argument - jmp ecx -#else - pop ecx ! Return address - pop eax ! Bytes to allocate - add eax, 3 - andb al, 0xFC ! Align - sub esp, eax ! Lower stack - mov eax, esp ! Return value - push eax ! Dummy argument - jmp ecx -#endif diff --git a/lib/libc/arch/i386/misc/get_bp.S b/lib/libc/arch/i386/misc/get_bp.S new file mode 100644 index 000000000..0da4e61bd --- /dev/null +++ b/lib/libc/arch/i386/misc/get_bp.S @@ -0,0 +1,14 @@ +/* get_bp.s */ +/* */ +/* return EBP in EAX */ +/* */ +/* Created: Sep 7, 1992 by Philip Homburg */ + + +.text +.globl _get_bp +_get_bp: + movl %ebp, %eax + ret + +/* $PchId: get_bp.ack.s,v 1.3 1996/02/23 08:30:52 philip Exp $ */ diff --git a/lib/libc/arch/i386/misc/get_bp.s b/lib/libc/arch/i386/misc/get_bp.s deleted file mode 100644 index 1ba81dcb4..000000000 --- a/lib/libc/arch/i386/misc/get_bp.s +++ /dev/null @@ -1,16 +0,0 @@ -! get_bp.s -! -! return EBP in EAX -! -! Created: Sep 7, 1992 by Philip Homburg - -.sect .text; .sect .rom; .sect .data; .sect .bss - -.sect .text -.define _get_bp -_get_bp: - mov eax, ebp - ret - -! $PchId: get_bp.ack.s,v 1.3 1996/02/23 08:30:52 philip Exp $ - diff --git a/lib/libc/arch/i386/misc/getprocessor.S b/lib/libc/arch/i386/misc/getprocessor.S new file mode 100644 index 000000000..f4b893b1b --- /dev/null +++ b/lib/libc/arch/i386/misc/getprocessor.S @@ -0,0 +1,55 @@ +/* getprocessor() - determine processor type Author: Kees J. Bot */ +/* 26 Jan 1994 */ + +.text + +/* int getprocessor(void); */ +/* Return 386, 486, 586, ... */ + +.globl _getprocessor + +_getprocessor: + push %ebp + movl %esp, %ebp + andl $0xFFFFFFFC, %esp /* Align stack to avoid AC fault */ + movl $0x00040000, %ecx /* Try to flip the AC bit introduced on the 486 */ + call flip + movl $386, %eax /* 386 if it didn't react to "flipping" */ + je gotprocessor + movl $0x00200000, %ecx /* Try to flip the ID bit introduced on the 586 */ + call flip + movl $486, %eax /* 486 if it didn't react */ + je gotprocessor + pushf + pusha /* Save the world */ + movl $1, %eax +.byte 0x0F, 0xA2 /* CPUID instruction tells the processor type */ + andb $0x0F, %ah /* Extract the family (5, 6, ...) */ + movzbl %ah, %eax + cmpl $15, %eax /* 15: extended family */ + jne direct + movl $6, %eax /* Make it 686 */ +direct: + imull $100, %eax /* 500, 600, ... */ + addl $86, %eax /* 586, 686, ... */ + movl %eax, 7*4(%esp) /* Pass eax through */ + popa + popf +gotprocessor: + leave + ret + +flip: + pushf /* Push eflags */ + pop %eax /* eax = eflags */ + movl %eax, %edx /* Save original eflags */ + xorl %ecx, %eax /* Flip the bit to test */ + push %eax /* Push modified eflags value */ + popf /* Load modified eflags register */ + pushf + pop %eax /* Get it again */ + push %edx + popf /* Restore original eflags register */ + xorl %edx, %eax /* See if the bit changed */ + testl %ecx, %eax + ret diff --git a/lib/libc/arch/i386/misc/getprocessor.s b/lib/libc/arch/i386/misc/getprocessor.s deleted file mode 100644 index 2b00a39b0..000000000 --- a/lib/libc/arch/i386/misc/getprocessor.s +++ /dev/null @@ -1,56 +0,0 @@ -! getprocessor() - determine processor type Author: Kees J. Bot -! 26 Jan 1994 - -.sect .text; .sect .rom; .sect .data; .sect .bss -.sect .text - -! int getprocessor(void); -! Return 386, 486, 586, ... - -.define _getprocessor - -_getprocessor: - push ebp - mov ebp, esp - and esp, 0xFFFFFFFC ! Align stack to avoid AC fault - mov ecx, 0x00040000 ! Try to flip the AC bit introduced on the 486 - call flip - mov eax, 386 ! 386 if it didn't react to "flipping" - jz gotprocessor - mov ecx, 0x00200000 ! Try to flip the ID bit introduced on the 586 - call flip - mov eax, 486 ! 486 if it didn't react - jz gotprocessor - pushf - pusha ! Save the world - mov eax, 1 - .data1 0x0F, 0xA2 ! CPUID instruction tells the processor type - andb ah, 0x0F ! Extract the family (5, 6, ...) - movzxb eax, ah - cmp eax, 15 ! 15: extended family - jne direct - mov eax, 6 ! Make it 686 -direct: - imul eax, 100 ! 500, 600, ... - add eax, 86 ! 586, 686, ... - mov 7*4(esp), eax ! Pass eax through - popa - popf -gotprocessor: - leave - ret - -flip: - pushf ! Push eflags - pop eax ! eax = eflags - mov edx, eax ! Save original eflags - xor eax, ecx ! Flip the bit to test - push eax ! Push modified eflags value - popf ! Load modified eflags register - pushf - pop eax ! Get it again - push edx - popf ! Restore original eflags register - xor eax, edx ! See if the bit changed - test eax, ecx - ret diff --git a/lib/libc/arch/i386/misc/io_inb.S b/lib/libc/arch/i386/misc/io_inb.S new file mode 100644 index 000000000..f7e4f7a77 --- /dev/null +++ b/lib/libc/arch/i386/misc/io_inb.S @@ -0,0 +1,14 @@ +/* inb() - Input one byte Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* unsigned inb(U16_t port); */ + +.text +.globl _inb +_inb: + push %ebp + movl %esp, %ebp + movl 8(%ebp), %edx /* port */ + xorl %eax, %eax + inb %dx /* read 1 byte */ + pop %ebp + ret diff --git a/lib/libc/arch/i386/misc/io_inb.s b/lib/libc/arch/i386/misc/io_inb.s deleted file mode 100644 index ab59d7310..000000000 --- a/lib/libc/arch/i386/misc/io_inb.s +++ /dev/null @@ -1,14 +0,0 @@ -! inb() - Input one byte Author: Kees J. Bot -! 18 Mar 1996 -! unsigned inb(U16_t port); - -.sect .text -.define _inb -_inb: - push ebp - mov ebp, esp - mov edx, 8(ebp) ! port - xor eax, eax - inb dx ! read 1 byte - pop ebp - ret diff --git a/lib/libc/arch/i386/misc/io_inl.S b/lib/libc/arch/i386/misc/io_inl.S new file mode 100644 index 000000000..cae064f93 --- /dev/null +++ b/lib/libc/arch/i386/misc/io_inl.S @@ -0,0 +1,13 @@ +/* inl() - Input one dword Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* unsigned inl(U16_t port); */ + +.text +.globl _inl +_inl: + push %ebp + movl %esp, %ebp + movl 8(%ebp), %edx /* port */ + inl %dx /* read 1 dword */ + pop %ebp + ret diff --git a/lib/libc/arch/i386/misc/io_inl.s b/lib/libc/arch/i386/misc/io_inl.s deleted file mode 100644 index f09cf5cb1..000000000 --- a/lib/libc/arch/i386/misc/io_inl.s +++ /dev/null @@ -1,13 +0,0 @@ -! inl() - Input one dword Author: Kees J. Bot -! 18 Mar 1996 -! unsigned inl(U16_t port); - -.sect .text -.define _inl -_inl: - push ebp - mov ebp, esp - mov edx, 8(ebp) ! port - in dx ! read 1 dword - pop ebp - ret diff --git a/lib/libc/arch/i386/misc/io_insb.S b/lib/libc/arch/i386/misc/io_insb.S new file mode 100644 index 000000000..ac9ba19a1 --- /dev/null +++ b/lib/libc/arch/i386/misc/io_insb.S @@ -0,0 +1,18 @@ +/* insb() - Input a byte array Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* void insb(U16_t port, void *buf, size_t count); */ + +.text +.globl _insb +_insb: + push %ebp + movl %esp, %ebp + cld + push %edi + movl 8(%ebp), %edx /* port */ + movl 12(%ebp), %edi /* buf */ + movl 16(%ebp), %ecx /* byte count */ + rep insb /* input many bytes */ + pop %edi + pop %ebp + ret diff --git a/lib/libc/arch/i386/misc/io_insb.s b/lib/libc/arch/i386/misc/io_insb.s deleted file mode 100644 index 91b20dc31..000000000 --- a/lib/libc/arch/i386/misc/io_insb.s +++ /dev/null @@ -1,18 +0,0 @@ -! insb() - Input a byte array Author: Kees J. Bot -! 18 Mar 1996 -! void insb(U16_t port, void *buf, size_t count); - -.sect .text -.define _insb -_insb: - push ebp - mov ebp, esp - cld - push edi - mov edx, 8(ebp) ! port - mov edi, 12(ebp) ! buf - mov ecx, 16(ebp) ! byte count - rep insb ! input many bytes - pop edi - pop ebp - ret diff --git a/lib/libc/arch/i386/misc/io_insl.S b/lib/libc/arch/i386/misc/io_insl.S new file mode 100644 index 000000000..3c68611cc --- /dev/null +++ b/lib/libc/arch/i386/misc/io_insl.S @@ -0,0 +1,19 @@ +/* insl() - Input a dword array Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* void insl(U16_t port, void *buf, size_t count); */ + +.text +.globl _insl +_insl: + push %ebp + movl %esp, %ebp + cld + push %edi + movl 8(%ebp), %edx /* port */ + movl 12(%ebp), %edi /* buf */ + movl 16(%ebp), %ecx /* byte count */ + shrl $2, %ecx /* dword count */ + rep insl /* input many dwords */ + pop %edi + pop %ebp + ret diff --git a/lib/libc/arch/i386/misc/io_insl.s b/lib/libc/arch/i386/misc/io_insl.s deleted file mode 100644 index 29316820d..000000000 --- a/lib/libc/arch/i386/misc/io_insl.s +++ /dev/null @@ -1,19 +0,0 @@ -! insl() - Input a dword array Author: Kees J. Bot -! 18 Mar 1996 -! void insl(U16_t port, void *buf, size_t count); - -.sect .text -.define _insl -_insl: - push ebp - mov ebp, esp - cld - push edi - mov edx, 8(ebp) ! port - mov edi, 12(ebp) ! buf - mov ecx, 16(ebp) ! byte count - shr ecx, 2 ! dword count - rep ins ! input many dwords - pop edi - pop ebp - ret diff --git a/lib/libc/arch/i386/misc/io_insw.S b/lib/libc/arch/i386/misc/io_insw.S new file mode 100644 index 000000000..58719fd47 --- /dev/null +++ b/lib/libc/arch/i386/misc/io_insw.S @@ -0,0 +1,19 @@ +/* insw() - Input a word array Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* void insw(U16_t port, void *buf, size_t count); */ + +.text +.globl _insw +_insw: + push %ebp + movl %esp, %ebp + cld + push %edi + movl 8(%ebp), %edx /* port */ + movl 12(%ebp), %edi /* buf */ + movl 16(%ebp), %ecx /* byte count */ + shrl $1, %ecx /* word count */ + rep insw /* input many words */ + pop %edi + pop %ebp + ret diff --git a/lib/libc/arch/i386/misc/io_insw.s b/lib/libc/arch/i386/misc/io_insw.s deleted file mode 100644 index 039f8d8d5..000000000 --- a/lib/libc/arch/i386/misc/io_insw.s +++ /dev/null @@ -1,19 +0,0 @@ -! insw() - Input a word array Author: Kees J. Bot -! 18 Mar 1996 -! void insw(U16_t port, void *buf, size_t count); - -.sect .text -.define _insw -_insw: - push ebp - mov ebp, esp - cld - push edi - mov edx, 8(ebp) ! port - mov edi, 12(ebp) ! buf - mov ecx, 16(ebp) ! byte count - shr ecx, 1 ! word count -rep o16 ins ! input many words - pop edi - pop ebp - ret diff --git a/lib/libc/arch/i386/misc/io_intr.S b/lib/libc/arch/i386/misc/io_intr.S new file mode 100644 index 000000000..7d210c0c8 --- /dev/null +++ b/lib/libc/arch/i386/misc/io_intr.S @@ -0,0 +1,16 @@ +/* intr_disable(), intr_enable - Disable/Enable hardware interrupts. */ +/* Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* void intr_disable(void); */ +/* void intr_enable(void); */ + +.text +.globl _intr_disable +_intr_disable: + cli + ret + +.globl _intr_enable +_intr_enable: + sti + ret diff --git a/lib/libc/arch/i386/misc/io_intr.s b/lib/libc/arch/i386/misc/io_intr.s deleted file mode 100644 index f29277089..000000000 --- a/lib/libc/arch/i386/misc/io_intr.s +++ /dev/null @@ -1,16 +0,0 @@ -! intr_disable(), intr_enable - Disable/Enable hardware interrupts. -! Author: Kees J. Bot -! 18 Mar 1996 -! void intr_disable(void); -! void intr_enable(void); - -.sect .text -.define _intr_disable -_intr_disable: - cli - ret - -.define _intr_enable -_intr_enable: - sti - ret diff --git a/lib/libc/arch/i386/misc/io_inw.S b/lib/libc/arch/i386/misc/io_inw.S new file mode 100644 index 000000000..8bfdc1fa7 --- /dev/null +++ b/lib/libc/arch/i386/misc/io_inw.S @@ -0,0 +1,14 @@ +/* inw() - Input one word Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* unsigned inw(U16_t port); */ + +.text +.globl _inw +_inw: + push %ebp + movl %esp, %ebp + movl 8(%ebp), %edx /* port */ + xorl %eax, %eax + inw %dx /* read 1 word */ + pop %ebp + ret diff --git a/lib/libc/arch/i386/misc/io_inw.s b/lib/libc/arch/i386/misc/io_inw.s deleted file mode 100644 index 773943711..000000000 --- a/lib/libc/arch/i386/misc/io_inw.s +++ /dev/null @@ -1,14 +0,0 @@ -! inw() - Input one word Author: Kees J. Bot -! 18 Mar 1996 -! unsigned inw(U16_t port); - -.sect .text -.define _inw -_inw: - push ebp - mov ebp, esp - mov edx, 8(ebp) ! port - xor eax, eax - o16 in dx ! read 1 word - pop ebp - ret diff --git a/lib/libc/arch/i386/misc/io_outb.S b/lib/libc/arch/i386/misc/io_outb.S new file mode 100644 index 000000000..302868ad4 --- /dev/null +++ b/lib/libc/arch/i386/misc/io_outb.S @@ -0,0 +1,14 @@ +/* outb() - Output one byte Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* void outb(U16_t port, U8_t value); */ + +.text +.globl _outb +_outb: + push %ebp + movl %esp, %ebp + movl 8(%ebp), %edx /* port */ + movl 8+4(%ebp), %eax /* value */ + outb %dx /* output 1 byte */ + pop %ebp + ret diff --git a/lib/libc/arch/i386/misc/io_outb.s b/lib/libc/arch/i386/misc/io_outb.s deleted file mode 100644 index 0ae7b06f1..000000000 --- a/lib/libc/arch/i386/misc/io_outb.s +++ /dev/null @@ -1,14 +0,0 @@ -! outb() - Output one byte Author: Kees J. Bot -! 18 Mar 1996 -! void outb(U16_t port, U8_t value); - -.sect .text -.define _outb -_outb: - push ebp - mov ebp, esp - mov edx, 8(ebp) ! port - mov eax, 8+4(ebp) ! value - outb dx ! output 1 byte - pop ebp - ret diff --git a/lib/libc/arch/i386/misc/io_outl.S b/lib/libc/arch/i386/misc/io_outl.S new file mode 100644 index 000000000..0b67fa1cb --- /dev/null +++ b/lib/libc/arch/i386/misc/io_outl.S @@ -0,0 +1,14 @@ +/* outl() - Output one dword Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* void outl(U16_t port, u32_t value); */ + +.text +.globl _outl +_outl: + push %ebp + movl %esp, %ebp + movl 8(%ebp), %edx /* port */ + movl 8+4(%ebp), %eax /* value */ + outl %dx /* output 1 dword */ + pop %ebp + ret diff --git a/lib/libc/arch/i386/misc/io_outl.s b/lib/libc/arch/i386/misc/io_outl.s deleted file mode 100644 index 1a414448e..000000000 --- a/lib/libc/arch/i386/misc/io_outl.s +++ /dev/null @@ -1,14 +0,0 @@ -! outl() - Output one dword Author: Kees J. Bot -! 18 Mar 1996 -! void outl(U16_t port, u32_t value); - -.sect .text -.define _outl -_outl: - push ebp - mov ebp, esp - mov edx, 8(ebp) ! port - mov eax, 8+4(ebp) ! value - out dx ! output 1 dword - pop ebp - ret diff --git a/lib/libc/arch/i386/misc/io_outsb.S b/lib/libc/arch/i386/misc/io_outsb.S new file mode 100644 index 000000000..cee7e395a --- /dev/null +++ b/lib/libc/arch/i386/misc/io_outsb.S @@ -0,0 +1,18 @@ +/* outsb() - Output a byte array Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* void outsb(U16_t port, void *buf, size_t count); */ + +.text +.globl _outsb +_outsb: + push %ebp + movl %esp, %ebp + cld + push %esi + movl 8(%ebp), %edx /* port */ + movl 12(%ebp), %esi /* buf */ + movl 16(%ebp), %ecx /* byte count */ + rep outsb /* output many bytes */ + pop %esi + pop %ebp + ret diff --git a/lib/libc/arch/i386/misc/io_outsb.s b/lib/libc/arch/i386/misc/io_outsb.s deleted file mode 100644 index d3789cc00..000000000 --- a/lib/libc/arch/i386/misc/io_outsb.s +++ /dev/null @@ -1,18 +0,0 @@ -! outsb() - Output a byte array Author: Kees J. Bot -! 18 Mar 1996 -! void outsb(U16_t port, void *buf, size_t count); - -.sect .text -.define _outsb -_outsb: - push ebp - mov ebp, esp - cld - push esi - mov edx, 8(ebp) ! port - mov esi, 12(ebp) ! buf - mov ecx, 16(ebp) ! byte count - rep outsb ! output many bytes - pop esi - pop ebp - ret diff --git a/lib/libc/arch/i386/misc/io_outsl.S b/lib/libc/arch/i386/misc/io_outsl.S new file mode 100644 index 000000000..e2e640da5 --- /dev/null +++ b/lib/libc/arch/i386/misc/io_outsl.S @@ -0,0 +1,19 @@ +/* outsl() - Output a dword array Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* void outsl(U16_t port, void *buf, size_t count); */ + +.text +.globl _outsl +_outsl: + push %ebp + movl %esp, %ebp + cld + push %esi + movl 8(%ebp), %edx /* port */ + movl 12(%ebp), %esi /* buf */ + movl 16(%ebp), %ecx /* byte count */ + shrl $2, %ecx /* dword count */ + rep outsl /* output many dwords */ + pop %esi + pop %ebp + ret diff --git a/lib/libc/arch/i386/misc/io_outsl.s b/lib/libc/arch/i386/misc/io_outsl.s deleted file mode 100644 index a57eba7c1..000000000 --- a/lib/libc/arch/i386/misc/io_outsl.s +++ /dev/null @@ -1,19 +0,0 @@ -! outsl() - Output a dword array Author: Kees J. Bot -! 18 Mar 1996 -! void outsl(U16_t port, void *buf, size_t count); - -.sect .text -.define _outsl -_outsl: - push ebp - mov ebp, esp - cld - push esi - mov edx, 8(ebp) ! port - mov esi, 12(ebp) ! buf - mov ecx, 16(ebp) ! byte count - shr ecx, 2 ! dword count - rep outs ! output many dwords - pop esi - pop ebp - ret diff --git a/lib/libc/arch/i386/misc/io_outsw.S b/lib/libc/arch/i386/misc/io_outsw.S new file mode 100644 index 000000000..25bee2c70 --- /dev/null +++ b/lib/libc/arch/i386/misc/io_outsw.S @@ -0,0 +1,19 @@ +/* outsw() - Output a word array Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* void outsw(U16_t port, void *buf, size_t count); */ + +.text +.globl _outsw +_outsw: + push %ebp + movl %esp, %ebp + cld + push %esi + movl 8(%ebp), %edx /* port */ + movl 12(%ebp), %esi /* buf */ + movl 16(%ebp), %ecx /* byte count */ + shrl $1, %ecx /* word count */ + rep outsw /* output many words */ + pop %esi + pop %ebp + ret diff --git a/lib/libc/arch/i386/misc/io_outsw.s b/lib/libc/arch/i386/misc/io_outsw.s deleted file mode 100644 index dc4f1bf93..000000000 --- a/lib/libc/arch/i386/misc/io_outsw.s +++ /dev/null @@ -1,19 +0,0 @@ -! outsw() - Output a word array Author: Kees J. Bot -! 18 Mar 1996 -! void outsw(U16_t port, void *buf, size_t count); - -.sect .text -.define _outsw -_outsw: - push ebp - mov ebp, esp - cld - push esi - mov edx, 8(ebp) ! port - mov esi, 12(ebp) ! buf - mov ecx, 16(ebp) ! byte count - shr ecx, 1 ! word count -rep o16 outs ! output many words - pop esi - pop ebp - ret diff --git a/lib/libc/arch/i386/misc/io_outw.S b/lib/libc/arch/i386/misc/io_outw.S new file mode 100644 index 000000000..165c3cabb --- /dev/null +++ b/lib/libc/arch/i386/misc/io_outw.S @@ -0,0 +1,14 @@ +/* outw() - Output one word Author: Kees J. Bot */ +/* 18 Mar 1996 */ +/* void outw(U16_t port, U16_t value); */ + +.text +.globl _outw +_outw: + push %ebp + movl %esp, %ebp + movl 8(%ebp), %edx /* port */ + movl 8+4(%ebp), %eax /* value */ + outw %dx /* output 1 word */ + pop %ebp + ret diff --git a/lib/libc/arch/i386/misc/io_outw.s b/lib/libc/arch/i386/misc/io_outw.s deleted file mode 100644 index 88a04567e..000000000 --- a/lib/libc/arch/i386/misc/io_outw.s +++ /dev/null @@ -1,14 +0,0 @@ -! outw() - Output one word Author: Kees J. Bot -! 18 Mar 1996 -! void outw(U16_t port, U16_t value); - -.sect .text -.define _outw -_outw: - push ebp - mov ebp, esp - mov edx, 8(ebp) ! port - mov eax, 8+4(ebp) ! value - o16 out dx ! output 1 word - pop ebp - ret diff --git a/lib/libc/arch/i386/misc/oneC_sum.S b/lib/libc/arch/i386/misc/oneC_sum.S new file mode 100644 index 000000000..0d162d3f9 --- /dev/null +++ b/lib/libc/arch/i386/misc/oneC_sum.S @@ -0,0 +1,91 @@ +/* oneC_sum() - One complement`s checksum Author: Kees J. Bot */ +/* 9 May 1995 */ +/* See RFC 1071, "Computing the Internet checksum" */ +/* See also the C version of this code. */ + +.text + +.globl _oneC_sum +.balign 16 +_oneC_sum: + push %ebp + movl %esp, %ebp + push %esi + push %edi + movzwl 8(%ebp), %eax /* Checksum of previous block */ + movl 12(%ebp), %esi /* Data to compute checksum over */ + movl 16(%ebp), %edi /* Number of bytes */ + + xorl %edx, %edx + xorb %cl, %cl +align: + testl $3, %esi /* Is the data aligned? */ + je aligned + testl %edi, %edi + je 0f + movb (%esi), %dl /* Rotate the first unaligned bytes */ + decl %edi /* into the edx register */ +0: + incl %esi + rorl $8, %edx + rorl $8, %eax /* Rotate the checksum likewise */ + addb $8, %cl /* Number of bits rotated */ + jmp align +aligned: + addl %edx, %eax /* Summate the unaligned bytes */ + adcl $0, %eax /* Add carry back in for one`s complement */ + + jmp add6test +.balign 16 +add6: + addl (%esi), %eax /* Six times unrolled loop, see below */ + adcl 4(%esi), %eax + adcl 8(%esi), %eax + adcl 12(%esi), %eax + adcl 16(%esi), %eax + adcl 20(%esi), %eax + adcl $0, %eax + addl $24, %esi +add6test: + subl $24, %edi + jae add6 + addl $24, %edi + + jmp add1test +.balign 16 +add1: + addl (%esi), %eax /* while ((edi -= 4) >= 0) */ + adcl $0, %eax /* eax += *esi++; */ + addl $4, %esi /* edi += 4; */ +add1test: + subl $4, %edi + jae add1 + addl $4, %edi + + je done /* Are there extra bytes? */ + movl (%esi), %edx /* Load extra bytes in a full dword */ + andl mask-4(,%edi,4), %edx /* Mask off excess */ + addl %edx, %eax /* Add in the last bits */ + adcl $0, %eax +done: + roll %cl, %eax /* Undo the rotation at the beginning */ + movl %eax, %edx + shrl $16, %eax + addw %dx, %ax /* Add the two words in eax to form */ + adcw $0, %ax /* a 16 bit sum */ + pop %edi + pop %esi + pop %ebp + ret + +#ifdef __ACK__ +.rom +#else +.data +#endif +.balign 4 +mask: +.long 0x000000FF, 0x0000FFFF, 0x00FFFFFF + +/* */ +/* $PchId: oneC_sum.ack.s,v 1.2 1996/03/12 19:33:51 philip Exp $ */ diff --git a/lib/libc/arch/i386/misc/oneC_sum.s b/lib/libc/arch/i386/misc/oneC_sum.s deleted file mode 100644 index bfc001d9b..000000000 --- a/lib/libc/arch/i386/misc/oneC_sum.s +++ /dev/null @@ -1,80 +0,0 @@ -! oneC_sum() - One complement`s checksum Author: Kees J. Bot -! 9 May 1995 -! See RFC 1071, "Computing the Internet checksum" -! See also the C version of this code. - -.sect .text - -.define _oneC_sum - .align 16 -_oneC_sum: - push ebp - mov ebp, esp - push esi - push edi - movzx eax, 8(ebp) ! Checksum of previous block - mov esi, 12(ebp) ! Data to compute checksum over - mov edi, 16(ebp) ! Number of bytes - - xor edx, edx - xorb cl, cl -align: test esi, 3 ! Is the data aligned? - jz aligned - test edi, edi - jz 0f - movb dl, (esi) ! Rotate the first unaligned bytes - dec edi ! into the edx register -0: inc esi - ror edx, 8 - ror eax, 8 ! Rotate the checksum likewise - addb cl, 8 ! Number of bits rotated - jmp align -aligned:add eax, edx ! Summate the unaligned bytes - adc eax, 0 ! Add carry back in for one`s complement - - jmp add6test - .align 16 -add6: add eax, (esi) ! Six times unrolled loop, see below - adc eax, 4(esi) - adc eax, 8(esi) - adc eax, 12(esi) - adc eax, 16(esi) - adc eax, 20(esi) - adc eax, 0 - add esi, 24 -add6test: - sub edi, 24 - jae add6 - add edi, 24 - - jmp add1test - .align 16 -add1: add eax, (esi) ! while ((edi -= 4) >= 0) - adc eax, 0 ! eax += *esi++; - add esi, 4 ! edi += 4; -add1test: - sub edi, 4 - jae add1 - add edi, 4 - - jz done ! Are there extra bytes? - mov edx, (esi) ! Load extra bytes in a full dword - and edx, mask-4(edi*4) ! Mask off excess - add eax, edx ! Add in the last bits - adc eax, 0 -done: rol eax, cl ! Undo the rotation at the beginning - mov edx, eax - shr eax, 16 - o16 add ax, dx ! Add the two words in eax to form - o16 adc ax, 0 ! a 16 bit sum - pop edi - pop esi - pop ebp - ret - -.sect .rom - .align 4 -mask: .data4 0x000000FF, 0x0000FFFF, 0x00FFFFFF - -! -! $PchId: oneC_sum.ack.s,v 1.2 1996/03/12 19:33:51 philip Exp $ diff --git a/lib/libc/arch/i386/rts/Makefile.inc b/lib/libc/arch/i386/rts/Makefile.inc index 17610804b..99195247c 100644 --- a/lib/libc/arch/i386/rts/Makefile.inc +++ b/lib/libc/arch/i386/rts/Makefile.inc @@ -2,7 +2,7 @@ .PATH: ${.CURDIR}/arch/${ARCH}/rts SRCS+= \ - __sigreturn.s \ - _ipc.s \ - _senda.s \ - brksize.s + __sigreturn.S \ + _ipc.S \ + _senda.S \ + brksize.S diff --git a/lib/libc/arch/i386/rts/__sigreturn.S b/lib/libc/arch/i386/rts/__sigreturn.S new file mode 100644 index 000000000..66f5cf44f --- /dev/null +++ b/lib/libc/arch/i386/rts/__sigreturn.S @@ -0,0 +1,9 @@ +/* This routine is the low-level code for returning from signals. */ +/* It calls __sigreturn, which is the normal "system call" routine. */ +/* Both ___sigreturn and __sigreturn are needed. */ +.text +.globl ___sigreturn +.extern __sigreturn +___sigreturn: + addl $16, %esp + jmp __sigreturn diff --git a/lib/libc/arch/i386/rts/__sigreturn.s b/lib/libc/arch/i386/rts/__sigreturn.s deleted file mode 100644 index 783d34f33..000000000 --- a/lib/libc/arch/i386/rts/__sigreturn.s +++ /dev/null @@ -1,10 +0,0 @@ -! This routine is the low-level code for returning from signals. -! It calls __sigreturn, which is the normal "system call" routine. -! Both ___sigreturn and __sigreturn are needed. -.sect .text; .sect .rom; .sect .data; .sect .bss -.sect .text -.define ___sigreturn -.extern __sigreturn -___sigreturn: - add esp, 16 - jmp __sigreturn diff --git a/lib/libc/arch/i386/rts/_ipc.S b/lib/libc/arch/i386/rts/_ipc.S new file mode 100644 index 000000000..515603b71 --- /dev/null +++ b/lib/libc/arch/i386/rts/_ipc.S @@ -0,0 +1,83 @@ +.globl __notify, __send, __senda, __sendnb, __receive, __sendrec, __do_kernel_call + +/* See src/kernel/ipc.h for C definitions */ + SEND = 1 + RECEIVE = 2 + SENDREC = 3 + NOTIFY = 4 + SENDNB = 5 + IPCVEC = 33 /* ipc trap to kernel */ + KERVEC = 32 /* syscall trap to kernel */ + + SRC_DST = 8 /* source/ destination process */ + MESSAGE = 12 /* message pointer */ + +/**========================================================================* */ +/* IPC assembly routines * */ +/**========================================================================* */ +/* all message passing routines save ebp, but destroy eax and ecx. */ +.text +__send: + push %ebp + movl %esp, %ebp + push %ebx + movl SRC_DST(%ebp), %eax /* eax = dest-src */ + movl MESSAGE(%ebp), %ebx /* ebx = message pointer */ + movl $SEND, %ecx /* _send(dest, ptr) */ + int $IPCVEC /* trap to the kernel */ + pop %ebx + pop %ebp + ret + +__receive: + push %ebp + movl %esp, %ebp + push %ebx + movl SRC_DST(%ebp), %eax /* eax = dest-src */ + movl MESSAGE(%ebp), %ebx /* ebx = message pointer */ + movl $RECEIVE, %ecx /* _receive(src, ptr) */ + int $IPCVEC /* trap to the kernel */ + pop %ebx + pop %ebp + ret + +__sendrec: + push %ebp + movl %esp, %ebp + push %ebx + movl SRC_DST(%ebp), %eax /* eax = dest-src */ + movl MESSAGE(%ebp), %ebx /* ebx = message pointer */ + movl $SENDREC, %ecx /* _sendrec(srcdest, ptr) */ + int $IPCVEC /* trap to the kernel */ + pop %ebx + pop %ebp + ret + +__notify: + push %ebp + movl %esp, %ebp + push %ebx + movl SRC_DST(%ebp), %eax /* eax = destination */ + movl $NOTIFY, %ecx /* _notify(srcdst) */ + int $IPCVEC /* trap to the kernel */ + pop %ebx + pop %ebp + ret + +__sendnb: + push %ebp + movl %esp, %ebp + push %ebx + movl SRC_DST(%ebp), %eax /* eax = dest-src */ + movl MESSAGE(%ebp), %ebx /* ebx = message pointer */ + movl $SENDNB, %ecx /* _sendnb(dest, ptr) */ + int $IPCVEC /* trap to the kernel */ + pop %ebx + pop %ebp + ret + +__do_kernel_call: + /* pass the message pointer to kernel in the %eax register */ + movl 4(%esp), %eax + int $KERVEC + ret diff --git a/lib/libc/arch/i386/rts/_ipc.s b/lib/libc/arch/i386/rts/_ipc.s deleted file mode 100644 index 38a33d441..000000000 --- a/lib/libc/arch/i386/rts/_ipc.s +++ /dev/null @@ -1,84 +0,0 @@ -.sect .text; .sect .rom; .sect .data; .sect .bss -.define __notify, __send, __senda, __sendnb, __receive, __sendrec, __do_kernel_call - -! See src/kernel/ipc.h for C definitions -SEND = 1 -RECEIVE = 2 -SENDREC = 3 -NOTIFY = 4 -SENDNB = 5 -IPCVEC = 33 ! ipc trap to kernel -KERVEC = 32 ! syscall trap to kernel - -SRC_DST = 8 ! source/ destination process -MESSAGE = 12 ! message pointer - -!*========================================================================* -! IPC assembly routines * -!*========================================================================* -! all message passing routines save ebp, but destroy eax and ecx. -.sect .text -__send: - push ebp - mov ebp, esp - push ebx - mov eax, SRC_DST(ebp) ! eax = dest-src - mov ebx, MESSAGE(ebp) ! ebx = message pointer - mov ecx, SEND ! _send(dest, ptr) - int IPCVEC ! trap to the kernel - pop ebx - pop ebp - ret - -__receive: - push ebp - mov ebp, esp - push ebx - mov eax, SRC_DST(ebp) ! eax = dest-src - mov ebx, MESSAGE(ebp) ! ebx = message pointer - mov ecx, RECEIVE ! _receive(src, ptr) - int IPCVEC ! trap to the kernel - pop ebx - pop ebp - ret - -__sendrec: - push ebp - mov ebp, esp - push ebx - mov eax, SRC_DST(ebp) ! eax = dest-src - mov ebx, MESSAGE(ebp) ! ebx = message pointer - mov ecx, SENDREC ! _sendrec(srcdest, ptr) - int IPCVEC ! trap to the kernel - pop ebx - pop ebp - ret - -__notify: - push ebp - mov ebp, esp - push ebx - mov eax, SRC_DST(ebp) ! eax = destination - mov ecx, NOTIFY ! _notify(srcdst) - int IPCVEC ! trap to the kernel - pop ebx - pop ebp - ret - -__sendnb: - push ebp - mov ebp, esp - push ebx - mov eax, SRC_DST(ebp) ! eax = dest-src - mov ebx, MESSAGE(ebp) ! ebx = message pointer - mov ecx, SENDNB ! _sendnb(dest, ptr) - int IPCVEC ! trap to the kernel - pop ebx - pop ebp - ret - -__do_kernel_call: - ! pass the message pointer to kernel in the %eax register - mov eax, 4(esp) - int KERVEC - ret diff --git a/lib/libc/arch/i386/rts/_senda.S b/lib/libc/arch/i386/rts/_senda.S new file mode 100644 index 000000000..3b5deec41 --- /dev/null +++ b/lib/libc/arch/i386/rts/_senda.S @@ -0,0 +1,21 @@ +.globl __senda + + SENDA = 16 + SYSVEC = 33 + + MSGTAB = 8 /* message table */ + TABCOUNT = 12 /* number of entries in message table */ + +.text + +__senda: + push %ebp + movl %esp, %ebp + push %ebx + movl TABCOUNT(%ebp), %eax /* eax = count */ + movl MSGTAB(%ebp), %ebx /* ebx = table */ + movl $SENDA, %ecx /* _senda(table, count) */ + int $SYSVEC /* trap to the kernel */ + pop %ebx + pop %ebp + ret diff --git a/lib/libc/arch/i386/rts/_senda.s b/lib/libc/arch/i386/rts/_senda.s deleted file mode 100644 index 703411e9e..000000000 --- a/lib/libc/arch/i386/rts/_senda.s +++ /dev/null @@ -1,22 +0,0 @@ -.sect .text; .sect .rom; .sect .data; .sect .bss -.define __senda - -SENDA = 16 -SYSVEC = 33 - -MSGTAB = 8 ! message table -TABCOUNT = 12 ! number of entries in message table - -.sect .text - -__senda: - push ebp - mov ebp, esp - push ebx - mov eax, TABCOUNT(ebp) ! eax = count - mov ebx, MSGTAB(ebp) ! ebx = table - mov ecx, SENDA ! _senda(table, count) - int SYSVEC ! trap to the kernel - pop ebx - pop ebp - ret diff --git a/lib/libc/arch/i386/rts/brksize.S b/lib/libc/arch/i386/rts/brksize.S new file mode 100644 index 000000000..43b3033b2 --- /dev/null +++ b/lib/libc/arch/i386/rts/brksize.S @@ -0,0 +1,5 @@ +.globl __brksize +.data +.extern endbss, __brksize +__brksize: +.long endbss diff --git a/lib/libc/arch/i386/rts/brksize.s b/lib/libc/arch/i386/rts/brksize.s deleted file mode 100644 index b24888b4c..000000000 --- a/lib/libc/arch/i386/rts/brksize.s +++ /dev/null @@ -1,5 +0,0 @@ -.sect .text; .sect .rom; .sect .data; .sect .bss -.define __brksize -.sect .data -.extern endbss, __brksize -__brksize: .data4 endbss diff --git a/lib/libc/arch/i386/string/Makefile.inc b/lib/libc/arch/i386/string/Makefile.inc index 8cc3e077f..b01f09f72 100644 --- a/lib/libc/arch/i386/string/Makefile.inc +++ b/lib/libc/arch/i386/string/Makefile.inc @@ -2,28 +2,28 @@ .PATH: ${.CURDIR}/arch/${ARCH}/string SRCS+= \ - _memmove.s \ - _strncat.s \ - _strncmp.s \ - _strncpy.s \ - _strnlen.s \ - bcmp.s \ - bcopy.s \ - bzero.s \ - index.s \ - memchr.s \ - memcmp.s \ - memcpy.s \ - memmove.s \ - memset.s \ - rindex.s \ - strcat.s \ - strchr.s \ - strcmp.s \ - strcpy.s \ - strlen.s \ - strncat.s \ - strncmp.s \ - strncpy.s \ - strnlen.s \ - strrchr.s + _memmove.S \ + _strncat.S \ + _strncmp.S \ + _strncpy.S \ + _strnlen.S \ + bcmp.S \ + bcopy.S \ + bzero.S \ + index.S \ + memchr.S \ + memcmp.S \ + memcpy.S \ + memmove.S \ + memset.S \ + rindex.S \ + strcat.S \ + strchr.S \ + strcmp.S \ + strcpy.S \ + strlen.S \ + strncat.S \ + strncmp.S \ + strncpy.S \ + strnlen.S \ + strrchr.S diff --git a/lib/libc/arch/i386/string/_memmove.S b/lib/libc/arch/i386/string/_memmove.S new file mode 100644 index 000000000..0fa693f3c --- /dev/null +++ b/lib/libc/arch/i386/string/_memmove.S @@ -0,0 +1,60 @@ +/* _memmove() Author: Kees J. Bot */ +/* 2 Jan 1994 */ + +/* void *_memmove(void *s1, const void *s2, size_t n) */ +/* Copy a chunk of memory. Handle overlap. */ +/* */ +.text +.globl __memmove, __memcpy +.balign 16 +__memmove: + push %ebp + movl %esp, %ebp + push %esi + push %edi + movl 8(%ebp), %edi /* String s1 */ + movl 12(%ebp), %esi /* String s2 */ + movl 16(%ebp), %ecx /* Length */ + movl %edi, %eax + subl %esi, %eax + cmpl %ecx, %eax + jb downwards /* if (s2 - s1) < n then copy downwards */ +__memcpy: + cld /* Clear direction bit: upwards */ + cmpl $16, %ecx + jb upbyte /* Don't bother being smart with short arrays */ + movl %esi, %eax + orl %edi, %eax + testb $1, %al + jne upbyte /* Bit 0 set, use byte copy */ + testb $2, %al + jne upword /* Bit 1 set, use word copy */ +uplword: + shrdl $2, %ecx, %eax /* Save low 2 bits of ecx in eax */ + shrl $2, %ecx + + rep movsl /* Copy longwords. */ + shldl $2, %eax, %ecx /* Restore excess count */ +upword: + shrl $1, %ecx + + rep movsw /* Copy words */ + adcl %ecx, %ecx /* One more byte? */ +upbyte: + rep movsb /* Copy bytes */ +done: + movl 8(%ebp), %eax /* Absolutely noone cares about this value */ + pop %edi + pop %esi + pop %ebp + ret + +/* Handle bad overlap by copying downwards, don't bother to do word copies. */ +downwards: + std /* Set direction bit: downwards */ + leal -1(%esi,%ecx,1), %esi + leal -1(%edi,%ecx,1), %edi + + rep movsb /* Copy bytes */ + cld + jmp done diff --git a/lib/libc/arch/i386/string/_memmove.s b/lib/libc/arch/i386/string/_memmove.s deleted file mode 100644 index 45336400f..000000000 --- a/lib/libc/arch/i386/string/_memmove.s +++ /dev/null @@ -1,58 +0,0 @@ -! _memmove() Author: Kees J. Bot -! 2 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! void *_memmove(void *s1, const void *s2, size_t n) -! Copy a chunk of memory. Handle overlap. -! -.sect .text -.define __memmove, __memcpy - .align 16 -__memmove: - push ebp - mov ebp, esp - push esi - push edi - mov edi, 8(ebp) ! String s1 - mov esi, 12(ebp) ! String s2 - mov ecx, 16(ebp) ! Length - mov eax, edi - sub eax, esi - cmp eax, ecx - jb downwards ! if (s2 - s1) < n then copy downwards -__memcpy: - cld ! Clear direction bit: upwards - cmp ecx, 16 - jb upbyte ! Don't bother being smart with short arrays - mov eax, esi - or eax, edi - testb al, 1 - jnz upbyte ! Bit 0 set, use byte copy - testb al, 2 - jnz upword ! Bit 1 set, use word copy -uplword:shrd eax, ecx, 2 ! Save low 2 bits of ecx in eax - shr ecx, 2 - rep - movs ! Copy longwords. - shld ecx, eax, 2 ! Restore excess count -upword: shr ecx, 1 - rep - o16 movs ! Copy words - adc ecx, ecx ! One more byte? -upbyte: rep - movsb ! Copy bytes -done: mov eax, 8(ebp) ! Absolutely noone cares about this value - pop edi - pop esi - pop ebp - ret - -! Handle bad overlap by copying downwards, don't bother to do word copies. -downwards: - std ! Set direction bit: downwards - lea esi, -1(esi)(ecx*1) - lea edi, -1(edi)(ecx*1) - rep - movsb ! Copy bytes - cld - jmp done diff --git a/lib/libc/arch/i386/string/_strncat.S b/lib/libc/arch/i386/string/_strncat.S new file mode 100644 index 000000000..aaa62f07f --- /dev/null +++ b/lib/libc/arch/i386/string/_strncat.S @@ -0,0 +1,41 @@ +/* _strncat() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* char *_strncat(char *s1, const char *s2, size_t edx) */ +/* Append string s2 to s1. */ +/* */ +.text +.globl __strncat +.balign 16 +__strncat: + push %ebp + movl %esp, %ebp + push %esi + push %edi + movl 8(%ebp), %edi /* String s1 */ + movl $-1, %ecx + xorb %al, %al /* Null byte */ + cld + + repne scasb /* Look for the zero byte in s1 */ + decl %edi /* Back one up (and clear 'Z' flag) */ + push %edi /* Save end of s1 */ + movl 12(%ebp), %edi /* edi = string s2 */ + movl %edx, %ecx /* Maximum count */ + + repne scasb /* Look for the end of s2 */ + jne no0 + incl %ecx /* Exclude null byte */ +no0: + subl %ecx, %edx /* Number of bytes in s2 */ + movl %edx, %ecx + movl 12(%ebp), %esi /* esi = string s2 */ + pop %edi /* edi = end of string s1 */ + + rep movsb /* Copy bytes */ + stosb /* Add a terminating null */ + movl 8(%ebp), %eax /* Return s1 */ + pop %edi + pop %esi + pop %ebp + ret diff --git a/lib/libc/arch/i386/string/_strncat.s b/lib/libc/arch/i386/string/_strncat.s deleted file mode 100644 index 6c9873bf0..000000000 --- a/lib/libc/arch/i386/string/_strncat.s +++ /dev/null @@ -1,41 +0,0 @@ -! _strncat() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! char *_strncat(char *s1, const char *s2, size_t edx) -! Append string s2 to s1. -! -.sect .text -.define __strncat - .align 16 -__strncat: - push ebp - mov ebp, esp - push esi - push edi - mov edi, 8(ebp) ! String s1 - mov ecx, -1 - xorb al, al ! Null byte - cld - repne - scasb ! Look for the zero byte in s1 - dec edi ! Back one up (and clear 'Z' flag) - push edi ! Save end of s1 - mov edi, 12(ebp) ! edi = string s2 - mov ecx, edx ! Maximum count - repne - scasb ! Look for the end of s2 - jne no0 - inc ecx ! Exclude null byte -no0: sub edx, ecx ! Number of bytes in s2 - mov ecx, edx - mov esi, 12(ebp) ! esi = string s2 - pop edi ! edi = end of string s1 - rep - movsb ! Copy bytes - stosb ! Add a terminating null - mov eax, 8(ebp) ! Return s1 - pop edi - pop esi - pop ebp - ret diff --git a/lib/libc/arch/i386/string/_strncmp.S b/lib/libc/arch/i386/string/_strncmp.S new file mode 100644 index 000000000..c4f89705b --- /dev/null +++ b/lib/libc/arch/i386/string/_strncmp.S @@ -0,0 +1,35 @@ +/* strncmp() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* int strncmp(const char *s1, const char *s2, size_t ecx) */ +/* Compare two strings. */ +/* */ +.text +.globl __strncmp +.balign 16 +__strncmp: + push %ebp + movl %esp, %ebp + push %esi + push %edi + testl %ecx, %ecx /* Max length is zero? */ + je done + movl 8(%ebp), %esi /* esi = string s1 */ + movl 12(%ebp), %edi /* edi = string s2 */ + cld +compare: + cmpsb /* Compare two bytes */ + jne done + cmpb $0, -1(%esi) /* End of string? */ + je done + decl %ecx /* Length limit reached? */ + jne compare +done: + seta %al /* al = (s1 > s2) */ + setb %ah /* ah = (s1 < s2) */ + subb %ah, %al + movsbl %al, %eax /* eax = (s1 > s2) - (s1 < s2), i.e. -1, 0, 1 */ + pop %edi + pop %esi + pop %ebp + ret diff --git a/lib/libc/arch/i386/string/_strncmp.s b/lib/libc/arch/i386/string/_strncmp.s deleted file mode 100644 index 8aea8d393..000000000 --- a/lib/libc/arch/i386/string/_strncmp.s +++ /dev/null @@ -1,35 +0,0 @@ -! strncmp() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! int strncmp(const char *s1, const char *s2, size_t ecx) -! Compare two strings. -! -.sect .text -.define __strncmp - .align 16 -__strncmp: - push ebp - mov ebp, esp - push esi - push edi - test ecx, ecx ! Max length is zero? - je done - mov esi, 8(ebp) ! esi = string s1 - mov edi, 12(ebp) ! edi = string s2 - cld -compare: - cmpsb ! Compare two bytes - jne done - cmpb -1(esi), 0 ! End of string? - je done - dec ecx ! Length limit reached? - jne compare -done: seta al ! al = (s1 > s2) - setb ah ! ah = (s1 < s2) - subb al, ah - movsxb eax, al ! eax = (s1 > s2) - (s1 < s2), i.e. -1, 0, 1 - pop edi - pop esi - pop ebp - ret diff --git a/lib/libc/arch/i386/string/_strncpy.S b/lib/libc/arch/i386/string/_strncpy.S new file mode 100644 index 000000000..63bd6fcee --- /dev/null +++ b/lib/libc/arch/i386/string/_strncpy.S @@ -0,0 +1,23 @@ +/* _strncpy() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* char *_strncpy(char *s1, const char *s2, size_t ecx) */ +/* Copy string s2 to s1. */ +/* */ +.text +.globl __strncpy +.balign 16 +__strncpy: + movl 12(%ebp), %edi /* edi = string s2 */ + xorb %al, %al /* Look for a zero byte */ + movl %ecx, %edx /* Save maximum count */ + cld + + repne scasb /* Look for end of s2 */ + subl %ecx, %edx /* Number of bytes in s2 including null */ + xchgl %edx, %ecx + movl 12(%ebp), %esi /* esi = string s2 */ + movl 8(%ebp), %edi /* edi = string s1 */ + + rep movsb /* Copy bytes */ + ret diff --git a/lib/libc/arch/i386/string/_strncpy.s b/lib/libc/arch/i386/string/_strncpy.s deleted file mode 100644 index 15b8966ad..000000000 --- a/lib/libc/arch/i386/string/_strncpy.s +++ /dev/null @@ -1,24 +0,0 @@ -! _strncpy() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! char *_strncpy(char *s1, const char *s2, size_t ecx) -! Copy string s2 to s1. -! -.sect .text -.define __strncpy - .align 16 -__strncpy: - mov edi, 12(ebp) ! edi = string s2 - xorb al, al ! Look for a zero byte - mov edx, ecx ! Save maximum count - cld - repne - scasb ! Look for end of s2 - sub edx, ecx ! Number of bytes in s2 including null - xchg ecx, edx - mov esi, 12(ebp) ! esi = string s2 - mov edi, 8(ebp) ! edi = string s1 - rep - movsb ! Copy bytes - ret diff --git a/lib/libc/arch/i386/string/_strnlen.S b/lib/libc/arch/i386/string/_strnlen.S new file mode 100644 index 000000000..46bbf7dc0 --- /dev/null +++ b/lib/libc/arch/i386/string/_strnlen.S @@ -0,0 +1,28 @@ +/* _strnlen() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* size_t _strnlen(const char *s, size_t ecx) */ +/* Return the length of a string. */ +/* */ +.text +.globl __strnlen +.balign 16 +__strnlen: + push %ebp + movl %esp, %ebp + push %edi + movl 8(%ebp), %edi /* edi = string */ + xorb %al, %al /* Look for a zero byte */ + movl %ecx, %edx /* Save maximum count */ + cmpb $1, %cl /* 'Z' bit must be clear if ecx = 0 */ + cld + + repne scasb /* Look for zero */ + jne no0 + incl %ecx /* Don't count zero byte */ +no0: + movl %edx, %eax + subl %ecx, %eax /* Compute bytes scanned */ + pop %edi + pop %ebp + ret diff --git a/lib/libc/arch/i386/string/_strnlen.s b/lib/libc/arch/i386/string/_strnlen.s deleted file mode 100644 index b17b37363..000000000 --- a/lib/libc/arch/i386/string/_strnlen.s +++ /dev/null @@ -1,28 +0,0 @@ -! _strnlen() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! size_t _strnlen(const char *s, size_t ecx) -! Return the length of a string. -! -.sect .text -.define __strnlen - .align 16 -__strnlen: - push ebp - mov ebp, esp - push edi - mov edi, 8(ebp) ! edi = string - xorb al, al ! Look for a zero byte - mov edx, ecx ! Save maximum count - cmpb cl, 1 ! 'Z' bit must be clear if ecx = 0 - cld - repne - scasb ! Look for zero - jne no0 - inc ecx ! Don't count zero byte -no0: mov eax, edx - sub eax, ecx ! Compute bytes scanned - pop edi - pop ebp - ret diff --git a/lib/libc/arch/i386/string/bcmp.S b/lib/libc/arch/i386/string/bcmp.S new file mode 100644 index 000000000..f976534b9 --- /dev/null +++ b/lib/libc/arch/i386/string/bcmp.S @@ -0,0 +1,28 @@ +/* bcmp() Author: Kees J. Bot */ +/* 2 Jan 1994 */ + +/* int bcmp(const void *s1, const void *s2, size_t n) */ +/* Compare two chunks of memory. */ +/* This is a BSD routine that escaped from the kernel. Don't use. */ +/* (Alas it is not without some use, it reports the number of bytes */ +/* after the bytes that are equal. So it can't be simply replaced.) */ +/* */ +.text +.globl _bcmp +.balign 16 +_bcmp: + push %ebp + movl %esp, %ebp + push 16(%ebp) + push 12(%ebp) + push 8(%ebp) + call _memcmp /* Let memcmp do the work */ + testl %eax, %eax + je equal + subl 8(%ebp), %edx /* Memcmp was nice enough to leave "esi" in edx */ + decl %edx /* Number of bytes that are equal */ + movl 16(%ebp), %eax + subl %edx, %eax /* Number of bytes that are unequal */ +equal: + leave + ret diff --git a/lib/libc/arch/i386/string/bcmp.s b/lib/libc/arch/i386/string/bcmp.s deleted file mode 100644 index e9f99c15b..000000000 --- a/lib/libc/arch/i386/string/bcmp.s +++ /dev/null @@ -1,28 +0,0 @@ -! bcmp() Author: Kees J. Bot -! 2 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! int bcmp(const void *s1, const void *s2, size_t n) -! Compare two chunks of memory. -! This is a BSD routine that escaped from the kernel. Don't use. -! (Alas it is not without some use, it reports the number of bytes -! after the bytes that are equal. So it can't be simply replaced.) -! -.sect .text -.define _bcmp - .align 16 -_bcmp: - push ebp - mov ebp, esp - push 16(ebp) - push 12(ebp) - push 8(ebp) - call _memcmp ! Let memcmp do the work - test eax, eax - jz equal - sub edx, 8(ebp) ! Memcmp was nice enough to leave "esi" in edx - dec edx ! Number of bytes that are equal - mov eax, 16(ebp) - sub eax, edx ! Number of bytes that are unequal -equal: leave - ret diff --git a/lib/libc/arch/i386/string/bcopy.S b/lib/libc/arch/i386/string/bcopy.S new file mode 100644 index 000000000..47540d291 --- /dev/null +++ b/lib/libc/arch/i386/string/bcopy.S @@ -0,0 +1,15 @@ +/* bcopy() Author: Kees J. Bot */ +/* 2 Jan 1994 */ + +/* void bcopy(const void *s1, void *s2, size_t n) */ +/* Copy a chunk of memory. Handle overlap. */ +/* This is a BSD routine that escaped from the kernel. Don't use. */ +/* */ +.text +.globl _bcopy +.balign 16 +_bcopy: + movl 4(%esp), %eax /* Exchange string arguments */ + xchgl 8(%esp), %eax + movl %eax, 4(%esp) + jmp __memmove /* Call the proper routine */ diff --git a/lib/libc/arch/i386/string/bcopy.s b/lib/libc/arch/i386/string/bcopy.s deleted file mode 100644 index dc6bf89f0..000000000 --- a/lib/libc/arch/i386/string/bcopy.s +++ /dev/null @@ -1,16 +0,0 @@ -! bcopy() Author: Kees J. Bot -! 2 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! void bcopy(const void *s1, void *s2, size_t n) -! Copy a chunk of memory. Handle overlap. -! This is a BSD routine that escaped from the kernel. Don't use. -! -.sect .text -.define _bcopy - .align 16 -_bcopy: - mov eax, 4(esp) ! Exchange string arguments - xchg eax, 8(esp) - mov 4(esp), eax - jmp __memmove ! Call the proper routine diff --git a/lib/libc/arch/i386/string/bzero.S b/lib/libc/arch/i386/string/bzero.S new file mode 100644 index 000000000..07f0db09e --- /dev/null +++ b/lib/libc/arch/i386/string/bzero.S @@ -0,0 +1,19 @@ +/* bzero() Author: Kees J. Bot */ +/* 2 Jan 1994 */ + +/* void bzero(void *s, size_t n) */ +/* Set a chunk of memory to zero. */ +/* This is a BSD routine that escaped from the kernel. Don't use. */ +/* */ +.text +.globl _bzero +.balign 16 +_bzero: + push %ebp + movl %esp, %ebp + push 12(%ebp) /* Size */ + push $0 /* Zero */ + push 8(%ebp) /* String */ + call _memset /* Call the proper routine */ + leave + ret diff --git a/lib/libc/arch/i386/string/bzero.s b/lib/libc/arch/i386/string/bzero.s deleted file mode 100644 index 4223472c5..000000000 --- a/lib/libc/arch/i386/string/bzero.s +++ /dev/null @@ -1,20 +0,0 @@ -! bzero() Author: Kees J. Bot -! 2 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! void bzero(void *s, size_t n) -! Set a chunk of memory to zero. -! This is a BSD routine that escaped from the kernel. Don't use. -! -.sect .text -.define _bzero - .align 16 -_bzero: - push ebp - mov ebp, esp - push 12(ebp) ! Size - push 0 ! Zero - push 8(ebp) ! String - call _memset ! Call the proper routine - leave - ret diff --git a/lib/libc/arch/i386/string/index.S b/lib/libc/arch/i386/string/index.S new file mode 100644 index 000000000..12ea7ea52 --- /dev/null +++ b/lib/libc/arch/i386/string/index.S @@ -0,0 +1,12 @@ +/* index() Author: Kees J. Bot */ +/* 2 Jan 1994 */ + +/* char *index(const char *s, int c) */ +/* Look for a character in a string. Has suffered from a hostile */ +/* takeover by strchr(). */ +/* */ +.text +.globl _index +.balign 16 +_index: + jmp _strchr diff --git a/lib/libc/arch/i386/string/index.s b/lib/libc/arch/i386/string/index.s deleted file mode 100644 index 704afe583..000000000 --- a/lib/libc/arch/i386/string/index.s +++ /dev/null @@ -1,13 +0,0 @@ -! index() Author: Kees J. Bot -! 2 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! char *index(const char *s, int c) -! Look for a character in a string. Has suffered from a hostile -! takeover by strchr(). -! -.sect .text -.define _index - .align 16 -_index: - jmp _strchr diff --git a/lib/libc/arch/i386/string/memchr.S b/lib/libc/arch/i386/string/memchr.S new file mode 100644 index 000000000..7607374fc --- /dev/null +++ b/lib/libc/arch/i386/string/memchr.S @@ -0,0 +1,30 @@ +/* memchr() Author: Kees J. Bot */ +/* 2 Jan 1994 */ + +/* void *memchr(const void *s, int c, size_t n) */ +/* Look for a character in a chunk of memory. */ +/* */ +.text +.globl _memchr +.balign 16 +_memchr: + push %ebp + movl %esp, %ebp + push %edi + movl 8(%ebp), %edi /* edi = string */ + movb 12(%ebp), %al /* The character to look for */ + movl 16(%ebp), %ecx /* Length */ + cmpb $1, %cl /* 'Z' bit must be clear if ecx = 0 */ + cld + + repne scasb + jne failure + leal -1(%edi), %eax /* Found */ + pop %edi + pop %ebp + ret +failure: + xorl %eax, %eax + pop %edi + pop %ebp + ret diff --git a/lib/libc/arch/i386/string/memchr.s b/lib/libc/arch/i386/string/memchr.s deleted file mode 100644 index 6eb3a678d..000000000 --- a/lib/libc/arch/i386/string/memchr.s +++ /dev/null @@ -1,30 +0,0 @@ -! memchr() Author: Kees J. Bot -! 2 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! void *memchr(const void *s, int c, size_t n) -! Look for a character in a chunk of memory. -! -.sect .text -.define _memchr - .align 16 -_memchr: - push ebp - mov ebp, esp - push edi - mov edi, 8(ebp) ! edi = string - movb al, 12(ebp) ! The character to look for - mov ecx, 16(ebp) ! Length - cmpb cl, 1 ! 'Z' bit must be clear if ecx = 0 - cld - repne - scasb - jne failure - lea eax, -1(edi) ! Found - pop edi - pop ebp - ret -failure:xor eax, eax - pop edi - pop ebp - ret diff --git a/lib/libc/arch/i386/string/memcmp.S b/lib/libc/arch/i386/string/memcmp.S new file mode 100644 index 000000000..6a2c5a97d --- /dev/null +++ b/lib/libc/arch/i386/string/memcmp.S @@ -0,0 +1,58 @@ +/* memcmp() Author: Kees J. Bot */ +/* 2 Jan 1994 */ + +/* int memcmp(const void *s1, const void *s2, size_t n) */ +/* Compare two chunks of memory. */ +/* */ +.text +.globl _memcmp +.balign 16 +_memcmp: + cld + push %ebp + movl %esp, %ebp + push %esi + push %edi + movl 8(%ebp), %esi /* String s1 */ + movl 12(%ebp), %edi /* String s2 */ + movl 16(%ebp), %ecx /* Length */ + cmpl $16, %ecx + jb cbyte /* Don't bother being smart with short arrays */ + movl %esi, %eax + orl %edi, %eax + testb $1, %al + jne cbyte /* Bit 0 set, use byte compare */ + testb $2, %al + jne cword /* Bit 1 set, use word compare */ +clword: + shrdl $2, %ecx, %eax /* Save low two bits of ecx in eax */ + shrl $2, %ecx + + repe cmpsl /* Compare longwords */ + subl $4, %esi + subl $4, %edi + incl %ecx /* Recompare the last longword */ + shldl $2, %eax, %ecx /* And any excess bytes */ + jmp last +cword: + shrdl $1, %ecx, %eax /* Save low bit of ecx in eax */ + shrl $1, %ecx + + repe cmpsw /* Compare words */ + subl $2, %esi + subl $2, %edi + incl %ecx /* Recompare the last word */ + shldl $1, %eax, %ecx /* And one more byte? */ +cbyte: + testl %ecx, %ecx /* Set 'Z' flag if ecx = 0 */ +last: + repe cmpsb /* Look for the first differing byte */ + seta %al /* al = (s1 > s2) */ + setb %ah /* ah = (s1 < s2) */ + subb %ah, %al + movsbl %al, %eax /* eax = (s1 > s2) - (s1 < s2), i.e. -1, 0, 1 */ + movl %esi, %edx /* For bcmp() to play with */ + pop %edi + pop %esi + pop %ebp + ret diff --git a/lib/libc/arch/i386/string/memcmp.s b/lib/libc/arch/i386/string/memcmp.s deleted file mode 100644 index 6ac8e35c1..000000000 --- a/lib/libc/arch/i386/string/memcmp.s +++ /dev/null @@ -1,56 +0,0 @@ -! memcmp() Author: Kees J. Bot -! 2 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! int memcmp(const void *s1, const void *s2, size_t n) -! Compare two chunks of memory. -! -.sect .text -.define _memcmp - .align 16 -_memcmp: - cld - push ebp - mov ebp, esp - push esi - push edi - mov esi, 8(ebp) ! String s1 - mov edi, 12(ebp) ! String s2 - mov ecx, 16(ebp) ! Length - cmp ecx, 16 - jb cbyte ! Don't bother being smart with short arrays - mov eax, esi - or eax, edi - testb al, 1 - jnz cbyte ! Bit 0 set, use byte compare - testb al, 2 - jnz cword ! Bit 1 set, use word compare -clword: shrd eax, ecx, 2 ! Save low two bits of ecx in eax - shr ecx, 2 - repe - cmps ! Compare longwords - sub esi, 4 - sub edi, 4 - inc ecx ! Recompare the last longword - shld ecx, eax, 2 ! And any excess bytes - jmp last -cword: shrd eax, ecx, 1 ! Save low bit of ecx in eax - shr ecx, 1 - repe - o16 cmps ! Compare words - sub esi, 2 - sub edi, 2 - inc ecx ! Recompare the last word - shld ecx, eax, 1 ! And one more byte? -cbyte: test ecx, ecx ! Set 'Z' flag if ecx = 0 -last: repe - cmpsb ! Look for the first differing byte - seta al ! al = (s1 > s2) - setb ah ! ah = (s1 < s2) - subb al, ah - movsxb eax, al ! eax = (s1 > s2) - (s1 < s2), i.e. -1, 0, 1 - mov edx, esi ! For bcmp() to play with - pop edi - pop esi - pop ebp - ret diff --git a/lib/libc/arch/i386/string/memcpy.S b/lib/libc/arch/i386/string/memcpy.S new file mode 100644 index 000000000..ed698423e --- /dev/null +++ b/lib/libc/arch/i386/string/memcpy.S @@ -0,0 +1,23 @@ +/* memcpy() Author: Kees J. Bot */ +/* 2 Jan 1994 */ + +/* void *memcpy(void *s1, const void *s2, size_t n) */ +/* Copy a chunk of memory. */ +/* This routine need not handle overlap, so it does not handle overlap. */ +/* One could simply call __memmove, the cost of the overlap check is */ +/* negligible, but you are dealing with a programmer who believes that if */ +/* anything can go wrong, it should go wrong. */ +/* */ +.text +.globl _memcpy +.balign 16 +_memcpy: + push %ebp + movl %esp, %ebp + push %esi + push %edi + movl 8(%ebp), %edi /* String s1 */ + movl 12(%ebp), %esi /* String s2 */ + movl 16(%ebp), %ecx /* Length */ +/* No overlap check here */ + jmp __memcpy /* Call the part of __memmove that copies up */ diff --git a/lib/libc/arch/i386/string/memcpy.s b/lib/libc/arch/i386/string/memcpy.s deleted file mode 100644 index 32a23b221..000000000 --- a/lib/libc/arch/i386/string/memcpy.s +++ /dev/null @@ -1,24 +0,0 @@ -! memcpy() Author: Kees J. Bot -! 2 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! void *memcpy(void *s1, const void *s2, size_t n) -! Copy a chunk of memory. -! This routine need not handle overlap, so it does not handle overlap. -! One could simply call __memmove, the cost of the overlap check is -! negligible, but you are dealing with a programmer who believes that -! if anything can go wrong, it should go wrong. -! -.sect .text -.define _memcpy - .align 16 -_memcpy: - push ebp - mov ebp, esp - push esi - push edi - mov edi, 8(ebp) ! String s1 - mov esi, 12(ebp) ! String s2 - mov ecx, 16(ebp) ! Length - ! No overlap check here - jmp __memcpy ! Call the part of __memmove that copies up diff --git a/lib/libc/arch/i386/string/memmove.S b/lib/libc/arch/i386/string/memmove.S new file mode 100644 index 000000000..f42ce0543 --- /dev/null +++ b/lib/libc/arch/i386/string/memmove.S @@ -0,0 +1,11 @@ +/* memmove() Author: Kees J. Bot */ +/* 2 Jan 1994 */ + +/* void *memmove(void *s1, const void *s2, size_t n) */ +/* Copy a chunk of memory. Handle overlap. */ +/* */ +.text +.globl _memmove +.balign 16 +_memmove: + jmp __memmove /* Call common code */ diff --git a/lib/libc/arch/i386/string/memmove.s b/lib/libc/arch/i386/string/memmove.s deleted file mode 100644 index 5962ffab5..000000000 --- a/lib/libc/arch/i386/string/memmove.s +++ /dev/null @@ -1,12 +0,0 @@ -! memmove() Author: Kees J. Bot -! 2 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! void *memmove(void *s1, const void *s2, size_t n) -! Copy a chunk of memory. Handle overlap. -! -.sect .text -.define _memmove - .align 16 -_memmove: - jmp __memmove ! Call common code diff --git a/lib/libc/arch/i386/string/memset.S b/lib/libc/arch/i386/string/memset.S new file mode 100644 index 000000000..22f083679 --- /dev/null +++ b/lib/libc/arch/i386/string/memset.S @@ -0,0 +1,46 @@ +/* memset() Author: Kees J. Bot */ +/* 2 Jan 1994 */ + +/* void *memset(void *s, int c, size_t n) */ +/* Set a chunk of memory to the same byte value. */ +/* */ +.text +.globl _memset +.balign 16 +_memset: + push %ebp + movl %esp, %ebp + push %edi + movl 8(%ebp), %edi /* The string */ + movzbl 12(%ebp), %eax /* The fill byte */ + movl 16(%ebp), %ecx /* Length */ + cld + cmpl $16, %ecx + jb sbyte /* Don't bother being smart with short arrays */ + testl $1, %edi + jne sbyte /* Bit 0 set, use byte store */ + testl $2, %edi + jne sword /* Bit 1 set, use word store */ +slword: + movb %al, %ah + movl %eax, %edx + sall $16, %edx + orl %edx, %eax /* One byte to four bytes */ + shrdl $2, %ecx, %edx /* Save low two bits of ecx in edx */ + shrl $2, %ecx + + rep stosl /* Store longwords. */ + shldl $2, %edx, %ecx /* Restore low two bits */ +sword: + movb %al, %ah /* One byte to two bytes */ + shrl $1, %ecx + + rep stosw /* Store words */ + adcl %ecx, %ecx /* One more byte? */ +sbyte: + rep stosb /* Store bytes */ +done: + movl 8(%ebp), %eax /* Return some value you have no need for */ + pop %edi + pop %ebp + ret diff --git a/lib/libc/arch/i386/string/memset.s b/lib/libc/arch/i386/string/memset.s deleted file mode 100644 index 4da22df4c..000000000 --- a/lib/libc/arch/i386/string/memset.s +++ /dev/null @@ -1,44 +0,0 @@ -! memset() Author: Kees J. Bot -! 2 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! void *memset(void *s, int c, size_t n) -! Set a chunk of memory to the same byte value. -! -.sect .text -.define _memset - .align 16 -_memset: - push ebp - mov ebp, esp - push edi - mov edi, 8(ebp) ! The string - movzxb eax, 12(ebp) ! The fill byte - mov ecx, 16(ebp) ! Length - cld - cmp ecx, 16 - jb sbyte ! Don't bother being smart with short arrays - test edi, 1 - jnz sbyte ! Bit 0 set, use byte store - test edi, 2 - jnz sword ! Bit 1 set, use word store -slword: movb ah, al - mov edx, eax - sal edx, 16 - or eax, edx ! One byte to four bytes - shrd edx, ecx, 2 ! Save low two bits of ecx in edx - shr ecx, 2 - rep - stos ! Store longwords. - shld ecx, edx, 2 ! Restore low two bits -sword: movb ah, al ! One byte to two bytes - shr ecx, 1 - rep - o16 stos ! Store words - adc ecx, ecx ! One more byte? -sbyte: rep - stosb ! Store bytes -done: mov eax, 8(ebp) ! Return some value you have no need for - pop edi - pop ebp - ret diff --git a/lib/libc/arch/i386/string/rindex.S b/lib/libc/arch/i386/string/rindex.S new file mode 100644 index 000000000..24e9cfb38 --- /dev/null +++ b/lib/libc/arch/i386/string/rindex.S @@ -0,0 +1,12 @@ +/* rindex() Author: Kees J. Bot */ +/* 2 Jan 1994 */ + +/* char *rindex(const char *s, int c) */ +/* Look for the last occurrence a character in a string. Has suffered */ +/* from a hostile takeover by strrchr(). */ +/* */ +.text +.globl _rindex +.balign 16 +_rindex: + jmp _strrchr diff --git a/lib/libc/arch/i386/string/rindex.s b/lib/libc/arch/i386/string/rindex.s deleted file mode 100644 index 3c8163e05..000000000 --- a/lib/libc/arch/i386/string/rindex.s +++ /dev/null @@ -1,13 +0,0 @@ -! rindex() Author: Kees J. Bot -! 2 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! char *rindex(const char *s, int c) -! Look for the last occurrence a character in a string. Has suffered -! from a hostile takeover by strrchr(). -! -.sect .text -.define _rindex - .align 16 -_rindex: - jmp _strrchr diff --git a/lib/libc/arch/i386/string/strcat.S b/lib/libc/arch/i386/string/strcat.S new file mode 100644 index 000000000..9b9df6b45 --- /dev/null +++ b/lib/libc/arch/i386/string/strcat.S @@ -0,0 +1,12 @@ +/* strcat() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* char *strcat(char *s1, const char *s2) */ +/* Append string s2 to s1. */ +/* */ +.text +.globl _strcat +.balign 16 +_strcat: + movl $-1, %edx /* Unlimited length */ + jmp __strncat /* Common code */ diff --git a/lib/libc/arch/i386/string/strcat.s b/lib/libc/arch/i386/string/strcat.s deleted file mode 100644 index 6b9a14ae9..000000000 --- a/lib/libc/arch/i386/string/strcat.s +++ /dev/null @@ -1,13 +0,0 @@ -! strcat() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! char *strcat(char *s1, const char *s2) -! Append string s2 to s1. -! -.sect .text -.define _strcat - .align 16 -_strcat: - mov edx, -1 ! Unlimited length - jmp __strncat ! Common code diff --git a/lib/libc/arch/i386/string/strchr.S b/lib/libc/arch/i386/string/strchr.S new file mode 100644 index 000000000..4c10f59c8 --- /dev/null +++ b/lib/libc/arch/i386/string/strchr.S @@ -0,0 +1,42 @@ +/* strchr() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* char *strchr(const char *s, int c) */ +/* Look for a character in a string. */ +/* */ +.text +.globl _strchr +.balign 16 +_strchr: + push %ebp + movl %esp, %ebp + push %edi + cld + movl 8(%ebp), %edi /* edi = string */ + movl $16, %edx /* Look at small chunks of the string */ +next: + shll $1, %edx /* Chunks become bigger each time */ + movl %edx, %ecx + xorb %al, %al /* Look for the zero at the end */ + + repne scasb + pushf /* Remember the flags */ + subl %edx, %ecx + negl %ecx /* Some or all of the chunk */ + subl %ecx, %edi /* Step back */ + movb 12(%ebp), %al /* The character to look for */ + + repne scasb + je found + popf /* Did we find the end of string earlier? */ + jne next /* No, try again */ + xorl %eax, %eax /* Return NULL */ + pop %edi + pop %ebp + ret +found: + pop %eax /* Get rid of those flags */ + leal -1(%edi), %eax /* Address of byte found */ + pop %edi + pop %ebp + ret diff --git a/lib/libc/arch/i386/string/strchr.s b/lib/libc/arch/i386/string/strchr.s deleted file mode 100644 index 777503dc3..000000000 --- a/lib/libc/arch/i386/string/strchr.s +++ /dev/null @@ -1,41 +0,0 @@ -! strchr() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! char *strchr(const char *s, int c) -! Look for a character in a string. -! -.sect .text -.define _strchr - .align 16 -_strchr: - push ebp - mov ebp, esp - push edi - cld - mov edi, 8(ebp) ! edi = string - mov edx, 16 ! Look at small chunks of the string -next: shl edx, 1 ! Chunks become bigger each time - mov ecx, edx - xorb al, al ! Look for the zero at the end - repne - scasb - pushf ! Remember the flags - sub ecx, edx - neg ecx ! Some or all of the chunk - sub edi, ecx ! Step back - movb al, 12(ebp) ! The character to look for - repne - scasb - je found - popf ! Did we find the end of string earlier? - jne next ! No, try again - xor eax, eax ! Return NULL - pop edi - pop ebp - ret -found: pop eax ! Get rid of those flags - lea eax, -1(edi) ! Address of byte found - pop edi - pop ebp - ret diff --git a/lib/libc/arch/i386/string/strcmp.S b/lib/libc/arch/i386/string/strcmp.S new file mode 100644 index 000000000..2cb1e0843 --- /dev/null +++ b/lib/libc/arch/i386/string/strcmp.S @@ -0,0 +1,12 @@ +/* strcmp() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* int strcmp(const char *s1, const char *s2) */ +/* Compare two strings. */ +/* */ +.text +.globl _strcmp +.balign 16 +_strcmp: + movl $-1, %ecx /* Unlimited length */ + jmp __strncmp /* Common code */ diff --git a/lib/libc/arch/i386/string/strcmp.s b/lib/libc/arch/i386/string/strcmp.s deleted file mode 100644 index 85b37e3b0..000000000 --- a/lib/libc/arch/i386/string/strcmp.s +++ /dev/null @@ -1,13 +0,0 @@ -! strcmp() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! int strcmp(const char *s1, const char *s2) -! Compare two strings. -! -.sect .text -.define _strcmp - .align 16 -_strcmp: - mov ecx, -1 ! Unlimited length - jmp __strncmp ! Common code diff --git a/lib/libc/arch/i386/string/strcpy.S b/lib/libc/arch/i386/string/strcpy.S new file mode 100644 index 000000000..d7affdc23 --- /dev/null +++ b/lib/libc/arch/i386/string/strcpy.S @@ -0,0 +1,21 @@ +/* strcpy() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* char *strcpy(char *s1, const char *s2) */ +/* Copy string s2 to s1. */ +/* */ +.text +.globl _strcpy +.balign 16 +_strcpy: + push %ebp + movl %esp, %ebp + push %esi + push %edi + movl $-1, %ecx /* Unlimited length */ + call __strncpy /* Common code */ + movl 8(%ebp), %eax /* Return s1 */ + pop %edi + pop %esi + pop %ebp + ret diff --git a/lib/libc/arch/i386/string/strcpy.s b/lib/libc/arch/i386/string/strcpy.s deleted file mode 100644 index 04e6217d8..000000000 --- a/lib/libc/arch/i386/string/strcpy.s +++ /dev/null @@ -1,22 +0,0 @@ -! strcpy() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! char *strcpy(char *s1, const char *s2) -! Copy string s2 to s1. -! -.sect .text -.define _strcpy - .align 16 -_strcpy: - push ebp - mov ebp, esp - push esi - push edi - mov ecx, -1 ! Unlimited length - call __strncpy ! Common code - mov eax, 8(ebp) ! Return s1 - pop edi - pop esi - pop ebp - ret diff --git a/lib/libc/arch/i386/string/strlen.S b/lib/libc/arch/i386/string/strlen.S new file mode 100644 index 000000000..6b38c198f --- /dev/null +++ b/lib/libc/arch/i386/string/strlen.S @@ -0,0 +1,12 @@ +/* strlen() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* size_t strlen(const char *s) */ +/* Return the length of a string. */ +/* */ +.text +.globl _strlen +.balign 16 +_strlen: + movl $-1, %ecx /* Unlimited length */ + jmp __strnlen /* Common code */ diff --git a/lib/libc/arch/i386/string/strlen.s b/lib/libc/arch/i386/string/strlen.s deleted file mode 100644 index 2a1a24d6f..000000000 --- a/lib/libc/arch/i386/string/strlen.s +++ /dev/null @@ -1,13 +0,0 @@ -! strlen() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! size_t strlen(const char *s) -! Return the length of a string. -! -.sect .text -.define _strlen - .align 16 -_strlen: - mov ecx, -1 ! Unlimited length - jmp __strnlen ! Common code diff --git a/lib/libc/arch/i386/string/strncat.S b/lib/libc/arch/i386/string/strncat.S new file mode 100644 index 000000000..a2ac7d7e9 --- /dev/null +++ b/lib/libc/arch/i386/string/strncat.S @@ -0,0 +1,12 @@ +/* strncat() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* size_t strncat(char *s1, const char *s2, size_t n) */ +/* Append string s2 to s1. */ +/* */ +.text +.globl _strncat +.balign 16 +_strncat: + movl 12(%esp), %edx /* Maximum length */ + jmp __strncat /* Common code */ diff --git a/lib/libc/arch/i386/string/strncat.s b/lib/libc/arch/i386/string/strncat.s deleted file mode 100644 index 0756d2e9e..000000000 --- a/lib/libc/arch/i386/string/strncat.s +++ /dev/null @@ -1,13 +0,0 @@ -! strncat() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! size_t strncat(char *s1, const char *s2, size_t n) -! Append string s2 to s1. -! -.sect .text -.define _strncat - .align 16 -_strncat: - mov edx, 12(esp) ! Maximum length - jmp __strncat ! Common code diff --git a/lib/libc/arch/i386/string/strncmp.S b/lib/libc/arch/i386/string/strncmp.S new file mode 100644 index 000000000..a95349b01 --- /dev/null +++ b/lib/libc/arch/i386/string/strncmp.S @@ -0,0 +1,12 @@ +/* strncmp() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* int strncmp(const char *s1, const char *s2, size_t n) */ +/* Compare two strings. */ +/* */ +.text +.globl _strncmp +.balign 16 +_strncmp: + movl 12(%esp), %ecx /* Maximum length */ + jmp __strncmp /* Common code */ diff --git a/lib/libc/arch/i386/string/strncmp.s b/lib/libc/arch/i386/string/strncmp.s deleted file mode 100644 index 6f1382656..000000000 --- a/lib/libc/arch/i386/string/strncmp.s +++ /dev/null @@ -1,13 +0,0 @@ -! strncmp() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! int strncmp(const char *s1, const char *s2, size_t n) -! Compare two strings. -! -.sect .text -.define _strncmp - .align 16 -_strncmp: - mov ecx, 12(esp) ! Maximum length - jmp __strncmp ! Common code diff --git a/lib/libc/arch/i386/string/strncpy.S b/lib/libc/arch/i386/string/strncpy.S new file mode 100644 index 000000000..f903dbba9 --- /dev/null +++ b/lib/libc/arch/i386/string/strncpy.S @@ -0,0 +1,24 @@ +/* strncpy() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* char *strncpy(char *s1, const char *s2, size_t n) */ +/* Copy string s2 to s1. */ +/* */ +.text +.globl _strncpy +.balign 16 +_strncpy: + push %ebp + movl %esp, %ebp + push %esi + push %edi + movl 16(%ebp), %ecx /* Maximum length */ + call __strncpy /* Common code */ + movl %edx, %ecx /* Number of bytes not copied */ + + rep stosb /* strncpy always copies n bytes by null padding */ + movl 8(%ebp), %eax /* Return s1 */ + pop %edi + pop %esi + pop %ebp + ret diff --git a/lib/libc/arch/i386/string/strncpy.s b/lib/libc/arch/i386/string/strncpy.s deleted file mode 100644 index 52d392d46..000000000 --- a/lib/libc/arch/i386/string/strncpy.s +++ /dev/null @@ -1,25 +0,0 @@ -! strncpy() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! char *strncpy(char *s1, const char *s2, size_t n) -! Copy string s2 to s1. -! -.sect .text -.define _strncpy - .align 16 -_strncpy: - push ebp - mov ebp, esp - push esi - push edi - mov ecx, 16(ebp) ! Maximum length - call __strncpy ! Common code - mov ecx, edx ! Number of bytes not copied - rep - stosb ! strncpy always copies n bytes by null padding - mov eax, 8(ebp) ! Return s1 - pop edi - pop esi - pop ebp - ret diff --git a/lib/libc/arch/i386/string/strnlen.S b/lib/libc/arch/i386/string/strnlen.S new file mode 100644 index 000000000..2551f86e4 --- /dev/null +++ b/lib/libc/arch/i386/string/strnlen.S @@ -0,0 +1,12 @@ +/* strnlen() Author: Kees J. Bot */ +/* 1 Jan 1994 */ + +/* size_t strnlen(const char *s, size_t n) */ +/* Return the length of a string. */ +/* */ +.text +.globl _strnlen +.balign 16 +_strnlen: + movl 8(%esp), %ecx /* Maximum length */ + jmp __strnlen /* Common code */ diff --git a/lib/libc/arch/i386/string/strnlen.s b/lib/libc/arch/i386/string/strnlen.s deleted file mode 100644 index 99d5a0ce0..000000000 --- a/lib/libc/arch/i386/string/strnlen.s +++ /dev/null @@ -1,13 +0,0 @@ -! strnlen() Author: Kees J. Bot -! 1 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! size_t strnlen(const char *s, size_t n) -! Return the length of a string. -! -.sect .text -.define _strnlen - .align 16 -_strnlen: - mov ecx, 8(esp) ! Maximum length - jmp __strnlen ! Common code diff --git a/lib/libc/arch/i386/string/strrchr.S b/lib/libc/arch/i386/string/strrchr.S new file mode 100644 index 000000000..74c03e431 --- /dev/null +++ b/lib/libc/arch/i386/string/strrchr.S @@ -0,0 +1,36 @@ +/* strrchr() Author: Kees J. Bot */ +/* 2 Jan 1994 */ + +/* char *strrchr(const char *s, int c) */ +/* Look for the last occurrence a character in a string. */ +/* */ +.text +.globl _strrchr +.balign 16 +_strrchr: + push %ebp + movl %esp, %ebp + push %edi + movl 8(%ebp), %edi /* edi = string */ + movl $-1, %ecx + xorb %al, %al + cld + + repne scasb /* Look for the end of the string */ + notl %ecx /* -1 - ecx = Length of the string + null */ + decl %edi /* Put edi back on the zero byte */ + movb 12(%ebp), %al /* The character to look for */ + std /* Downwards search */ + + repne scasb + cld /* Direction bit back to default */ + jne failure + leal 1(%edi), %eax /* Found it */ + pop %edi + pop %ebp + ret +failure: + xorl %eax, %eax /* Not there */ + pop %edi + pop %ebp + ret diff --git a/lib/libc/arch/i386/string/strrchr.s b/lib/libc/arch/i386/string/strrchr.s deleted file mode 100644 index 510d24da1..000000000 --- a/lib/libc/arch/i386/string/strrchr.s +++ /dev/null @@ -1,36 +0,0 @@ -! strrchr() Author: Kees J. Bot -! 2 Jan 1994 -.sect .text; .sect .rom; .sect .data; .sect .bss - -! char *strrchr(const char *s, int c) -! Look for the last occurrence a character in a string. -! -.sect .text -.define _strrchr - .align 16 -_strrchr: - push ebp - mov ebp, esp - push edi - mov edi, 8(ebp) ! edi = string - mov ecx, -1 - xorb al, al - cld - repne - scasb ! Look for the end of the string - not ecx ! -1 - ecx = Length of the string + null - dec edi ! Put edi back on the zero byte - movb al, 12(ebp) ! The character to look for - std ! Downwards search - repne - scasb - cld ! Direction bit back to default - jne failure - lea eax, 1(edi) ! Found it - pop edi - pop ebp - ret -failure:xor eax, eax ! Not there - pop edi - pop ebp - ret diff --git a/lib/libc/gnu/arch/i386/rts/Makefile.inc b/lib/libc/gnu/arch/i386/rts/Makefile.inc index b2a9de0e3..330681d9a 100644 --- a/lib/libc/gnu/arch/i386/rts/Makefile.inc +++ b/lib/libc/gnu/arch/i386/rts/Makefile.inc @@ -2,5 +2,5 @@ .PATH: ${.CURDIR}/gnu/arch/${ARCH}/rts SRCS+= \ - __setjmp.gs \ - longjmp.gs + __setjmp.S \ + longjmp.S diff --git a/lib/libc/gnu/arch/i386/rts/__setjmp.S b/lib/libc/gnu/arch/i386/rts/__setjmp.S new file mode 100644 index 000000000..1343061d7 --- /dev/null +++ b/lib/libc/gnu/arch/i386/rts/__setjmp.S @@ -0,0 +1,31 @@ +/ __setjmp.gnu.s +/ +/ Created: Oct 14, 1993 by Philip Homburg + +.text +.globl ___setjmp +___setjmp: + movl 4(%esp), %eax /* jmp_buf */ + movl %edx, 28(%eax) /* save edx */ + movl 0(%esp), %edx + movl %edx, 8(%eax) /* save program counter */ + movl %esp, 12(%eax) /* save stack pointer */ + movl %ebp, 16(%eax) /* save frame pointer */ + movl %ebx, 20(%eax) + movl %ecx, 24(%eax) + movl %esi, 32(%eax) + movl %edi, 36(%eax) + + movl 8(%esp), %edx /* save mask? */ + movl %edx, 0(%eax) /* save whether to restore mask */ + testl %edx, %edx + jz 1f + leal 4(%eax), %edx /* pointer to sigset_t */ + push %edx + call __newsigset /* save mask */ + addl $4, %esp +1: + movl $0, %eax + ret + +/ $PchId: __setjmp.gnu.s,v 1.4 1996/03/12 19:30:54 philip Exp $ diff --git a/lib/libc/gnu/arch/i386/rts/__setjmp.gs b/lib/libc/gnu/arch/i386/rts/__setjmp.gs deleted file mode 100644 index 36419951b..000000000 --- a/lib/libc/gnu/arch/i386/rts/__setjmp.gs +++ /dev/null @@ -1,31 +0,0 @@ -/ __setjmp.gnu.s -/ -/ Created: Oct 14, 1993 by Philip Homburg - -.text -.globl ___setjmp -___setjmp: - movl 4(%esp), %eax # jmp_buf - movl %edx, 28(%eax) # save edx - movl 0(%esp), %edx - movl %edx, 8(%eax) # save program counter - movl %esp, 12(%eax) # save stack pointer - movl %ebp, 16(%eax) # save frame pointer - movl %ebx, 20(%eax) - movl %ecx, 24(%eax) - movl %esi, 32(%eax) - movl %edi, 36(%eax) - - movl 8(%esp), %edx # save mask? - movl %edx, 0(%eax) # save whether to restore mask - testl %edx, %edx - jz 1f - leal 4(%eax), %edx # pointer to sigset_t - pushl %edx - call ___newsigset # save mask - addl $4, %esp -1: - movl $0, %eax - ret - -/ $PchId: __setjmp.gnu.s,v 1.4 1996/03/12 19:30:54 philip Exp $ diff --git a/lib/libc/gnu/arch/i386/rts/longjmp.S b/lib/libc/gnu/arch/i386/rts/longjmp.S new file mode 100644 index 000000000..71befeeb6 --- /dev/null +++ b/lib/libc/gnu/arch/i386/rts/longjmp.S @@ -0,0 +1,38 @@ +/ longjmp.gnu.s +/ +/ Created: Oct 15, 1993 by Philip Homburg + +.text +.globl _longjmp +_longjmp: + movl 4(%esp), %eax /* jmp_buf */ + cmpl $0, 0(%eax) /* save mask? */ + je 1f + leal 4(%eax), %edx /* pointer to sigset_t */ + push %edx + call __oldsigset /* restore mask */ + addl $4, %esp + movl 4(%esp), %eax /* jmp_buf */ +1: + movl 8(%esp), %ecx /* result value */ + movl 12(%eax), %esp /* restore stack pointer */ + + movl 8(%eax), %edx /* restore program counter */ + movl %edx, 0(%esp) + + push %ecx /* save result code */ + + movl 16(%eax), %ebp /* restore frame pointer */ + movl 20(%eax), %ebx + movl 24(%eax), %ecx + movl 28(%eax), %edx + movl 32(%eax), %esi + movl 36(%eax), %edi + pop %eax + testl %eax, %eax + jz 1f + ret +1: movl $1, %eax + ret + +/ $PchId: longjmp.gnu.s,v 1.4 1996/03/12 19:30:02 philip Exp $ diff --git a/lib/libc/gnu/arch/i386/rts/longjmp.gs b/lib/libc/gnu/arch/i386/rts/longjmp.gs deleted file mode 100644 index 839385ae4..000000000 --- a/lib/libc/gnu/arch/i386/rts/longjmp.gs +++ /dev/null @@ -1,38 +0,0 @@ -/ longjmp.gnu.s -/ -/ Created: Oct 15, 1993 by Philip Homburg - -.text -.globl _longjmp -_longjmp: - movl 4(%esp), %eax # jmp_buf - cmpl $0, 0(%eax) # save mask? - je 1f - leal 4(%eax), %edx # pointer to sigset_t - pushl %edx - call ___oldsigset # restore mask - addl $4, %esp - movl 4(%esp), %eax # jmp_buf -1: - movl 8(%esp), %ecx # result value - movl 12(%eax), %esp # restore stack pointer - - movl 8(%eax), %edx # restore program counter - movl %edx, 0(%esp) - - pushl %ecx # save result code - - movl 16(%eax), %ebp # restore frame pointer - movl 20(%eax), %ebx - movl 24(%eax), %ecx - movl 28(%eax), %edx - movl 32(%eax), %esi - movl 36(%eax), %edi - pop %eax - testl %eax, %eax - jz 1f - ret -1: movl $1, %eax - ret - -/ $PchId: longjmp.gnu.s,v 1.4 1996/03/12 19:30:02 philip Exp $ diff --git a/lib/libc/syscall/Makefile.inc b/lib/libc/syscall/Makefile.inc index 502cd03c6..b67470550 100644 --- a/lib/libc/syscall/Makefile.inc +++ b/lib/libc/syscall/Makefile.inc @@ -2,135 +2,135 @@ .PATH: ${.CURDIR}/syscall SRCS+= \ - _exit.s \ - _pm_findproc.s \ - access.s \ - adddma.s \ - alarm.s \ - brk.s \ - cfgetispeed.s \ - cfgetospeed.s \ - cfsetispeed.s \ - cfsetospeed.s \ - chdir.s \ - chmod.s \ - chown.s \ - chroot.s \ - close.s \ - closedir.s \ - cprofile.s \ - creat.s \ - deldma.s \ - dup.s \ - dup2.s \ - execl.s \ - execle.s \ - execlp.s \ - execv.s \ - execve.s \ - execvp.s \ - fchown.s \ - fchmod.s \ - fcntl.s \ - fork.s \ - fpathconf.s \ - fstat.s \ - fstatfs.s \ - getcwd.s \ - getdents.s \ - getdma.s \ - getegid.s \ - geteuid.s \ - getgid.s \ - getgroups.s \ - getitimer.s \ - getnpid.s \ - getnuid.s \ - getngid.s \ - getnprocnr.s \ - getpgrp.s \ - getpid.s \ - getppid.s \ - getpprocnr.s \ - getprocnr.s \ - getsigset.s \ - getsysinfo.s \ - getuid.s \ - ioctl.s \ - isatty.s \ - kill.s \ - killpg.s \ - link.s \ - lseek.s \ - lseek64.s \ - lstat.s \ - mapdriver.s \ - mkdir.s \ - mkfifo.s \ - mknod.s \ - mmap.s \ - vm_getphys.s \ - vm_getrefcount.s \ - vm_remap.s \ - vm_unmap.s \ - vm_set_priv.s \ - vm_query_exit.s \ - mount.s \ - nanosleep.s \ - open.s \ - opendir.s \ - pathconf.s \ - pause.s \ - pipe.s \ - ptrace.s \ - read.s \ - readdir.s \ - readlink.s \ - reboot.s \ - rename.s \ - rewinddir.s \ - rmdir.s \ - sbrk.s \ - select.s \ - seekdir.s \ - setgid.s \ - setgroups.s \ - setitimer.s \ - setsid.s \ - setuid.s \ - sigaction.s \ - sigaddset.s \ - sigdelset.s \ - sigemptyset.s \ - sigfillset.s \ - sigismember.s \ - sigpending.s \ - sigprocmask.s \ - sigreturn.s \ - sigsuspend.s \ - sleep.s \ - sprofile.s \ - stat.s \ - stime.s \ - svrctl.s \ - symlink.s \ - sync.s \ - sysuname.s \ - tcdrain.s \ - tcflow.s \ - tcflush.s \ - tcgetattr.s \ - tcsendbreak.s \ - tcsetattr.s \ - time.s \ - times.s \ - truncate.s \ - umask.s \ - umount.s \ - uname.s \ - unlink.s \ - utime.s \ - vm_dmacalls.s \ - wait.s \ - waitpid.s \ - write.s + _exit.S \ + _pm_findproc.S \ + access.S \ + adddma.S \ + alarm.S \ + brk.S \ + cfgetispeed.S \ + cfgetospeed.S \ + cfsetispeed.S \ + cfsetospeed.S \ + chdir.S \ + chmod.S \ + chown.S \ + chroot.S \ + close.S \ + closedir.S \ + cprofile.S \ + creat.S \ + deldma.S \ + dup.S \ + dup2.S \ + execl.S \ + execle.S \ + execlp.S \ + execv.S \ + execve.S \ + execvp.S \ + fchown.S \ + fchmod.S \ + fcntl.S \ + fork.S \ + fpathconf.S \ + fstat.S \ + fstatfs.S \ + getcwd.S \ + getdents.S \ + getdma.S \ + getegid.S \ + geteuid.S \ + getgid.S \ + getgroups.S \ + getitimer.S \ + getnpid.S \ + getnuid.S \ + getngid.S \ + getnprocnr.S \ + getpgrp.S \ + getpid.S \ + getppid.S \ + getpprocnr.S \ + getprocnr.S \ + getsigset.S \ + getsysinfo.S \ + getuid.S \ + ioctl.S \ + isatty.S \ + kill.S \ + killpg.S \ + link.S \ + lseek.S \ + lseek64.S \ + lstat.S \ + mapdriver.S \ + mkdir.S \ + mkfifo.S \ + mknod.S \ + mmap.S \ + vm_getphys.S \ + vm_getrefcount.S \ + vm_remap.S \ + vm_unmap.S \ + vm_set_priv.S \ + vm_query_exit.S \ + mount.S \ + nanosleep.S \ + open.S \ + opendir.S \ + pathconf.S \ + pause.S \ + pipe.S \ + ptrace.S \ + read.S \ + readdir.S \ + readlink.S \ + reboot.S \ + rename.S \ + rewinddir.S \ + rmdir.S \ + sbrk.S \ + select.S \ + seekdir.S \ + setgid.S \ + setgroups.S \ + setitimer.S \ + setsid.S \ + setuid.S \ + sigaction.S \ + sigaddset.S \ + sigdelset.S \ + sigemptyset.S \ + sigfillset.S \ + sigismember.S \ + sigpending.S \ + sigprocmask.S \ + sigreturn.S \ + sigsuspend.S \ + sleep.S \ + sprofile.S \ + stat.S \ + stime.S \ + svrctl.S \ + symlink.S \ + sync.S \ + sysuname.S \ + tcdrain.S \ + tcflow.S \ + tcflush.S \ + tcgetattr.S \ + tcsendbreak.S \ + tcsetattr.S \ + time.S \ + times.S \ + truncate.S \ + umask.S \ + umount.S \ + uname.S \ + unlink.S \ + utime.S \ + vm_dmacalls.S \ + wait.S \ + waitpid.S \ + write.S diff --git a/lib/libc/syscall/_exit.s b/lib/libc/syscall/_exit.S similarity index 51% rename from lib/libc/syscall/_exit.s rename to lib/libc/syscall/_exit.S index b0e91298c..854f70880 100644 --- a/lib/libc/syscall/_exit.s +++ b/lib/libc/syscall/_exit.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern ___exit -.define __exit -.align 2 +.globl __exit +.balign 2 __exit: jmp ___exit diff --git a/lib/libc/syscall/_pm_findproc.s b/lib/libc/syscall/_pm_findproc.S similarity index 57% rename from lib/libc/syscall/_pm_findproc.s rename to lib/libc/syscall/_pm_findproc.S index 93c4b3b78..52f8eeaef 100644 --- a/lib/libc/syscall/_pm_findproc.s +++ b/lib/libc/syscall/_pm_findproc.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern ___pm_findproc -.define __pm_findproc -.align 2 +.globl __pm_findproc +.balign 2 __pm_findproc: jmp ___pm_findproc diff --git a/lib/libc/syscall/access.s b/lib/libc/syscall/access.S similarity index 52% rename from lib/libc/syscall/access.s rename to lib/libc/syscall/access.S index 5c6a91366..635c7b92c 100644 --- a/lib/libc/syscall/access.s +++ b/lib/libc/syscall/access.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __access -.define _access -.align 2 +.globl _access +.balign 2 _access: jmp __access diff --git a/lib/libc/syscall/adddma.s b/lib/libc/syscall/adddma.S similarity index 52% rename from lib/libc/syscall/adddma.s rename to lib/libc/syscall/adddma.S index 2f4dcf999..d911015db 100644 --- a/lib/libc/syscall/adddma.s +++ b/lib/libc/syscall/adddma.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __adddma -.define _adddma -.align 2 +.globl _adddma +.balign 2 _adddma: jmp __adddma diff --git a/lib/libc/syscall/alarm.s b/lib/libc/syscall/alarm.S similarity index 51% rename from lib/libc/syscall/alarm.s rename to lib/libc/syscall/alarm.S index b303b3dab..1dc3116b8 100644 --- a/lib/libc/syscall/alarm.s +++ b/lib/libc/syscall/alarm.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __alarm -.define _alarm -.align 2 +.globl _alarm +.balign 2 _alarm: jmp __alarm diff --git a/lib/libc/syscall/brk.S b/lib/libc/syscall/brk.S new file mode 100644 index 000000000..e176f844e --- /dev/null +++ b/lib/libc/syscall/brk.S @@ -0,0 +1,7 @@ +.text +.extern __brk +.globl _brk +.balign 2 + +_brk: + jmp __brk diff --git a/lib/libc/syscall/brk.s b/lib/libc/syscall/brk.s deleted file mode 100644 index 3d24a8da2..000000000 --- a/lib/libc/syscall/brk.s +++ /dev/null @@ -1,7 +0,0 @@ -.sect .text -.extern __brk -.define _brk -.align 2 - -_brk: - jmp __brk diff --git a/lib/libc/syscall/cfgetispeed.s b/lib/libc/syscall/cfgetispeed.S similarity index 57% rename from lib/libc/syscall/cfgetispeed.s rename to lib/libc/syscall/cfgetispeed.S index 54429defe..7f889edf1 100644 --- a/lib/libc/syscall/cfgetispeed.s +++ b/lib/libc/syscall/cfgetispeed.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __cfgetispeed -.define _cfgetispeed -.align 2 +.globl _cfgetispeed +.balign 2 _cfgetispeed: jmp __cfgetispeed diff --git a/lib/libc/syscall/cfgetospeed.s b/lib/libc/syscall/cfgetospeed.S similarity index 57% rename from lib/libc/syscall/cfgetospeed.s rename to lib/libc/syscall/cfgetospeed.S index 0e21c9b6b..2566bef77 100644 --- a/lib/libc/syscall/cfgetospeed.s +++ b/lib/libc/syscall/cfgetospeed.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __cfgetospeed -.define _cfgetospeed -.align 2 +.globl _cfgetospeed +.balign 2 _cfgetospeed: jmp __cfgetospeed diff --git a/lib/libc/syscall/cfsetispeed.s b/lib/libc/syscall/cfsetispeed.S similarity index 57% rename from lib/libc/syscall/cfsetispeed.s rename to lib/libc/syscall/cfsetispeed.S index 559ef1a1a..e3a2b962d 100644 --- a/lib/libc/syscall/cfsetispeed.s +++ b/lib/libc/syscall/cfsetispeed.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __cfsetispeed -.define _cfsetispeed -.align 2 +.globl _cfsetispeed +.balign 2 _cfsetispeed: jmp __cfsetispeed diff --git a/lib/libc/syscall/cfsetospeed.s b/lib/libc/syscall/cfsetospeed.S similarity index 57% rename from lib/libc/syscall/cfsetospeed.s rename to lib/libc/syscall/cfsetospeed.S index ffbe49c0f..29bd8d9e0 100644 --- a/lib/libc/syscall/cfsetospeed.s +++ b/lib/libc/syscall/cfsetospeed.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __cfsetospeed -.define _cfsetospeed -.align 2 +.globl _cfsetospeed +.balign 2 _cfsetospeed: jmp __cfsetospeed diff --git a/lib/libc/syscall/chdir.s b/lib/libc/syscall/chdir.S similarity index 60% rename from lib/libc/syscall/chdir.s rename to lib/libc/syscall/chdir.S index 98e8f708e..941ef9550 100644 --- a/lib/libc/syscall/chdir.s +++ b/lib/libc/syscall/chdir.S @@ -1,9 +1,9 @@ -.sect .text +.text .extern __chdir -.define _chdir +.globl _chdir .extern __fchdir -.define _fchdir -.align 2 +.globl _fchdir +.balign 2 _chdir: jmp __chdir diff --git a/lib/libc/syscall/chmod.s b/lib/libc/syscall/chmod.S similarity index 51% rename from lib/libc/syscall/chmod.s rename to lib/libc/syscall/chmod.S index caf12bf9e..629d40cd8 100644 --- a/lib/libc/syscall/chmod.s +++ b/lib/libc/syscall/chmod.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __chmod -.define _chmod -.align 2 +.globl _chmod +.balign 2 _chmod: jmp __chmod diff --git a/lib/libc/syscall/chown.s b/lib/libc/syscall/chown.S similarity index 51% rename from lib/libc/syscall/chown.s rename to lib/libc/syscall/chown.S index 6f7cff3da..9318670e6 100644 --- a/lib/libc/syscall/chown.s +++ b/lib/libc/syscall/chown.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __chown -.define _chown -.align 2 +.globl _chown +.balign 2 _chown: jmp __chown diff --git a/lib/libc/syscall/chroot.s b/lib/libc/syscall/chroot.S similarity index 52% rename from lib/libc/syscall/chroot.s rename to lib/libc/syscall/chroot.S index f2d4f1860..4e091ee48 100644 --- a/lib/libc/syscall/chroot.s +++ b/lib/libc/syscall/chroot.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __chroot -.define _chroot -.align 2 +.globl _chroot +.balign 2 _chroot: jmp __chroot diff --git a/lib/libc/syscall/close.s b/lib/libc/syscall/close.S similarity index 51% rename from lib/libc/syscall/close.s rename to lib/libc/syscall/close.S index 94803d637..9f87c3dcd 100644 --- a/lib/libc/syscall/close.s +++ b/lib/libc/syscall/close.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __close -.define _close -.align 2 +.globl _close +.balign 2 _close: jmp __close diff --git a/lib/libc/syscall/closedir.s b/lib/libc/syscall/closedir.S similarity index 54% rename from lib/libc/syscall/closedir.s rename to lib/libc/syscall/closedir.S index 44bba250d..3164858fe 100644 --- a/lib/libc/syscall/closedir.s +++ b/lib/libc/syscall/closedir.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __closedir -.define _closedir -.align 2 +.globl _closedir +.balign 2 _closedir: jmp __closedir diff --git a/lib/libc/syscall/cprofile.s b/lib/libc/syscall/cprofile.S similarity index 54% rename from lib/libc/syscall/cprofile.s rename to lib/libc/syscall/cprofile.S index 99d7a8666..7bcfe8def 100644 --- a/lib/libc/syscall/cprofile.s +++ b/lib/libc/syscall/cprofile.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __cprofile -.define _cprofile -.align 2 +.globl _cprofile +.balign 2 _cprofile: jmp __cprofile diff --git a/lib/libc/syscall/creat.s b/lib/libc/syscall/creat.S similarity index 51% rename from lib/libc/syscall/creat.s rename to lib/libc/syscall/creat.S index 3bc6b273e..0d3cc2b58 100644 --- a/lib/libc/syscall/creat.s +++ b/lib/libc/syscall/creat.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __creat -.define _creat -.align 2 +.globl _creat +.balign 2 _creat: jmp __creat diff --git a/lib/libc/syscall/deldma.s b/lib/libc/syscall/deldma.S similarity index 52% rename from lib/libc/syscall/deldma.s rename to lib/libc/syscall/deldma.S index 797d62649..a15c442b9 100644 --- a/lib/libc/syscall/deldma.s +++ b/lib/libc/syscall/deldma.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __deldma -.define _deldma -.align 2 +.globl _deldma +.balign 2 _deldma: jmp __deldma diff --git a/lib/libc/syscall/dup.S b/lib/libc/syscall/dup.S new file mode 100644 index 000000000..1957b6931 --- /dev/null +++ b/lib/libc/syscall/dup.S @@ -0,0 +1,7 @@ +.text +.extern __dup +.globl _dup +.balign 2 + +_dup: + jmp __dup diff --git a/lib/libc/syscall/dup.s b/lib/libc/syscall/dup.s deleted file mode 100644 index 5049f5fbc..000000000 --- a/lib/libc/syscall/dup.s +++ /dev/null @@ -1,7 +0,0 @@ -.sect .text -.extern __dup -.define _dup -.align 2 - -_dup: - jmp __dup diff --git a/lib/libc/syscall/dup2.s b/lib/libc/syscall/dup2.S similarity index 50% rename from lib/libc/syscall/dup2.s rename to lib/libc/syscall/dup2.S index de110aa77..26f426e21 100644 --- a/lib/libc/syscall/dup2.s +++ b/lib/libc/syscall/dup2.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __dup2 -.define _dup2 -.align 2 +.globl _dup2 +.balign 2 _dup2: jmp __dup2 diff --git a/lib/libc/syscall/execl.s b/lib/libc/syscall/execl.S similarity index 51% rename from lib/libc/syscall/execl.s rename to lib/libc/syscall/execl.S index 647e6dde5..6c44c28f7 100644 --- a/lib/libc/syscall/execl.s +++ b/lib/libc/syscall/execl.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __execl -.define _execl -.align 2 +.globl _execl +.balign 2 _execl: jmp __execl diff --git a/lib/libc/syscall/execle.s b/lib/libc/syscall/execle.S similarity index 52% rename from lib/libc/syscall/execle.s rename to lib/libc/syscall/execle.S index fa0456298..8f7b3697b 100644 --- a/lib/libc/syscall/execle.s +++ b/lib/libc/syscall/execle.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __execle -.define _execle -.align 2 +.globl _execle +.balign 2 _execle: jmp __execle diff --git a/lib/libc/syscall/execlp.s b/lib/libc/syscall/execlp.S similarity index 52% rename from lib/libc/syscall/execlp.s rename to lib/libc/syscall/execlp.S index 7a360fe06..c35d4ea62 100644 --- a/lib/libc/syscall/execlp.s +++ b/lib/libc/syscall/execlp.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __execlp -.define _execlp -.align 2 +.globl _execlp +.balign 2 _execlp: jmp __execlp diff --git a/lib/libc/syscall/execv.s b/lib/libc/syscall/execv.S similarity index 51% rename from lib/libc/syscall/execv.s rename to lib/libc/syscall/execv.S index 692d20469..991c24ea0 100644 --- a/lib/libc/syscall/execv.s +++ b/lib/libc/syscall/execv.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __execv -.define _execv -.align 2 +.globl _execv +.balign 2 _execv: jmp __execv diff --git a/lib/libc/syscall/execve.s b/lib/libc/syscall/execve.S similarity index 52% rename from lib/libc/syscall/execve.s rename to lib/libc/syscall/execve.S index ad2193450..818756fb0 100644 --- a/lib/libc/syscall/execve.s +++ b/lib/libc/syscall/execve.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __execve -.define _execve -.align 2 +.globl _execve +.balign 2 _execve: jmp __execve diff --git a/lib/libc/syscall/execvp.s b/lib/libc/syscall/execvp.S similarity index 52% rename from lib/libc/syscall/execvp.s rename to lib/libc/syscall/execvp.S index e03c26489..cb2d66aad 100644 --- a/lib/libc/syscall/execvp.s +++ b/lib/libc/syscall/execvp.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __execvp -.define _execvp -.align 2 +.globl _execvp +.balign 2 _execvp: jmp __execvp diff --git a/lib/libc/syscall/fchmod.s b/lib/libc/syscall/fchmod.S similarity index 52% rename from lib/libc/syscall/fchmod.s rename to lib/libc/syscall/fchmod.S index a8544ea0b..1eba9dd53 100644 --- a/lib/libc/syscall/fchmod.s +++ b/lib/libc/syscall/fchmod.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __fchmod -.define _fchmod -.align 2 +.globl _fchmod +.balign 2 _fchmod: jmp __fchmod diff --git a/lib/libc/syscall/fchown.s b/lib/libc/syscall/fchown.S similarity index 52% rename from lib/libc/syscall/fchown.s rename to lib/libc/syscall/fchown.S index 1a0c9496f..91bf31b09 100644 --- a/lib/libc/syscall/fchown.s +++ b/lib/libc/syscall/fchown.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __fchown -.define _fchown -.align 2 +.globl _fchown +.balign 2 _fchown: jmp __fchown diff --git a/lib/libc/syscall/fcntl.s b/lib/libc/syscall/fcntl.S similarity index 51% rename from lib/libc/syscall/fcntl.s rename to lib/libc/syscall/fcntl.S index 97b78940b..d3ce7d71f 100644 --- a/lib/libc/syscall/fcntl.s +++ b/lib/libc/syscall/fcntl.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __fcntl -.define _fcntl -.align 2 +.globl _fcntl +.balign 2 _fcntl: jmp __fcntl diff --git a/lib/libc/syscall/fork.s b/lib/libc/syscall/fork.S similarity index 50% rename from lib/libc/syscall/fork.s rename to lib/libc/syscall/fork.S index 913497617..ef5101e16 100644 --- a/lib/libc/syscall/fork.s +++ b/lib/libc/syscall/fork.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __fork -.define _fork -.align 2 +.globl _fork +.balign 2 _fork: jmp __fork diff --git a/lib/libc/syscall/fpathconf.s b/lib/libc/syscall/fpathconf.S similarity index 55% rename from lib/libc/syscall/fpathconf.s rename to lib/libc/syscall/fpathconf.S index 130a45dac..2b556ddcc 100644 --- a/lib/libc/syscall/fpathconf.s +++ b/lib/libc/syscall/fpathconf.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __fpathconf -.define _fpathconf -.align 2 +.globl _fpathconf +.balign 2 _fpathconf: jmp __fpathconf diff --git a/lib/libc/syscall/fstat.s b/lib/libc/syscall/fstat.S similarity index 51% rename from lib/libc/syscall/fstat.s rename to lib/libc/syscall/fstat.S index 5ee5b9935..64e1c1404 100644 --- a/lib/libc/syscall/fstat.s +++ b/lib/libc/syscall/fstat.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __fstat -.define _fstat -.align 2 +.globl _fstat +.balign 2 _fstat: jmp __fstat diff --git a/lib/libc/syscall/fstatfs.s b/lib/libc/syscall/fstatfs.S similarity index 53% rename from lib/libc/syscall/fstatfs.s rename to lib/libc/syscall/fstatfs.S index 3357f8a19..9c35e8465 100644 --- a/lib/libc/syscall/fstatfs.s +++ b/lib/libc/syscall/fstatfs.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __fstatfs -.define _fstatfs -.align 2 +.globl _fstatfs +.balign 2 _fstatfs: jmp __fstatfs diff --git a/lib/libc/syscall/getcwd.s b/lib/libc/syscall/getcwd.S similarity index 52% rename from lib/libc/syscall/getcwd.s rename to lib/libc/syscall/getcwd.S index 262c92d15..16b28e314 100644 --- a/lib/libc/syscall/getcwd.s +++ b/lib/libc/syscall/getcwd.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getcwd -.define _getcwd -.align 2 +.globl _getcwd +.balign 2 _getcwd: jmp __getcwd diff --git a/lib/libc/syscall/getdents.s b/lib/libc/syscall/getdents.S similarity index 54% rename from lib/libc/syscall/getdents.s rename to lib/libc/syscall/getdents.S index 38405e167..6d7497dc4 100644 --- a/lib/libc/syscall/getdents.s +++ b/lib/libc/syscall/getdents.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getdents -.define _getdents -.align 2 +.globl _getdents +.balign 2 _getdents: jmp __getdents diff --git a/lib/libc/syscall/getdma.s b/lib/libc/syscall/getdma.S similarity index 52% rename from lib/libc/syscall/getdma.s rename to lib/libc/syscall/getdma.S index 3939a3d05..2d0a6513d 100644 --- a/lib/libc/syscall/getdma.s +++ b/lib/libc/syscall/getdma.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getdma -.define _getdma -.align 2 +.globl _getdma +.balign 2 _getdma: jmp __getdma diff --git a/lib/libc/syscall/getegid.s b/lib/libc/syscall/getegid.S similarity index 53% rename from lib/libc/syscall/getegid.s rename to lib/libc/syscall/getegid.S index 0e65bc9ba..d7a2115a2 100644 --- a/lib/libc/syscall/getegid.s +++ b/lib/libc/syscall/getegid.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getegid -.define _getegid -.align 2 +.globl _getegid +.balign 2 _getegid: jmp __getegid diff --git a/lib/libc/syscall/geteuid.s b/lib/libc/syscall/geteuid.S similarity index 53% rename from lib/libc/syscall/geteuid.s rename to lib/libc/syscall/geteuid.S index 9cbc952b2..7cfff3cbe 100644 --- a/lib/libc/syscall/geteuid.s +++ b/lib/libc/syscall/geteuid.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __geteuid -.define _geteuid -.align 2 +.globl _geteuid +.balign 2 _geteuid: jmp __geteuid diff --git a/lib/libc/syscall/getgid.s b/lib/libc/syscall/getgid.S similarity index 52% rename from lib/libc/syscall/getgid.s rename to lib/libc/syscall/getgid.S index 7f4caa38e..e62eaa71e 100644 --- a/lib/libc/syscall/getgid.s +++ b/lib/libc/syscall/getgid.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getgid -.define _getgid -.align 2 +.globl _getgid +.balign 2 _getgid: jmp __getgid diff --git a/lib/libc/syscall/getgroups.s b/lib/libc/syscall/getgroups.S similarity index 55% rename from lib/libc/syscall/getgroups.s rename to lib/libc/syscall/getgroups.S index bcbb40afa..cffb42999 100644 --- a/lib/libc/syscall/getgroups.s +++ b/lib/libc/syscall/getgroups.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getgroups -.define _getgroups -.align 2 +.globl _getgroups +.balign 2 _getgroups: jmp __getgroups diff --git a/lib/libc/syscall/getitimer.S b/lib/libc/syscall/getitimer.S new file mode 100644 index 000000000..a30dba630 --- /dev/null +++ b/lib/libc/syscall/getitimer.S @@ -0,0 +1,7 @@ +.text +.extern __getitimer +.globl _getitimer +.balign 2 + +_getitimer: + jmp __getitimer diff --git a/lib/libc/syscall/getitimer.s b/lib/libc/syscall/getitimer.s deleted file mode 100644 index 413dea463..000000000 --- a/lib/libc/syscall/getitimer.s +++ /dev/null @@ -1,7 +0,0 @@ -.sect .text -.extern __getitimer -.define _getitimer -.align 2 - -_getitimer: - jmp __getitimer diff --git a/lib/libc/syscall/getngid.s b/lib/libc/syscall/getngid.S similarity index 53% rename from lib/libc/syscall/getngid.s rename to lib/libc/syscall/getngid.S index 810d9f2cc..bbd4a0eb9 100644 --- a/lib/libc/syscall/getngid.s +++ b/lib/libc/syscall/getngid.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getngid -.define _getngid -.align 2 +.globl _getngid +.balign 2 _getngid: jmp __getngid diff --git a/lib/libc/syscall/getnpid.s b/lib/libc/syscall/getnpid.S similarity index 53% rename from lib/libc/syscall/getnpid.s rename to lib/libc/syscall/getnpid.S index 4547f01fc..f97506659 100644 --- a/lib/libc/syscall/getnpid.s +++ b/lib/libc/syscall/getnpid.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getnpid -.define _getnpid -.align 2 +.globl _getnpid +.balign 2 _getnpid: jmp __getnpid diff --git a/lib/libc/syscall/getnprocnr.s b/lib/libc/syscall/getnprocnr.S similarity index 56% rename from lib/libc/syscall/getnprocnr.s rename to lib/libc/syscall/getnprocnr.S index 482187b3e..18a44908e 100644 --- a/lib/libc/syscall/getnprocnr.s +++ b/lib/libc/syscall/getnprocnr.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getnprocnr -.define _getnprocnr -.align 2 +.globl _getnprocnr +.balign 2 _getnprocnr: jmp __getnprocnr diff --git a/lib/libc/syscall/getnuid.s b/lib/libc/syscall/getnuid.S similarity index 53% rename from lib/libc/syscall/getnuid.s rename to lib/libc/syscall/getnuid.S index be9487588..05c65bb6a 100644 --- a/lib/libc/syscall/getnuid.s +++ b/lib/libc/syscall/getnuid.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getnuid -.define _getnuid -.align 2 +.globl _getnuid +.balign 2 _getnuid: jmp __getnuid diff --git a/lib/libc/syscall/getpgrp.s b/lib/libc/syscall/getpgrp.S similarity index 53% rename from lib/libc/syscall/getpgrp.s rename to lib/libc/syscall/getpgrp.S index 2f7abb332..22d79abdd 100644 --- a/lib/libc/syscall/getpgrp.s +++ b/lib/libc/syscall/getpgrp.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getpgrp -.define _getpgrp -.align 2 +.globl _getpgrp +.balign 2 _getpgrp: jmp __getpgrp diff --git a/lib/libc/syscall/getpid.s b/lib/libc/syscall/getpid.S similarity index 52% rename from lib/libc/syscall/getpid.s rename to lib/libc/syscall/getpid.S index ea176ae0a..474b90b8b 100644 --- a/lib/libc/syscall/getpid.s +++ b/lib/libc/syscall/getpid.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getpid -.define _getpid -.align 2 +.globl _getpid +.balign 2 _getpid: jmp __getpid diff --git a/lib/libc/syscall/getppid.s b/lib/libc/syscall/getppid.S similarity index 53% rename from lib/libc/syscall/getppid.s rename to lib/libc/syscall/getppid.S index d0ee47400..060d9206b 100644 --- a/lib/libc/syscall/getppid.s +++ b/lib/libc/syscall/getppid.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getppid -.define _getppid -.align 2 +.globl _getppid +.balign 2 _getppid: jmp __getppid diff --git a/lib/libc/syscall/getpprocnr.s b/lib/libc/syscall/getpprocnr.S similarity index 56% rename from lib/libc/syscall/getpprocnr.s rename to lib/libc/syscall/getpprocnr.S index 009e063fb..647b7d295 100644 --- a/lib/libc/syscall/getpprocnr.s +++ b/lib/libc/syscall/getpprocnr.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getpprocnr -.define _getpprocnr -.align 2 +.globl _getpprocnr +.balign 2 _getpprocnr: jmp __getpprocnr diff --git a/lib/libc/syscall/getprocnr.s b/lib/libc/syscall/getprocnr.S similarity index 55% rename from lib/libc/syscall/getprocnr.s rename to lib/libc/syscall/getprocnr.S index a36c560e3..5b394fb1f 100644 --- a/lib/libc/syscall/getprocnr.s +++ b/lib/libc/syscall/getprocnr.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getprocnr -.define _getprocnr -.align 2 +.globl _getprocnr +.balign 2 _getprocnr: jmp __getprocnr diff --git a/lib/libc/syscall/getsigset.s b/lib/libc/syscall/getsigset.S similarity index 55% rename from lib/libc/syscall/getsigset.s rename to lib/libc/syscall/getsigset.S index 59c5ffd42..e9211e055 100644 --- a/lib/libc/syscall/getsigset.s +++ b/lib/libc/syscall/getsigset.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getsigset -.define _getsigset -.align 2 +.globl _getsigset +.balign 2 _getsigset: jmp __getsigset diff --git a/lib/libc/syscall/getsysinfo.s b/lib/libc/syscall/getsysinfo.S similarity index 64% rename from lib/libc/syscall/getsysinfo.s rename to lib/libc/syscall/getsysinfo.S index da6ca3a2e..e9bfaae08 100644 --- a/lib/libc/syscall/getsysinfo.s +++ b/lib/libc/syscall/getsysinfo.S @@ -1,9 +1,9 @@ -.sect .text +.text .extern __getsysinfo -.define _getsysinfo +.globl _getsysinfo .extern __getsysinfo_up -.define _getsysinfo_up -.align 2 +.globl _getsysinfo_up +.balign 2 _getsysinfo: jmp __getsysinfo diff --git a/lib/libc/syscall/getuid.s b/lib/libc/syscall/getuid.S similarity index 52% rename from lib/libc/syscall/getuid.s rename to lib/libc/syscall/getuid.S index fb4d40dbc..d703b0d0f 100644 --- a/lib/libc/syscall/getuid.s +++ b/lib/libc/syscall/getuid.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __getuid -.define _getuid -.align 2 +.globl _getuid +.balign 2 _getuid: jmp __getuid diff --git a/lib/libc/syscall/ioctl.s b/lib/libc/syscall/ioctl.S similarity index 51% rename from lib/libc/syscall/ioctl.s rename to lib/libc/syscall/ioctl.S index 863165d39..6ede264a3 100644 --- a/lib/libc/syscall/ioctl.s +++ b/lib/libc/syscall/ioctl.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __ioctl -.define _ioctl -.align 2 +.globl _ioctl +.balign 2 _ioctl: jmp __ioctl diff --git a/lib/libc/syscall/isatty.s b/lib/libc/syscall/isatty.S similarity index 52% rename from lib/libc/syscall/isatty.s rename to lib/libc/syscall/isatty.S index bbb5ed971..24ffe3eb1 100644 --- a/lib/libc/syscall/isatty.s +++ b/lib/libc/syscall/isatty.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __isatty -.define _isatty -.align 2 +.globl _isatty +.balign 2 _isatty: jmp __isatty diff --git a/lib/libc/syscall/kill.s b/lib/libc/syscall/kill.S similarity index 50% rename from lib/libc/syscall/kill.s rename to lib/libc/syscall/kill.S index db8775b12..396e73ddb 100644 --- a/lib/libc/syscall/kill.s +++ b/lib/libc/syscall/kill.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __kill -.define _kill -.align 2 +.globl _kill +.balign 2 _kill: jmp __kill diff --git a/lib/libc/syscall/killpg.s b/lib/libc/syscall/killpg.S similarity index 52% rename from lib/libc/syscall/killpg.s rename to lib/libc/syscall/killpg.S index a531137dd..f6b17aa1b 100644 --- a/lib/libc/syscall/killpg.s +++ b/lib/libc/syscall/killpg.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __killpg -.define _killpg -.align 2 +.globl _killpg +.balign 2 _killpg: jmp __killpg diff --git a/lib/libc/syscall/link.s b/lib/libc/syscall/link.S similarity index 50% rename from lib/libc/syscall/link.s rename to lib/libc/syscall/link.S index 4a96c4342..2856aef07 100644 --- a/lib/libc/syscall/link.s +++ b/lib/libc/syscall/link.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __link -.define _link -.align 2 +.globl _link +.balign 2 _link: jmp __link diff --git a/lib/libc/syscall/lseek.s b/lib/libc/syscall/lseek.S similarity index 51% rename from lib/libc/syscall/lseek.s rename to lib/libc/syscall/lseek.S index 936c27860..ebca729a4 100644 --- a/lib/libc/syscall/lseek.s +++ b/lib/libc/syscall/lseek.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __lseek -.define _lseek -.align 2 +.globl _lseek +.balign 2 _lseek: jmp __lseek diff --git a/lib/libc/syscall/lseek64.s b/lib/libc/syscall/lseek64.S similarity index 53% rename from lib/libc/syscall/lseek64.s rename to lib/libc/syscall/lseek64.S index ec8600ec9..771f5bbf3 100644 --- a/lib/libc/syscall/lseek64.s +++ b/lib/libc/syscall/lseek64.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __lseek64 -.define _lseek64 -.align 2 +.globl _lseek64 +.balign 2 _lseek64: jmp __lseek64 diff --git a/lib/libc/syscall/lstat.s b/lib/libc/syscall/lstat.S similarity index 51% rename from lib/libc/syscall/lstat.s rename to lib/libc/syscall/lstat.S index 8401ffa6f..2361529cc 100644 --- a/lib/libc/syscall/lstat.s +++ b/lib/libc/syscall/lstat.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __lstat -.define _lstat -.align 2 +.globl _lstat +.balign 2 _lstat: jmp __lstat diff --git a/lib/libc/syscall/mapdriver.s b/lib/libc/syscall/mapdriver.S similarity index 55% rename from lib/libc/syscall/mapdriver.s rename to lib/libc/syscall/mapdriver.S index c8c95c572..ac935e0cf 100644 --- a/lib/libc/syscall/mapdriver.s +++ b/lib/libc/syscall/mapdriver.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __mapdriver -.define _mapdriver -.align 2 +.globl _mapdriver +.balign 2 _mapdriver: jmp __mapdriver diff --git a/lib/libc/syscall/mkdir.s b/lib/libc/syscall/mkdir.S similarity index 51% rename from lib/libc/syscall/mkdir.s rename to lib/libc/syscall/mkdir.S index 43bd99414..8abb1f9ee 100644 --- a/lib/libc/syscall/mkdir.s +++ b/lib/libc/syscall/mkdir.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __mkdir -.define _mkdir -.align 2 +.globl _mkdir +.balign 2 _mkdir: jmp __mkdir diff --git a/lib/libc/syscall/mkfifo.s b/lib/libc/syscall/mkfifo.S similarity index 52% rename from lib/libc/syscall/mkfifo.s rename to lib/libc/syscall/mkfifo.S index 91ec0f151..07a29d5ae 100644 --- a/lib/libc/syscall/mkfifo.s +++ b/lib/libc/syscall/mkfifo.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __mkfifo -.define _mkfifo -.align 2 +.globl _mkfifo +.balign 2 _mkfifo: jmp __mkfifo diff --git a/lib/libc/syscall/mknod.s b/lib/libc/syscall/mknod.S similarity index 51% rename from lib/libc/syscall/mknod.s rename to lib/libc/syscall/mknod.S index 045cdfdd2..16794f3a0 100644 --- a/lib/libc/syscall/mknod.s +++ b/lib/libc/syscall/mknod.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __mknod -.define _mknod -.align 2 +.globl _mknod +.balign 2 _mknod: jmp __mknod diff --git a/lib/libc/syscall/mmap.s b/lib/libc/syscall/mmap.S similarity index 64% rename from lib/libc/syscall/mmap.s rename to lib/libc/syscall/mmap.S index a6c4b80a4..0ea709587 100644 --- a/lib/libc/syscall/mmap.s +++ b/lib/libc/syscall/mmap.S @@ -1,11 +1,11 @@ -.sect .text +.text .extern __mmap -.define _mmap +.globl _mmap .extern __munmap -.define _munmap +.globl _munmap .extern __munmap_text -.define _munmap_text -.align 2 +.globl _munmap_text +.balign 2 _mmap: jmp __mmap diff --git a/lib/libc/syscall/mount.s b/lib/libc/syscall/mount.S similarity index 51% rename from lib/libc/syscall/mount.s rename to lib/libc/syscall/mount.S index 4bdbac562..22f09c519 100644 --- a/lib/libc/syscall/mount.s +++ b/lib/libc/syscall/mount.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __mount -.define _mount -.align 2 +.globl _mount +.balign 2 _mount: jmp __mount diff --git a/lib/libc/syscall/nanosleep.s b/lib/libc/syscall/nanosleep.S similarity index 61% rename from lib/libc/syscall/nanosleep.s rename to lib/libc/syscall/nanosleep.S index 2d8b4e751..66eb3ecbb 100644 --- a/lib/libc/syscall/nanosleep.s +++ b/lib/libc/syscall/nanosleep.S @@ -1,6 +1,6 @@ -.sect .text +.text .extern __nanosleep -.define _nanosleep +.globl _nanosleep _nanosleep: jmp __nanosleep diff --git a/lib/libc/syscall/open.s b/lib/libc/syscall/open.S similarity index 50% rename from lib/libc/syscall/open.s rename to lib/libc/syscall/open.S index 255c9836b..e178bd39f 100644 --- a/lib/libc/syscall/open.s +++ b/lib/libc/syscall/open.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __open -.define _open -.align 2 +.globl _open +.balign 2 _open: jmp __open diff --git a/lib/libc/syscall/opendir.s b/lib/libc/syscall/opendir.S similarity index 53% rename from lib/libc/syscall/opendir.s rename to lib/libc/syscall/opendir.S index 07f35c63c..cbfd761f5 100644 --- a/lib/libc/syscall/opendir.s +++ b/lib/libc/syscall/opendir.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __opendir -.define _opendir -.align 2 +.globl _opendir +.balign 2 _opendir: jmp __opendir diff --git a/lib/libc/syscall/pathconf.s b/lib/libc/syscall/pathconf.S similarity index 54% rename from lib/libc/syscall/pathconf.s rename to lib/libc/syscall/pathconf.S index 6215a76f6..a891a790b 100644 --- a/lib/libc/syscall/pathconf.s +++ b/lib/libc/syscall/pathconf.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __pathconf -.define _pathconf -.align 2 +.globl _pathconf +.balign 2 _pathconf: jmp __pathconf diff --git a/lib/libc/syscall/pause.s b/lib/libc/syscall/pause.S similarity index 51% rename from lib/libc/syscall/pause.s rename to lib/libc/syscall/pause.S index c1e7adb6e..69c5e8fd1 100644 --- a/lib/libc/syscall/pause.s +++ b/lib/libc/syscall/pause.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __pause -.define _pause -.align 2 +.globl _pause +.balign 2 _pause: jmp __pause diff --git a/lib/libc/syscall/pipe.s b/lib/libc/syscall/pipe.S similarity index 50% rename from lib/libc/syscall/pipe.s rename to lib/libc/syscall/pipe.S index 8115ea72b..e66f1ac07 100644 --- a/lib/libc/syscall/pipe.s +++ b/lib/libc/syscall/pipe.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __pipe -.define _pipe -.align 2 +.globl _pipe +.balign 2 _pipe: jmp __pipe diff --git a/lib/libc/syscall/ptrace.s b/lib/libc/syscall/ptrace.S similarity index 52% rename from lib/libc/syscall/ptrace.s rename to lib/libc/syscall/ptrace.S index ac30974da..d88e67850 100644 --- a/lib/libc/syscall/ptrace.s +++ b/lib/libc/syscall/ptrace.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __ptrace -.define _ptrace -.align 2 +.globl _ptrace +.balign 2 _ptrace: jmp __ptrace diff --git a/lib/libc/syscall/read.s b/lib/libc/syscall/read.S similarity index 50% rename from lib/libc/syscall/read.s rename to lib/libc/syscall/read.S index a61010cfb..a12fdb027 100644 --- a/lib/libc/syscall/read.s +++ b/lib/libc/syscall/read.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __read -.define _read -.align 2 +.globl _read +.balign 2 _read: jmp __read diff --git a/lib/libc/syscall/readdir.s b/lib/libc/syscall/readdir.S similarity index 53% rename from lib/libc/syscall/readdir.s rename to lib/libc/syscall/readdir.S index ab6784de8..063c6e975 100644 --- a/lib/libc/syscall/readdir.s +++ b/lib/libc/syscall/readdir.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __readdir -.define _readdir -.align 2 +.globl _readdir +.balign 2 _readdir: jmp __readdir diff --git a/lib/libc/syscall/readlink.s b/lib/libc/syscall/readlink.S similarity index 54% rename from lib/libc/syscall/readlink.s rename to lib/libc/syscall/readlink.S index 2695bb2b8..4036b7162 100644 --- a/lib/libc/syscall/readlink.s +++ b/lib/libc/syscall/readlink.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __readlink -.define _readlink -.align 2 +.globl _readlink +.balign 2 _readlink: jmp __readlink diff --git a/lib/libc/syscall/reboot.s b/lib/libc/syscall/reboot.S similarity index 52% rename from lib/libc/syscall/reboot.s rename to lib/libc/syscall/reboot.S index 2883b7790..cbac2654e 100644 --- a/lib/libc/syscall/reboot.s +++ b/lib/libc/syscall/reboot.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __reboot -.define _reboot -.align 2 +.globl _reboot +.balign 2 _reboot: jmp __reboot diff --git a/lib/libc/syscall/rename.s b/lib/libc/syscall/rename.S similarity index 52% rename from lib/libc/syscall/rename.s rename to lib/libc/syscall/rename.S index 43e65ec22..2ea65c559 100644 --- a/lib/libc/syscall/rename.s +++ b/lib/libc/syscall/rename.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __rename -.define _rename -.align 2 +.globl _rename +.balign 2 _rename: jmp __rename diff --git a/lib/libc/syscall/rewinddir.s b/lib/libc/syscall/rewinddir.S similarity index 55% rename from lib/libc/syscall/rewinddir.s rename to lib/libc/syscall/rewinddir.S index 7b12a16f2..092917673 100644 --- a/lib/libc/syscall/rewinddir.s +++ b/lib/libc/syscall/rewinddir.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __rewinddir -.define _rewinddir -.align 2 +.globl _rewinddir +.balign 2 _rewinddir: jmp __rewinddir diff --git a/lib/libc/syscall/rmdir.s b/lib/libc/syscall/rmdir.S similarity index 51% rename from lib/libc/syscall/rmdir.s rename to lib/libc/syscall/rmdir.S index 009875946..ed25ee453 100644 --- a/lib/libc/syscall/rmdir.s +++ b/lib/libc/syscall/rmdir.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __rmdir -.define _rmdir -.align 2 +.globl _rmdir +.balign 2 _rmdir: jmp __rmdir diff --git a/lib/libc/syscall/sbrk.s b/lib/libc/syscall/sbrk.S similarity index 50% rename from lib/libc/syscall/sbrk.s rename to lib/libc/syscall/sbrk.S index 273b63fed..82cbf06dc 100644 --- a/lib/libc/syscall/sbrk.s +++ b/lib/libc/syscall/sbrk.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sbrk -.define _sbrk -.align 2 +.globl _sbrk +.balign 2 _sbrk: jmp __sbrk diff --git a/lib/libc/syscall/seekdir.s b/lib/libc/syscall/seekdir.S similarity index 53% rename from lib/libc/syscall/seekdir.s rename to lib/libc/syscall/seekdir.S index 9c90b95a1..4f1aa79dd 100644 --- a/lib/libc/syscall/seekdir.s +++ b/lib/libc/syscall/seekdir.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __seekdir -.define _seekdir -.align 2 +.globl _seekdir +.balign 2 _seekdir: jmp __seekdir diff --git a/lib/libc/syscall/select.s b/lib/libc/syscall/select.S similarity index 52% rename from lib/libc/syscall/select.s rename to lib/libc/syscall/select.S index 4395e5600..5e8598af4 100644 --- a/lib/libc/syscall/select.s +++ b/lib/libc/syscall/select.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __select -.define _select -.align 2 +.globl _select +.balign 2 _select: jmp __select diff --git a/lib/libc/syscall/setgid.s b/lib/libc/syscall/setgid.S similarity index 55% rename from lib/libc/syscall/setgid.s rename to lib/libc/syscall/setgid.S index 03c76ec8f..ab45f1aa2 100644 --- a/lib/libc/syscall/setgid.s +++ b/lib/libc/syscall/setgid.S @@ -1,8 +1,8 @@ -.sect .text +.text .extern __setgid -.define _setgid -.define _setegid -.align 2 +.globl _setgid +.globl _setegid +.balign 2 _setgid: jmp __setgid diff --git a/lib/libc/syscall/setgroups.s b/lib/libc/syscall/setgroups.S similarity index 55% rename from lib/libc/syscall/setgroups.s rename to lib/libc/syscall/setgroups.S index 3cf8b500b..edc5702cd 100644 --- a/lib/libc/syscall/setgroups.s +++ b/lib/libc/syscall/setgroups.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __setgroups -.define _setgroups -.align 2 +.globl _setgroups +.balign 2 _setgroups: jmp __setgroups diff --git a/lib/libc/syscall/setitimer.S b/lib/libc/syscall/setitimer.S new file mode 100644 index 000000000..c4ab9934d --- /dev/null +++ b/lib/libc/syscall/setitimer.S @@ -0,0 +1,7 @@ +.text +.extern __setitimer +.globl _setitimer +.balign 2 + +_setitimer: + jmp __setitimer diff --git a/lib/libc/syscall/setitimer.s b/lib/libc/syscall/setitimer.s deleted file mode 100644 index 6018a1a46..000000000 --- a/lib/libc/syscall/setitimer.s +++ /dev/null @@ -1,7 +0,0 @@ -.sect .text -.extern __setitimer -.define _setitimer -.align 2 - -_setitimer: - jmp __setitimer diff --git a/lib/libc/syscall/setsid.s b/lib/libc/syscall/setsid.S similarity index 52% rename from lib/libc/syscall/setsid.s rename to lib/libc/syscall/setsid.S index a834bb71f..8d49d48fd 100644 --- a/lib/libc/syscall/setsid.s +++ b/lib/libc/syscall/setsid.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __setsid -.define _setsid -.align 2 +.globl _setsid +.balign 2 _setsid: jmp __setsid diff --git a/lib/libc/syscall/setuid.s b/lib/libc/syscall/setuid.S similarity index 55% rename from lib/libc/syscall/setuid.s rename to lib/libc/syscall/setuid.S index fb5549f90..e2600b6c6 100644 --- a/lib/libc/syscall/setuid.s +++ b/lib/libc/syscall/setuid.S @@ -1,8 +1,8 @@ -.sect .text +.text .extern __setuid -.define _setuid -.define _seteuid -.align 2 +.globl _setuid +.globl _seteuid +.balign 2 _setuid: jmp __setuid diff --git a/lib/libc/syscall/sigaction.s b/lib/libc/syscall/sigaction.S similarity index 55% rename from lib/libc/syscall/sigaction.s rename to lib/libc/syscall/sigaction.S index bac3e796c..7899bdd13 100644 --- a/lib/libc/syscall/sigaction.s +++ b/lib/libc/syscall/sigaction.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sigaction -.define _sigaction -.align 2 +.globl _sigaction +.balign 2 _sigaction: jmp __sigaction diff --git a/lib/libc/syscall/sigaddset.s b/lib/libc/syscall/sigaddset.S similarity index 55% rename from lib/libc/syscall/sigaddset.s rename to lib/libc/syscall/sigaddset.S index 88d2fc920..b1189250c 100644 --- a/lib/libc/syscall/sigaddset.s +++ b/lib/libc/syscall/sigaddset.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sigaddset -.define _sigaddset -.align 2 +.globl _sigaddset +.balign 2 _sigaddset: jmp __sigaddset diff --git a/lib/libc/syscall/sigdelset.s b/lib/libc/syscall/sigdelset.S similarity index 55% rename from lib/libc/syscall/sigdelset.s rename to lib/libc/syscall/sigdelset.S index f91178876..be30fe108 100644 --- a/lib/libc/syscall/sigdelset.s +++ b/lib/libc/syscall/sigdelset.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sigdelset -.define _sigdelset -.align 2 +.globl _sigdelset +.balign 2 _sigdelset: jmp __sigdelset diff --git a/lib/libc/syscall/sigemptyset.s b/lib/libc/syscall/sigemptyset.S similarity index 57% rename from lib/libc/syscall/sigemptyset.s rename to lib/libc/syscall/sigemptyset.S index c92e2475d..f5170de58 100644 --- a/lib/libc/syscall/sigemptyset.s +++ b/lib/libc/syscall/sigemptyset.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sigemptyset -.define _sigemptyset -.align 2 +.globl _sigemptyset +.balign 2 _sigemptyset: jmp __sigemptyset diff --git a/lib/libc/syscall/sigfillset.s b/lib/libc/syscall/sigfillset.S similarity index 56% rename from lib/libc/syscall/sigfillset.s rename to lib/libc/syscall/sigfillset.S index b9f729285..4fcecf388 100644 --- a/lib/libc/syscall/sigfillset.s +++ b/lib/libc/syscall/sigfillset.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sigfillset -.define _sigfillset -.align 2 +.globl _sigfillset +.balign 2 _sigfillset: jmp __sigfillset diff --git a/lib/libc/syscall/sigismember.s b/lib/libc/syscall/sigismember.S similarity index 57% rename from lib/libc/syscall/sigismember.s rename to lib/libc/syscall/sigismember.S index 93ed0e64f..31189e980 100644 --- a/lib/libc/syscall/sigismember.s +++ b/lib/libc/syscall/sigismember.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sigismember -.define _sigismember -.align 2 +.globl _sigismember +.balign 2 _sigismember: jmp __sigismember diff --git a/lib/libc/syscall/sigpending.s b/lib/libc/syscall/sigpending.S similarity index 56% rename from lib/libc/syscall/sigpending.s rename to lib/libc/syscall/sigpending.S index 608c46d85..43ef7e9e9 100644 --- a/lib/libc/syscall/sigpending.s +++ b/lib/libc/syscall/sigpending.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sigpending -.define _sigpending -.align 2 +.globl _sigpending +.balign 2 _sigpending: jmp __sigpending diff --git a/lib/libc/syscall/sigprocmask.s b/lib/libc/syscall/sigprocmask.S similarity index 57% rename from lib/libc/syscall/sigprocmask.s rename to lib/libc/syscall/sigprocmask.S index fc4ddc034..d3b343bfd 100644 --- a/lib/libc/syscall/sigprocmask.s +++ b/lib/libc/syscall/sigprocmask.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sigprocmask -.define _sigprocmask -.align 2 +.globl _sigprocmask +.balign 2 _sigprocmask: jmp __sigprocmask diff --git a/lib/libc/syscall/sigreturn.s b/lib/libc/syscall/sigreturn.S similarity index 55% rename from lib/libc/syscall/sigreturn.s rename to lib/libc/syscall/sigreturn.S index 2f5e9e301..7211fcd15 100644 --- a/lib/libc/syscall/sigreturn.s +++ b/lib/libc/syscall/sigreturn.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sigreturn -.define _sigreturn -.align 2 +.globl _sigreturn +.balign 2 _sigreturn: jmp __sigreturn diff --git a/lib/libc/syscall/sigsuspend.s b/lib/libc/syscall/sigsuspend.S similarity index 56% rename from lib/libc/syscall/sigsuspend.s rename to lib/libc/syscall/sigsuspend.S index ca4934cfb..8bef82a19 100644 --- a/lib/libc/syscall/sigsuspend.s +++ b/lib/libc/syscall/sigsuspend.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sigsuspend -.define _sigsuspend -.align 2 +.globl _sigsuspend +.balign 2 _sigsuspend: jmp __sigsuspend diff --git a/lib/libc/syscall/sleep.s b/lib/libc/syscall/sleep.S similarity index 50% rename from lib/libc/syscall/sleep.s rename to lib/libc/syscall/sleep.S index c395c9fb7..afd5f2779 100644 --- a/lib/libc/syscall/sleep.s +++ b/lib/libc/syscall/sleep.S @@ -1,8 +1,7 @@ -.sect .text +.text .extern __sleep -.define _sleep -.align 2 +.globl _sleep +.balign 2 _sleep: jmp __sleep - diff --git a/lib/libc/syscall/sprofile.s b/lib/libc/syscall/sprofile.S similarity index 54% rename from lib/libc/syscall/sprofile.s rename to lib/libc/syscall/sprofile.S index 61ff1c6bd..3621ad2d7 100644 --- a/lib/libc/syscall/sprofile.s +++ b/lib/libc/syscall/sprofile.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sprofile -.define _sprofile -.align 2 +.globl _sprofile +.balign 2 _sprofile: jmp __sprofile diff --git a/lib/libc/syscall/stat.s b/lib/libc/syscall/stat.S similarity index 50% rename from lib/libc/syscall/stat.s rename to lib/libc/syscall/stat.S index 7b966ca7f..64fc110ba 100644 --- a/lib/libc/syscall/stat.s +++ b/lib/libc/syscall/stat.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __stat -.define _stat -.align 2 +.globl _stat +.balign 2 _stat: jmp __stat diff --git a/lib/libc/syscall/stime.s b/lib/libc/syscall/stime.S similarity index 51% rename from lib/libc/syscall/stime.s rename to lib/libc/syscall/stime.S index 516469a70..bf8b0fbed 100644 --- a/lib/libc/syscall/stime.s +++ b/lib/libc/syscall/stime.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __stime -.define _stime -.align 2 +.globl _stime +.balign 2 _stime: jmp __stime diff --git a/lib/libc/syscall/svrctl.s b/lib/libc/syscall/svrctl.S similarity index 52% rename from lib/libc/syscall/svrctl.s rename to lib/libc/syscall/svrctl.S index f477737b0..53914debe 100644 --- a/lib/libc/syscall/svrctl.s +++ b/lib/libc/syscall/svrctl.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __svrctl -.define _svrctl -.align 2 +.globl _svrctl +.balign 2 _svrctl: jmp __svrctl diff --git a/lib/libc/syscall/symlink.s b/lib/libc/syscall/symlink.S similarity index 53% rename from lib/libc/syscall/symlink.s rename to lib/libc/syscall/symlink.S index 53c5e1018..4c16db2ba 100644 --- a/lib/libc/syscall/symlink.s +++ b/lib/libc/syscall/symlink.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __symlink -.define _symlink -.align 2 +.globl _symlink +.balign 2 _symlink: jmp __symlink diff --git a/lib/libc/syscall/sync.s b/lib/libc/syscall/sync.S similarity index 50% rename from lib/libc/syscall/sync.s rename to lib/libc/syscall/sync.S index 8ad7e3bed..f29208a9d 100644 --- a/lib/libc/syscall/sync.s +++ b/lib/libc/syscall/sync.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sync -.define _sync -.align 2 +.globl _sync +.balign 2 _sync: jmp __sync diff --git a/lib/libc/syscall/sysuname.s b/lib/libc/syscall/sysuname.S similarity index 54% rename from lib/libc/syscall/sysuname.s rename to lib/libc/syscall/sysuname.S index 2d8d7541c..7add73abf 100644 --- a/lib/libc/syscall/sysuname.s +++ b/lib/libc/syscall/sysuname.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __sysuname -.define _sysuname -.align 2 +.globl _sysuname +.balign 2 _sysuname: jmp __sysuname diff --git a/lib/libc/syscall/tcdrain.s b/lib/libc/syscall/tcdrain.S similarity index 53% rename from lib/libc/syscall/tcdrain.s rename to lib/libc/syscall/tcdrain.S index 7dfaa9db3..50ab346b3 100644 --- a/lib/libc/syscall/tcdrain.s +++ b/lib/libc/syscall/tcdrain.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __tcdrain -.define _tcdrain -.align 2 +.globl _tcdrain +.balign 2 _tcdrain: jmp __tcdrain diff --git a/lib/libc/syscall/tcflow.s b/lib/libc/syscall/tcflow.S similarity index 52% rename from lib/libc/syscall/tcflow.s rename to lib/libc/syscall/tcflow.S index 69b8f9ca4..3304165cc 100644 --- a/lib/libc/syscall/tcflow.s +++ b/lib/libc/syscall/tcflow.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __tcflow -.define _tcflow -.align 2 +.globl _tcflow +.balign 2 _tcflow: jmp __tcflow diff --git a/lib/libc/syscall/tcflush.s b/lib/libc/syscall/tcflush.S similarity index 53% rename from lib/libc/syscall/tcflush.s rename to lib/libc/syscall/tcflush.S index c1067fd09..a6f0b321a 100644 --- a/lib/libc/syscall/tcflush.s +++ b/lib/libc/syscall/tcflush.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __tcflush -.define _tcflush -.align 2 +.globl _tcflush +.balign 2 _tcflush: jmp __tcflush diff --git a/lib/libc/syscall/tcgetattr.s b/lib/libc/syscall/tcgetattr.S similarity index 55% rename from lib/libc/syscall/tcgetattr.s rename to lib/libc/syscall/tcgetattr.S index 5fbb7f9d4..866c0ae04 100644 --- a/lib/libc/syscall/tcgetattr.s +++ b/lib/libc/syscall/tcgetattr.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __tcgetattr -.define _tcgetattr -.align 2 +.globl _tcgetattr +.balign 2 _tcgetattr: jmp __tcgetattr diff --git a/lib/libc/syscall/tcsendbreak.s b/lib/libc/syscall/tcsendbreak.S similarity index 57% rename from lib/libc/syscall/tcsendbreak.s rename to lib/libc/syscall/tcsendbreak.S index e91d6892d..1d14e18ce 100644 --- a/lib/libc/syscall/tcsendbreak.s +++ b/lib/libc/syscall/tcsendbreak.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __tcsendbreak -.define _tcsendbreak -.align 2 +.globl _tcsendbreak +.balign 2 _tcsendbreak: jmp __tcsendbreak diff --git a/lib/libc/syscall/tcsetattr.s b/lib/libc/syscall/tcsetattr.S similarity index 55% rename from lib/libc/syscall/tcsetattr.s rename to lib/libc/syscall/tcsetattr.S index 896c6c0aa..f1a8bde4d 100644 --- a/lib/libc/syscall/tcsetattr.s +++ b/lib/libc/syscall/tcsetattr.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __tcsetattr -.define _tcsetattr -.align 2 +.globl _tcsetattr +.balign 2 _tcsetattr: jmp __tcsetattr diff --git a/lib/libc/syscall/time.s b/lib/libc/syscall/time.S similarity index 50% rename from lib/libc/syscall/time.s rename to lib/libc/syscall/time.S index e0d424bec..0ba1389e4 100644 --- a/lib/libc/syscall/time.s +++ b/lib/libc/syscall/time.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __time -.define _time -.align 2 +.globl _time +.balign 2 _time: jmp __time diff --git a/lib/libc/syscall/times.s b/lib/libc/syscall/times.S similarity index 51% rename from lib/libc/syscall/times.s rename to lib/libc/syscall/times.S index 34624d42b..5bf1e9b44 100644 --- a/lib/libc/syscall/times.s +++ b/lib/libc/syscall/times.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __times -.define _times -.align 2 +.globl _times +.balign 2 _times: jmp __times diff --git a/lib/libc/syscall/truncate.s b/lib/libc/syscall/truncate.S similarity index 59% rename from lib/libc/syscall/truncate.s rename to lib/libc/syscall/truncate.S index 1915ad785..19ca7c115 100644 --- a/lib/libc/syscall/truncate.s +++ b/lib/libc/syscall/truncate.S @@ -1,13 +1,13 @@ -.sect .text +.text .extern __truncate .extern __ftruncate -.define _truncate -.define _ftruncate -.align 2 +.globl _truncate +.globl _ftruncate +.balign 2 _truncate: jmp __truncate -.align 2 +.balign 2 _ftruncate: jmp __ftruncate diff --git a/lib/libc/syscall/umask.s b/lib/libc/syscall/umask.S similarity index 51% rename from lib/libc/syscall/umask.s rename to lib/libc/syscall/umask.S index b882d1967..ea9440e81 100644 --- a/lib/libc/syscall/umask.s +++ b/lib/libc/syscall/umask.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __umask -.define _umask -.align 2 +.globl _umask +.balign 2 _umask: jmp __umask diff --git a/lib/libc/syscall/umount.s b/lib/libc/syscall/umount.S similarity index 52% rename from lib/libc/syscall/umount.s rename to lib/libc/syscall/umount.S index 0e44c9516..017507324 100644 --- a/lib/libc/syscall/umount.s +++ b/lib/libc/syscall/umount.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __umount -.define _umount -.align 2 +.globl _umount +.balign 2 _umount: jmp __umount diff --git a/lib/libc/syscall/uname.s b/lib/libc/syscall/uname.S similarity index 51% rename from lib/libc/syscall/uname.s rename to lib/libc/syscall/uname.S index 4a87f57ae..90e5e1cd3 100644 --- a/lib/libc/syscall/uname.s +++ b/lib/libc/syscall/uname.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __uname -.define _uname -.align 2 +.globl _uname +.balign 2 _uname: jmp __uname diff --git a/lib/libc/syscall/unlink.s b/lib/libc/syscall/unlink.S similarity index 52% rename from lib/libc/syscall/unlink.s rename to lib/libc/syscall/unlink.S index d0bea4183..c2fd587ef 100644 --- a/lib/libc/syscall/unlink.s +++ b/lib/libc/syscall/unlink.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __unlink -.define _unlink -.align 2 +.globl _unlink +.balign 2 _unlink: jmp __unlink diff --git a/lib/libc/syscall/utime.s b/lib/libc/syscall/utime.S similarity index 51% rename from lib/libc/syscall/utime.s rename to lib/libc/syscall/utime.S index 01e60e7a2..caf8ac295 100644 --- a/lib/libc/syscall/utime.s +++ b/lib/libc/syscall/utime.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __utime -.define _utime -.align 2 +.globl _utime +.balign 2 _utime: jmp __utime diff --git a/lib/libc/syscall/vm_dmacalls.s b/lib/libc/syscall/vm_dmacalls.S similarity index 65% rename from lib/libc/syscall/vm_dmacalls.s rename to lib/libc/syscall/vm_dmacalls.S index 920af0d17..9ba1aefcb 100644 --- a/lib/libc/syscall/vm_dmacalls.s +++ b/lib/libc/syscall/vm_dmacalls.S @@ -1,11 +1,11 @@ -.sect .text +.text .extern __vm_adddma -.define _vm_adddma +.globl _vm_adddma .extern __vm_deldma -.define _vm_deldma +.globl _vm_deldma .extern __vm_getdma -.define _vm_getdma -.align 2 +.globl _vm_getdma +.balign 2 _vm_adddma: jmp __vm_adddma @@ -13,4 +13,3 @@ _vm_deldma: jmp __vm_deldma _vm_getdma: jmp __vm_getdma - diff --git a/lib/libc/syscall/vm_getphys.s b/lib/libc/syscall/vm_getphys.S similarity index 56% rename from lib/libc/syscall/vm_getphys.s rename to lib/libc/syscall/vm_getphys.S index f153bfdac..1e0ae8955 100644 --- a/lib/libc/syscall/vm_getphys.s +++ b/lib/libc/syscall/vm_getphys.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __vm_getphys -.define _vm_getphys -.align 2 +.globl _vm_getphys +.balign 2 _vm_getphys: jmp __vm_getphys diff --git a/lib/libc/syscall/vm_getrefcount.s b/lib/libc/syscall/vm_getrefcount.S similarity index 59% rename from lib/libc/syscall/vm_getrefcount.s rename to lib/libc/syscall/vm_getrefcount.S index 0020cf2e7..e7cb9ef7c 100644 --- a/lib/libc/syscall/vm_getrefcount.s +++ b/lib/libc/syscall/vm_getrefcount.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __vm_getrefcount -.define _vm_getrefcount -.align 2 +.globl _vm_getrefcount +.balign 2 _vm_getrefcount: jmp __vm_getrefcount diff --git a/lib/libc/syscall/vm_query_exit.S b/lib/libc/syscall/vm_query_exit.S new file mode 100644 index 000000000..e474211cf --- /dev/null +++ b/lib/libc/syscall/vm_query_exit.S @@ -0,0 +1,7 @@ +.text +.extern __vm_query_exit +.globl _vm_query_exit +.balign 2 + +_vm_query_exit: + jmp __vm_query_exit diff --git a/lib/libc/syscall/vm_query_exit.s b/lib/libc/syscall/vm_query_exit.s deleted file mode 100644 index f84ecfd8f..000000000 --- a/lib/libc/syscall/vm_query_exit.s +++ /dev/null @@ -1,7 +0,0 @@ -.sect .text -.extern __vm_query_exit -.define _vm_query_exit -.align 2 - -_vm_query_exit: - jmp __vm_query_exit diff --git a/lib/libc/syscall/vm_remap.s b/lib/libc/syscall/vm_remap.S similarity index 54% rename from lib/libc/syscall/vm_remap.s rename to lib/libc/syscall/vm_remap.S index c8e7c0d58..c4c68f844 100644 --- a/lib/libc/syscall/vm_remap.s +++ b/lib/libc/syscall/vm_remap.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __vm_remap -.define _vm_remap -.align 2 +.globl _vm_remap +.balign 2 _vm_remap: jmp __vm_remap diff --git a/lib/libc/syscall/vm_set_priv.S b/lib/libc/syscall/vm_set_priv.S new file mode 100644 index 000000000..7f865b8ff --- /dev/null +++ b/lib/libc/syscall/vm_set_priv.S @@ -0,0 +1,7 @@ +.text +.extern __vm_set_priv +.globl _vm_set_priv +.balign 2 + +_vm_set_priv: + jmp __vm_set_priv diff --git a/lib/libc/syscall/vm_set_priv.s b/lib/libc/syscall/vm_set_priv.s deleted file mode 100644 index 09a7bc9ab..000000000 --- a/lib/libc/syscall/vm_set_priv.s +++ /dev/null @@ -1,7 +0,0 @@ -.sect .text -.extern __vm_set_priv -.define _vm_set_priv -.align 2 - -_vm_set_priv: - jmp __vm_set_priv diff --git a/lib/libc/syscall/vm_unmap.s b/lib/libc/syscall/vm_unmap.S similarity index 54% rename from lib/libc/syscall/vm_unmap.s rename to lib/libc/syscall/vm_unmap.S index 69ff2050d..c6564c225 100644 --- a/lib/libc/syscall/vm_unmap.s +++ b/lib/libc/syscall/vm_unmap.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __vm_unmap -.define _vm_unmap -.align 2 +.globl _vm_unmap +.balign 2 _vm_unmap: jmp __vm_unmap diff --git a/lib/libc/syscall/wait.s b/lib/libc/syscall/wait.S similarity index 50% rename from lib/libc/syscall/wait.s rename to lib/libc/syscall/wait.S index fc700f452..80b8f2c97 100644 --- a/lib/libc/syscall/wait.s +++ b/lib/libc/syscall/wait.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __wait -.define _wait -.align 2 +.globl _wait +.balign 2 _wait: jmp __wait diff --git a/lib/libc/syscall/waitpid.s b/lib/libc/syscall/waitpid.S similarity index 53% rename from lib/libc/syscall/waitpid.s rename to lib/libc/syscall/waitpid.S index ca4fac6f8..2efa266a7 100644 --- a/lib/libc/syscall/waitpid.s +++ b/lib/libc/syscall/waitpid.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __waitpid -.define _waitpid -.align 2 +.globl _waitpid +.balign 2 _waitpid: jmp __waitpid diff --git a/lib/libc/syscall/write.s b/lib/libc/syscall/write.S similarity index 51% rename from lib/libc/syscall/write.s rename to lib/libc/syscall/write.S index 276fed473..efb646377 100644 --- a/lib/libc/syscall/write.s +++ b/lib/libc/syscall/write.S @@ -1,7 +1,7 @@ -.sect .text +.text .extern __write -.define _write -.align 2 +.globl _write +.balign 2 _write: jmp __write diff --git a/lib/libend/Makefile b/lib/libend/Makefile index 4ce20a717..632d3a4ae 100644 --- a/lib/libend/Makefile +++ b/lib/libend/Makefile @@ -5,10 +5,10 @@ LIB=end SRCS= \ - edata.s \ - em_end.s \ - end.s \ - etext.s + edata.S \ + em_end.S \ + end.S \ + etext.S .if ${COMPILER_TYPE} == "gnu" .include "${.CURDIR}/gnu/Makefile.inc" diff --git a/lib/libend/edata.S b/lib/libend/edata.S new file mode 100644 index 000000000..a598c6e1e --- /dev/null +++ b/lib/libend/edata.S @@ -0,0 +1,10 @@ +.text +#if defined(__ACK__) +.rom +#else +.data +#endif +.data +.balign _EM_WSIZE +.globl _edata +_edata: diff --git a/lib/libend/edata.s b/lib/libend/edata.s deleted file mode 100644 index ad44a9795..000000000 --- a/lib/libend/edata.s +++ /dev/null @@ -1,7 +0,0 @@ -# -.sect .text -.sect .rom -.sect .data -.align _EM_WSIZE -.define _edata -_edata: diff --git a/lib/libend/em_end.S b/lib/libend/em_end.S new file mode 100644 index 000000000..a1a09e7e2 --- /dev/null +++ b/lib/libend/em_end.S @@ -0,0 +1,26 @@ +.text +.balign _EM_WSIZE +.globl __etext, endtext +__etext: +endtext: +#if defined(__ACK__) +.rom +#else +.data +#endif +.balign _EM_WSIZE +.globl endrom +endrom: +.data +.balign _EM_WSIZE +.globl __edata, enddata +__edata: +enddata: +.bss +.balign _EM_WSIZE +#if defined(__ACK__) +.end /* only for declaration of _end, __end or endbss. */ +.globl __end, endbss +__end: +endbss: +#endif diff --git a/lib/libend/em_end.s b/lib/libend/em_end.s deleted file mode 100644 index ad10ad1f5..000000000 --- a/lib/libend/em_end.s +++ /dev/null @@ -1,21 +0,0 @@ -# -.sect .text -.align _EM_WSIZE -.define __etext, endtext -__etext: -endtext: -.sect .rom -.align _EM_WSIZE -.define endrom -endrom: -.sect .data -.align _EM_WSIZE -.define __edata, enddata -__edata: -enddata: -.sect .bss -.align _EM_WSIZE -.sect .end ! only for declaration of _end, __end or endbss. -.define __end, endbss -__end: -endbss: diff --git a/lib/libend/end.S b/lib/libend/end.S new file mode 100644 index 000000000..a2efbdbc0 --- /dev/null +++ b/lib/libend/end.S @@ -0,0 +1,13 @@ +.text +#if defined(__ACK__) +.rom +#else +.data +#endif +.data +.bss +#if defined(__ACK__) +.end /* only for declaration of _end, __end or endbss. */ +.globl _end +_end: +#endif diff --git a/lib/libend/end.s b/lib/libend/end.s deleted file mode 100644 index bbd338d9e..000000000 --- a/lib/libend/end.s +++ /dev/null @@ -1,7 +0,0 @@ -.sect .text -.sect .rom -.sect .data -.sect .bss -.sect .end ! only for declaration of _end, __end or endbss. -.define _end -_end: diff --git a/lib/libend/etext.S b/lib/libend/etext.S new file mode 100644 index 000000000..dc927f627 --- /dev/null +++ b/lib/libend/etext.S @@ -0,0 +1,4 @@ +.text +.balign _EM_WSIZE +.globl _etext +_etext: diff --git a/lib/libend/etext.s b/lib/libend/etext.s deleted file mode 100644 index 7ff13474e..000000000 --- a/lib/libend/etext.s +++ /dev/null @@ -1,5 +0,0 @@ -# -.sect .text -.align _EM_WSIZE -.define _etext -_etext: diff --git a/lib/libend/gnu/Makefile.inc b/lib/libend/gnu/Makefile.inc index a348fb239..16dea0d83 100644 --- a/lib/libend/gnu/Makefile.inc +++ b/lib/libend/gnu/Makefile.inc @@ -1,5 +1,5 @@ # end sources .PATH: ${.CURDIR}/gnu -SRCS+=gnu_end.gs +SRCS+=gnu_end.S diff --git a/lib/libend/gnu/gnu_end.gs b/lib/libend/gnu/gnu_end.S similarity index 100% rename from lib/libend/gnu/gnu_end.gs rename to lib/libend/gnu/gnu_end.S diff --git a/lib/libsys/Makefile b/lib/libsys/Makefile index e6eaaa517..3198f4d54 100644 --- a/lib/libsys/Makefile +++ b/lib/libsys/Makefile @@ -104,7 +104,7 @@ SRCS= \ fkey_ctl.c \ tsc_util.c \ report.c \ - read_tsc.s \ + read_tsc.S \ read_tsc_64.c \ ser_putc.c \ stacktrace.c \ diff --git a/lib/libsys/read_tsc.S b/lib/libsys/read_tsc.S new file mode 100644 index 000000000..143d30d64 --- /dev/null +++ b/lib/libsys/read_tsc.S @@ -0,0 +1,46 @@ +/* */ +/* sections */ + + +.globl _read_tsc /* read the cycle counter (Pentium and up) */ +.text +/**===========================================================================* */ +/* PUBLIC void read_tsc(unsigned long *high, unsigned long *low); */ +/* Read the cycle counter of the CPU. Pentium and up. */ +.balign 16 +_read_tsc: + push %edx + push %eax +.byte 0x0f /* this is the RDTSC instruction */ +.byte 0x31 /* it places the TSC in EDX:EAX */ + push %ebp + movl 16(%esp), %ebp + movl %edx, (%ebp) + movl 20(%esp), %ebp + movl %eax, (%ebp) + pop %ebp + pop %eax + pop %edx + ret + +/**===========================================================================* */ +/* PUBLIC void read_host_time_ns(unsigned long *high, unsigned long *low); */ +/* access real time in ns from host in vmware. */ +.balign 16 +_read_host_time_ns: + pushl %edx + pushl %eax + pushl %ecx + movl $0x10001, %ecx +.byte 0x0f /* this is the RDTSC instruction */ +.byte 0x31 /* it places the TSC in EDX:EAX */ + pushl %ebp + movl 20(%esp), %ebp + movl %edx, (%ebp) + movl 24(%esp), %ebp + movl %eax, (%ebp) + popl %ebp + popl %ecx + popl %eax + popl %edx + ret diff --git a/lib/libsys/read_tsc.s b/lib/libsys/read_tsc.s deleted file mode 100644 index 94bd0e58d..000000000 --- a/lib/libsys/read_tsc.s +++ /dev/null @@ -1,49 +0,0 @@ -# -! sections - -.sect .text; .sect .rom; .sect .data; .sect .bss - -.define _read_tsc ! read the cycle counter (Pentium and up) - -.sect .text -!*===========================================================================* -! PUBLIC void read_tsc(unsigned long *high, unsigned long *low); -! Read the cycle counter of the CPU. Pentium and up. -.align 16 -_read_tsc: - push edx - push eax -.data1 0x0f ! this is the RDTSC instruction -.data1 0x31 ! it places the TSC in EDX:EAX - push ebp - mov ebp, 16(esp) - mov (ebp), edx - mov ebp, 20(esp) - mov (ebp), eax - pop ebp - pop eax - pop edx - ret - -!*===========================================================================* -! PUBLIC void read_host_time_ns(unsigned long *high, unsigned long *low); -! access real time in ns from host in vmware. -.align 16 -_read_host_time_ns: - push edx - push eax - push ecx - mov ecx, 0x10001 -.data1 0x0f ! this is the RDPMC instruction -.data1 0x33 ! it places the result in EDX:EAX - push ebp - mov ebp, 20(esp) - mov (ebp), edx - mov ebp, 24(esp) - mov (ebp), eax - pop ebp - pop ecx - pop eax - pop edx - ret - diff --git a/servers/hgfs/libhgfs/Makefile b/servers/hgfs/libhgfs/Makefile index 486b2f079..c482560cd 100644 --- a/servers/hgfs/libhgfs/Makefile +++ b/servers/hgfs/libhgfs/Makefile @@ -5,7 +5,7 @@ OBJ=backdoor.o attr.o channel.o dir.o error.o file.o \ link.o misc.o path.o rpc.o time.o AR=ar -GAS2ACK=gas2ack +GAS2ACK=gas2ack -u all build: $(LIBNAME)