aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2016-02-09 13:43:08 +1100
committerRichard Henderson <rth@twiddle.net>2016-02-09 03:27:56 -0800
commit5b78856069a21550d4b67b4c0a269915f37fce0f (patch)
tree6f5979d15f0170ccf2915c5e6644cb73f209a65d
parent4577d8457637adac28ed34bc3f9ce0a936dc786e (diff)
downloadtermbaud-rth/execl.tar.gz
termbaud-rth/execl.tar.xz
termbaud-rth/execl.zip
alpha: Implement execl{,e,p} without double stack allocationrth/execl
-rw-r--r--sysdeps/unix/sysv/linux/alpha/execl.S52
-rw-r--r--sysdeps/unix/sysv/linux/alpha/execle.S58
-rw-r--r--sysdeps/unix/sysv/linux/alpha/execlp.S53
3 files changed, 163 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/alpha/execl.S b/sysdeps/unix/sysv/linux/alpha/execl.S
new file mode 100644
index 00000000000..11f4307c8cf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/execl.S
@@ -0,0 +1,52 @@
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+ENTRY(execl)
+ cfi_startproc
+ ldgp gp, 0(pv)
+ lda sp, -48(sp)
+ cfi_adjust_cfa_offset(48)
+ .frame sp, 48, ra
+ .prologue 1
+
+ /* Save the portions of the argv argument list in registers. */
+ stq a5, 40(sp)
+ stq a4, 32(sp)
+ stq a3, 24(sp)
+ stq a2, 16(sp)
+ stq a1, 8(sp)
+
+ /* Load the argv and envp arguments; path is already in place. */
+ lda a1, 8(sp)
+ ldq a2, __environ
+
+ lda v0, SYS_ify(execve)
+ call_pal PAL_callsys
+
+ /* Discard the stack frame now. */
+ lda sp, 48(sp)
+ cfi_adjust_cfa_offset(-48)
+
+ /* All returns are errors. */
+ br SYSCALL_ERROR_LABEL
+
+PSEUDO_END (execle)
+ cfi_endproc
+
+libc_hidden_def (execl)
diff --git a/sysdeps/unix/sysv/linux/alpha/execle.S b/sysdeps/unix/sysv/linux/alpha/execle.S
new file mode 100644
index 00000000000..ce75ce3a1df
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/execle.S
@@ -0,0 +1,58 @@
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+ENTRY(execle)
+ cfi_startproc
+ lda sp, -48(sp)
+ cfi_adjust_cfa_offset(48)
+ .frame sp, 48, ra
+ .prologue 0
+
+ /* Save the portions of the argv argument list in registers. */
+ stq a5, 40(sp)
+ stq a4, 32(sp)
+ stq a3, 24(sp)
+ stq a2, 16(sp)
+ stq a1, 8(sp)
+
+ /* Find the env argument. It is the array element after the argv
+ NULL terminator, which cannot be located before argv[1]. */
+ lda t0, 16(sp)
+1: ldq t1, 0(t0)
+ addq t0, 8, t0
+ bne t1, 1b
+
+ /* Load the argv and envp arguments; path is already in place. */
+ lda a1, 8(sp)
+ ldq a2, 0(t0)
+
+ lda v0, SYS_ify(execve)
+ call_pal PAL_callsys
+
+ /* Discard the stack frame now. */
+ lda sp, 48(sp)
+ cfi_adjust_cfa_offset(-48)
+
+ /* All returns are errors. */
+ br SYSCALL_ERROR_LABEL
+
+PSEUDO_END (execle)
+ cfi_endproc
+
+libc_hidden_def (execle)
diff --git a/sysdeps/unix/sysv/linux/alpha/execlp.S b/sysdeps/unix/sysv/linux/alpha/execlp.S
new file mode 100644
index 00000000000..b0ef76daa0f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/alpha/execlp.S
@@ -0,0 +1,53 @@
+/* Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+
+ENTRY(execlp)
+ cfi_startproc
+ ldgp gp, 0(pv)
+ lda sp, -48(sp)
+ cfi_adjust_cfa_offset(48)
+ stq ra, 0(sp)
+ cfi_rel_offset(ra, 0)
+ .prologue 1
+
+ /* Save the portions of the argv argument list in registers. */
+ stq a5, 40(sp)
+ stq a4, 32(sp)
+ stq a3, 24(sp)
+ stq a2, 16(sp)
+ stq a1, 8(sp)
+
+ /* Load the argv and envp arguments; path is already in place. */
+ lda a1, 8(sp)
+ ldq a2, __environ
+#ifdef PIC
+ bsr ra, __execvpe !samegp
+#else
+ jsr ra, __execvpe
+ ldgp gp, 0(ra)
+#endif
+
+ lda sp, 48(sp)
+ cfi_adjust_cfa_offset(-48)
+ ret
+
+END (execlp)
+ cfi_endproc
+
+libc_hidden_def (execlp)