summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2022-07-03 21:08:42 -0400
committerGarrett D'Amore <garrett@damore.org>2022-07-11 09:56:13 -0400
commit9174bfaa08ca3aa4c0a12e840c4bd4f2570237a0 (patch)
tree52e23f623dc8994e8c2799eefcc5bd7d0a7907b4 /usr
parente27085df90712f99e5ea3d44ab0b83c73ac1bf52 (diff)
downloadillumos-joyent-9174bfaa08ca3aa4c0a12e840c4bd4f2570237a0.tar.gz
14780 remove aoutexec module
14806 system(5) dacf is not SPARC specific Reviewed by: Peter Tribble <peter.tribble@gmail.com> Reviewed by: Rich Lowe <richlowe@richlowe.net> Approved by: Robert Mustacchi <rm@fingolfin.org>
Diffstat (limited to 'usr')
-rw-r--r--usr/src/cmd/sgs/Makefile10
-rw-r--r--usr/src/cmd/sgs/ldd/common/ldd.c76
-rw-r--r--usr/src/cmd/sgs/ldd/common/ldd.msg4
-rw-r--r--usr/src/cmd/sgs/prof/common/prof.c1
-rw-r--r--usr/src/cmd/sgs/rtld.4.x/Makefile45
-rw-r--r--usr/src/cmd/sgs/rtld.4.x/Makefile.4.x51
-rw-r--r--usr/src/cmd/sgs/rtld.4.x/div.s437
-rw-r--r--usr/src/cmd/sgs/rtld.4.x/elf_boot.h59
-rw-r--r--usr/src/cmd/sgs/rtld.4.x/ld.sobin24576 -> 0 bytes
-rw-r--r--usr/src/cmd/sgs/rtld.4.x/rem.s436
-rw-r--r--usr/src/cmd/sgs/rtld.4.x/rtld.4.x.c567
-rw-r--r--usr/src/cmd/sgs/rtld.4.x/rtldlib.s145
-rw-r--r--usr/src/cmd/sgs/rtld.4.x/rtsubrs.c251
-rw-r--r--usr/src/cmd/sgs/rtld.4.x/umultiply.s348
-rw-r--r--usr/src/cmd/sgs/rtld.4.x/zero.s65
-rw-r--r--usr/src/man/man5/system.575
-rw-r--r--usr/src/pkg/manifests/system-kernel.p5m1
-rw-r--r--usr/src/tools/findunref/exception_list.open1
-rw-r--r--usr/src/uts/common/conf/param.c24
-rw-r--r--usr/src/uts/common/exec/aout/aout.c347
-rw-r--r--usr/src/uts/common/os/mmapobj.c263
-rw-r--r--usr/src/uts/common/sys/exec.h23
-rw-r--r--usr/src/uts/sparc/Makefile.sparc2
-rw-r--r--usr/src/uts/sparc/aoutexec/Makefile88
-rw-r--r--usr/src/uts/sun4/vm/vm_dep.c81
25 files changed, 31 insertions, 3369 deletions
diff --git a/usr/src/cmd/sgs/Makefile b/usr/src/cmd/sgs/Makefile
index 3b34e0a882..42547e014f 100644
--- a/usr/src/cmd/sgs/Makefile
+++ b/usr/src/cmd/sgs/Makefile
@@ -23,6 +23,7 @@
# Copyright 2016 RackTop Systems.
# Copyright 2017 Joyent, Inc.
# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
+# Copyright 2022 Garrett D'Amore <garrett@damore.org>
#
include $(SRC)/cmd/Makefile.cmd
@@ -81,10 +82,7 @@ SUBDIRS-common= libconv \
.WAIT \
demo_rdb
-SUBDIRS-i386=
-SUBDIRS-sparc= rtld.4.x
-
-SUBDIRS= $(SUBDIRS-common) $(SUBDIRS-$(MACH))
+SUBDIRS= $(SUBDIRS-common)
# Messaging support
#
@@ -153,10 +151,8 @@ $(SUBDIRS): FRC
FRC:
#
-# Cross-reference customization: ignore the directories named by XRPRUNE,
-# and tweak the file globs slightly.
+# Cross-reference customization: tweak the file globs slightly.
#
-XRPRUNE= rtld.4.x abi
XRADD= *.msg mapfile*
XRDEL= Makefile* kobj_*
diff --git a/usr/src/cmd/sgs/ldd/common/ldd.c b/usr/src/cmd/sgs/ldd/common/ldd.c
index c686b51e0e..8680d95ea0 100644
--- a/usr/src/cmd/sgs/ldd/common/ldd.c
+++ b/usr/src/cmd/sgs/ldd/common/ldd.c
@@ -38,11 +38,9 @@
* file with a dynamic executable stub. The runtime linker (ld.so.1) actually
* provides the diagnostic output, according to the environment variables set.
*
- * If neither -d nor -r is specified, we set only LD_TRACE_LOADED_OBJECTS_[AE].
+ * If neither -d nor -r is specified, we set only LD_TRACE_LOADED_OBJECTS_E.
* The runtime linker will print the pathnames of all dynamic objects it
- * loads, and then exit. Note that we distiguish between ELF and AOUT objects
- * when setting this environment variable - AOUT executables cause the mapping
- * of sbcp, the dependencies of which the user isn't interested in.
+ * loads, and then exit.
*
* If -d or -r is specified, we also set LD_WARN=1; the runtime linker will
* perform its normal relocations and issue warning messages for unresolved
@@ -126,7 +124,6 @@
#include "msg.h"
static int elf_check(int, char *, char *, Elf *, int);
-static int aout_check(int, char *, char *, int, int);
static int run(int, char *, char *, const char *, int);
@@ -136,7 +133,6 @@ static int run(int, char *, char *, const char *, int);
*/
static char bind[] = "LD_BIND_NOW= ",
load_elf[] = "LD_TRACE_LOADED_OBJECTS_E= ",
- load_aout[] = "LD_TRACE_LOADED_OBJECTS_A= ",
path[] = "LD_TRACE_SEARCH_PATHS= ",
verb[] = "LD_VERBOSE= ",
warn[] = "LD_WARN= ",
@@ -356,8 +352,7 @@ main(int argc, char **argv, char **envp)
}
/*
- * Get the files elf descriptor and process it as an elf or
- * a.out (4.x) file.
+ * Get the files elf descriptor and process it as an elf file.
*/
elf = elf_begin(var, ELF_C_READ, (Elf *)0);
switch (elf_kind(elf)) {
@@ -366,21 +361,15 @@ main(int argc, char **argv, char **envp)
cname, fname);
error = 1;
break;
- case ELF_K_COFF:
- (void) fprintf(stderr, MSG_INTL(MSG_USP_UNKNOWN),
- cname, fname);
- error = 1;
- break;
case ELF_K_ELF:
if (elf_check(nfile, fname, cname, elf, fflag) != 0)
error = 1;
break;
+ case ELF_K_COFF:
default:
- /*
- * This is either an unknown file or an aout format
- */
- if (aout_check(nfile, fname, cname, var, fflag) != 0)
- error = 1;
+ (void) fprintf(stderr, MSG_INTL(MSG_USP_UNKNOWN),
+ cname, fname);
+ error = 1;
break;
}
(void) elf_end(elf);
@@ -570,52 +559,6 @@ elf_check(int nfile, char *fname, char *cname, Elf *elf, int fflag)
return (run(nfile, cname, fname, conv_lddstub(class), class));
}
-static int
-aout_check(int nfile, char *fname, char *cname, int fd, int fflag)
-{
- struct exec32 aout;
- int err;
-
- if (lseek(fd, 0, SEEK_SET) != 0) {
- err = errno;
- (void) fprintf(stderr, MSG_INTL(MSG_SYS_LSEEK), cname, fname,
- strerror(err));
- return (1);
- }
- if (read(fd, (char *)&aout, sizeof (aout)) != sizeof (aout)) {
- err = errno;
- (void) fprintf(stderr, MSG_INTL(MSG_SYS_READ), cname, fname,
- strerror(err));
- return (1);
- }
- if (aout.a_machtype != M_SPARC) {
- (void) fprintf(stderr, MSG_INTL(MSG_USP_UNKNOWN), cname, fname);
- return (1);
- }
- if (N_BADMAG(aout) || !aout.a_dynamic) {
- (void) fprintf(stderr, MSG_INTL(MSG_USP_NODYNORSO), cname,
- fname);
- return (1);
- }
- if (!fflag && (geteuid() == 0)) {
- (void) fprintf(stderr, MSG_INTL(MSG_USP_AOUTINS), cname, fname);
- return (1);
- }
-
- /*
- * Run the required program.
- */
- if ((aout.a_magic == ZMAGIC) && (aout.a_entry <= sizeof (aout))) {
- load = load_elf;
- return (run(nfile, cname, fname, conv_lddstub(ELFCLASS32),
- ELFCLASS32));
- } else {
- load = load_aout;
- return (run(nfile, cname, fname, (const char *)fname,
- ELFCLASS32));
- }
-}
-
/*
* Run the required program, setting the preload and trace environment
@@ -708,9 +651,8 @@ run(int nfile, char *cname, char *fname, const char *ename, int class)
}
/*
- * The pointer "load" has be assigned to load_elf[] or
- * load_aout[]. Use the size of load_elf[] as the size
- * of load_aout[] is the same.
+ * The pointer "load" has be assigned to load_elf[].
+ * Use the size of load_elf[].
*/
load[sizeof (load_elf) - 2] = '2';
} else
diff --git a/usr/src/cmd/sgs/ldd/common/ldd.msg b/usr/src/cmd/sgs/ldd/common/ldd.msg
index 2f2301cd44..e5e40569d7 100644
--- a/usr/src/cmd/sgs/ldd/common/ldd.msg
+++ b/usr/src/cmd/sgs/ldd/common/ldd.msg
@@ -1,5 +1,6 @@
#
# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2022 Garrett D'Amore <garrett@damore.org>
#
# CDDL HEADER START
#
@@ -46,7 +47,6 @@
@ MSG_USP_NOHDR "%s: %s: file built with ?N (NOHDR) mapfile option\n"
@ MSG_USP_UNKNOWN "%s: %s: unsupported or unknown file type\n"
@ MSG_USP_ELFINS "%s: %s: file has insecure interpreter %s\n"
-@ MSG_USP_AOUTINS "%s: %s: insecure a.out file\n"
@ MSG_USP_NOTEXEC "%s: %s: is not executable\n"
@@ -69,8 +69,6 @@
# System error messages
-@ MSG_SYS_LSEEK "%s: %s: cannot lseek file: %s\n"
-@ MSG_SYS_READ "%s: %s: cannot read file: %s\n"
@ MSG_SYS_FORK "%s: cannot fork: %s\n"
@ MSG_SYS_OPEN "%s: %s: cannot open file: %s\n"
diff --git a/usr/src/cmd/sgs/prof/common/prof.c b/usr/src/cmd/sgs/prof/common/prof.c
index 3de4437a31..caee53618b 100644
--- a/usr/src/cmd/sgs/prof/common/prof.c
+++ b/usr/src/cmd/sgs/prof/common/prof.c
@@ -209,7 +209,6 @@ struct snymEntry {
};
-#define AOUTHSZ (filhdr.f_opthdr)
PROF_FILE filhdr; /* profile file descriptor */
Elf32_Shdr *scnhdrp; /* pointer to first section header */
/* (space by _prof_Malloc) */
diff --git a/usr/src/cmd/sgs/rtld.4.x/Makefile b/usr/src/cmd/sgs/rtld.4.x/Makefile
deleted file mode 100644
index 660f5d2697..0000000000
--- a/usr/src/cmd/sgs/rtld.4.x/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-# Copyright (c) 1990 by Sun Microsystems, Inc.
-# Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
-#
-
-#include library definitions
-include ../../../lib/Makefile.lib
-
-FILE= ld.so
-ROOTFILE= $(ROOTLIBDIR)/$(FILE)
-
-FILEMODE= 755
-
-$(ROOTLIBDIR)/%: %
- $(INS.file)
-
-.KEEP_STATE:
-
-all:
-
-install: $(ROOTFILE)
-
-clean:
-
-clobber: clean
diff --git a/usr/src/cmd/sgs/rtld.4.x/Makefile.4.x b/usr/src/cmd/sgs/rtld.4.x/Makefile.4.x
deleted file mode 100644
index 463a24382a..0000000000
--- a/usr/src/cmd/sgs/rtld.4.x/Makefile.4.x
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# ident "%Z%%M% %I% %E% SMI"
-#
-# Copyright 2003 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-# On a 4.x machine (fourdotx), point ROOT at the header files you're using,
-# and do:
-#
-# % sccs edit ld.so
-# % make -f Makefile.4.x all
-# <test it a lot>
-# % sccs delget ld.so
-#
-# Unfortunately, at least <sys/isa_defs.h>, <sys/feature_tests.h> and <libelf.h>
-# contain an '#error' line that makes the 4.x cpp choke (even though it
-# shouldn't parse the error clause). You may need to delete the '#' sign to
-# compile each object.
-
-OBJS= rtldlib.o rtld.4.x.o rtsubrs.o div.o umultiply.o rem.o zero.o
-
-all: ${OBJS}
- ld -o ld.so -Bsymbolic -assert nosymbolic -assert pure-text ${OBJS}
-
-%.o:%.s
- as -k -P -I$(ROOT)/usr/include -D_SYS_SYS_S -D_ASM $<
- mv -f a.out $*.o
-
-%.o:%.c
- cc -c -O -I$(ROOT)/usr/include -pic -D_NO_LONGLONG $<
diff --git a/usr/src/cmd/sgs/rtld.4.x/div.s b/usr/src/cmd/sgs/rtld.4.x/div.s
deleted file mode 100644
index 5a09c9d960..0000000000
--- a/usr/src/cmd/sgs/rtld.4.x/div.s
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-! .seg "data"
-! .asciz "Copyr 1986 Sun Micro"
- .seg "text"
-
-#ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Copyright 1986 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * divison/remainder
- *
- * Input is:
- * dividend -- the thing being divided
- * divisor -- how many ways to divide
- * Important parameters:
- * N -- how many bits per iteration we try to get
- * as our current guess:
- * WORDSIZE -- how many bits altogether we're talking about:
- * obviously:
- * A derived constant:
- * TOPBITS -- how many bits are in the top "decade" of a number:
- *
- * Important variables are:
- * Q -- the partial quotient under development -- initally 0
- * R -- the remainder so far -- initially == the dividend
- * ITER -- number of iterations of the main division loop will
- * be required. Equal to CEIL( lg2(quotient)/4 )
- * Note that this is log_base_(2^4) of the quotient.
- * V -- the current comparand -- initially divisor*2^(ITER*4-1)
- * Cost:
- * current estimate for non-large dividend is
- * CEIL( lg2(quotient) / 4 ) x ( 10 + 74/2 ) + C
- * a large dividend is one greater than 2^(31-4 ) and takes a
- * different path, as the upper bits of the quotient must be developed
- * one bit at a time.
- */
-
-#include <sys/trap.h>
-#include <sys/asm_linkage.h>
-
-
-
-
-
-
-
-
- ! working variable
-
-
-/*
- * this is the recursive definition of how we develop quotient digits.
- * it takes three important parameters:
- * $1 -- the current depth, 1<=$1<=4
- * $2 -- the current accumulation of quotient bits
- * 4 -- max depth
- * We add a new bit to $2 and either recurse or
- * insert the bits in the quotient.
- * Dynamic input:
- * %o3 -- current remainder
- * %o2 -- current quotient
- * %o5 -- current comparand
- * cc -- set on current value of %o3
- * Dynamic output:
- * %o3', %o2', %o5', cc'
- */
-
-
-
-
-
-! RTENTRY(.udiv) ! unsigned divide
- .global .udiv
-.udiv:
- b divide
- mov 0,%g1 ! result always positive
-
-! RTENTRY(.div) ! SIGNED DIVIDE
- .global .div
-.div:
- orcc %o1,%o0,%g0 ! are either %o0 or %o1 negative
- bge divide ! if not, skip this junk
- xor %o1,%o0,%g1 ! record sign of result in sign of %g1
- tst %o1
- bge 2f
- tst %o0
- ! %o1 < 0
- bge divide
- neg %o1
- 2:
- ! %o0 < 0
- neg %o0
- ! FALL THROUGH
-
-
-divide:
-! compute size of quotient, scale comparand
- orcc %o1,%g0,%o5 ! movcc %o1,%o5
- bnz 0f ! if %o1 != 0
- mov %o0,%o3
- ba zero_divide
- nop
-0:
- cmp %o3,%o5
- blu got_result ! if %o3<%o5 already, there's no point in continuing
- mov 0,%o2
- sethi %hi(1<<(32-4 -1)),%g2
- cmp %o3,%g2
- blu not_really_big
- mov 0,%o4
- !
- ! here, the %o0 is >= 2^(31-4) or so. We must be careful here, as
- ! our usual 4-at-a-shot divide step will cause overflow and havoc. The
- ! total number of bits in the result here is 4*%o4+%g3, where %g3 <= 4.
- ! compute %o4, in an unorthodox manner: know we need to Shift %o5 into
- ! the top decade: so don't even bother to compare to %o3.
- 1:
- cmp %o5,%g2
- bgeu 3f
- mov 1,%g3
- sll %o5,4,%o5
- b 1b
- inc %o4
- ! now compute %g3
- 2: addcc %o5,%o5,%o5
- bcc not_too_big ! bcc not_too_big
- add %g3,1,%g3
- !
- ! here if the %o1 overflowed when Shifting
- ! this means that %o3 has the high-order bit set
- ! restore %o5 and subtract from %o3
- sll %g2,4 ,%g2 ! high order bit
- srl %o5,1,%o5 ! rest of %o5
- add %o5,%g2,%o5
- b do_single_div
- sub %g3,1,%g3
- not_too_big:
- 3: cmp %o5,%o3
- blu 2b
- nop
- be do_single_div
- nop
- ! %o5 > %o3: went too far: back up 1 step
- ! srl %o5,1,%o5
- ! dec %g3
- ! do single-bit divide steps
- !
- ! we have to be careful here. We know that %o3 >= %o5, so we can do the
- ! first divide step without thinking. BUT, the others are conditional,
- ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
- ! order bit set in the first step, just falling into the regular
- ! division loop will mess up the first time around.
- ! So we unroll slightly...
- do_single_div:
- deccc %g3
- bl end_regular_divide
- nop
- sub %o3,%o5,%o3
- mov 1,%o2
- b,a end_single_divloop
- single_divloop:
- sll %o2,1,%o2
- bl 1f
- srl %o5,1,%o5
- ! %o3 >= 0
- sub %o3,%o5,%o3
- b 2f
- inc %o2
- 1: ! %o3 < 0
- add %o3,%o5,%o3
- dec %o2
- 2:
- end_single_divloop:
- deccc %g3
- bge single_divloop
- tst %o3
- b,a end_regular_divide
-
-not_really_big:
-1:
- sll %o5,4,%o5
- cmp %o5,%o3
- bleu 1b
- inccc %o4
- be got_result
- dec %o4
-do_regular_divide:
-
-! do the main division iteration
- tst %o3
-! fall through into divide loop
-divloop:
- sll %o2,4,%o2
- !depth 1, accumulated bits 0
- bl L.1.16
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 2, accumulated bits 1
- bl L.2.17
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 3, accumulated bits 3
- bl L.3.19
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 4, accumulated bits 7
- bl L.4.23
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (7*2+1), %o2
-
-L.4.23: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (7*2-1), %o2
-
-
-
-
-L.3.19: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 4, accumulated bits 5
- bl L.4.21
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (5*2+1), %o2
-
-L.4.21: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (5*2-1), %o2
-
-
-
-
-
-
-
-L.2.17: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 3, accumulated bits 1
- bl L.3.17
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 4, accumulated bits 3
- bl L.4.19
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (3*2+1), %o2
-
-L.4.19: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (3*2-1), %o2
-
-
-
-
-L.3.17: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 4, accumulated bits 1
- bl L.4.17
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (1*2+1), %o2
-
-L.4.17: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (1*2-1), %o2
-
-
-
-
-
-
-
-
-
-
-L.1.16: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 2, accumulated bits -1
- bl L.2.15
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 3, accumulated bits -1
- bl L.3.15
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 4, accumulated bits -1
- bl L.4.15
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-1*2+1), %o2
-
-L.4.15: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-1*2-1), %o2
-
-
-
-
-L.3.15: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 4, accumulated bits -3
- bl L.4.13
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-3*2+1), %o2
-
-L.4.13: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-3*2-1), %o2
-
-
-
-
-
-
-
-L.2.15: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 3, accumulated bits -3
- bl L.3.13
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 4, accumulated bits -5
- bl L.4.11
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-5*2+1), %o2
-
-L.4.11: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-5*2-1), %o2
-
-
-
-
-L.3.13: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 4, accumulated bits -7
- bl L.4.9
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-7*2+1), %o2
-
-L.4.9: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-7*2-1), %o2
-
-
-
-
-
-
-
-
-
-
- 9:
-
-end_regular_divide:
- deccc %o4
- bge divloop
- tst %o3
- bl,a got_result
- dec %o2
-
-
-got_result:
- tst %g1
- bl,a 1f
- neg %o2 ! quotient <- -%o2
-
-1:
- retl
- mov %o2,%o0 ! quotient <- %o2
-
-
-zero_divide:
- ta ST_DIV0 ! divide by zero trap
- retl ! if handled, ignored, return
- mov 0, %o0
diff --git a/usr/src/cmd/sgs/rtld.4.x/elf_boot.h b/usr/src/cmd/sgs/rtld.4.x/elf_boot.h
deleted file mode 100644
index d9f38bad4f..0000000000
--- a/usr/src/cmd/sgs/rtld.4.x/elf_boot.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright (c) 1990 Sun Microsystems, Inc.
- */
-
-#ifndef _ELF_BOOT_H
-#define _ELF_BOOT_H
-
-#ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Attribute/value structures used to bootstrap ELF-based dynamic linker.
- */
-
-#ifndef _ASM
-typedef struct {
- Elf32_Sword eb_tag; /* what this one is */
- union { /* possible values */
- Elf32_Word eb_val;
- Elf32_Addr eb_ptr;
- Elf32_Off eb_off;
- } eb_un;
-} Elf32_Boot;
-#endif /* _ASM */
-
-/*
- * Attributes
- */
-#define EB_NULL 0 /* (void) last entry */
-#define EB_DYNAMIC 1 /* (*) dynamic structure of subject */
-#define EB_LDSO_BASE 2 /* (caddr_t) base address of ld.so */
-#define EB_ARGV 3 /* (caddr_t) argument vector */
-#define EB_ENVP 4 /* (char **) environment strings */
-#define EB_AUXV 5 /* (auxv_t *) auxiliary vector */
-#define EB_DEVZERO 6 /* (int) fd for /dev/zero */
-#define EB_PAGESIZE 7 /* (int) page size */
-#define EB_MAX 8 /* number of "EBs" */
-
-#endif /* _ELF_BOOT_H */
diff --git a/usr/src/cmd/sgs/rtld.4.x/ld.so b/usr/src/cmd/sgs/rtld.4.x/ld.so
deleted file mode 100644
index 256acfb125..0000000000
--- a/usr/src/cmd/sgs/rtld.4.x/ld.so
+++ /dev/null
Binary files differ
diff --git a/usr/src/cmd/sgs/rtld.4.x/rem.s b/usr/src/cmd/sgs/rtld.4.x/rem.s
deleted file mode 100644
index b9d64b3173..0000000000
--- a/usr/src/cmd/sgs/rtld.4.x/rem.s
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-
-! .seg "data"
-! .asciz "Copyr 1986 Sun Micro"
- .seg "text"
-
-#ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Copyright 1986 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/*
- * divison/remainder
- *
- * Input is:
- * dividend -- the thing being divided
- * divisor -- how many ways to divide
- * Important parameters:
- * N -- how many bits per iteration we try to get
- * as our current guess:
- * WORDSIZE -- how many bits altogether we're talking about:
- * obviously:
- * A derived constant:
- * TOPBITS -- how many bits are in the top "decade" of a number:
- *
- * Important variables are:
- * Q -- the partial quotient under development -- initally 0
- * R -- the remainder so far -- initially == the dividend
- * ITER -- number of iterations of the main division loop will
- * be required. Equal to CEIL( lg2(quotient)/4 )
- * Note that this is log_base_(2^4) of the quotient.
- * V -- the current comparand -- initially divisor*2^(ITER*4-1)
- * Cost:
- * current estimate for non-large dividend is
- * CEIL( lg2(quotient) / 4 ) x ( 10 + 74/2 ) + C
- * a large dividend is one greater than 2^(31-4 ) and takes a
- * different path, as the upper bits of the quotient must be developed
- * one bit at a time.
- */
-
-#include <sys/trap.h>
-#include <sys/asm_linkage.h>
-
-
-
-
-
-
-
-
- ! working variable
-
-
-/*
- * this is the recursive definition of how we develop quotient digits.
- * it takes three important parameters:
- * $1 -- the current depth, 1<=$1<=4
- * $2 -- the current accumulation of quotient bits
- * 4 -- max depth
- * We add a new bit to $2 and either recurse or
- * insert the bits in the quotient.
- * Dynamic input:
- * %o3 -- current remainder
- * %o2 -- current quotient
- * %o5 -- current comparand
- * cc -- set on current value of %o3
- * Dynamic output:
- * %o3', %o2', %o5', cc'
- */
-
-
-
-
-! RTENTRY(.urem) ! UNSIGNED REMAINDER
- .global .urem
-.urem:
- b divide
- mov 0,%g1 ! result always positive
-
-! RTENTRY(.rem) ! SIGNED REMAINDER
- .global .rem
-.rem:
- orcc %o1,%o0,%g0 ! are either %o0 or %o1 negative
- bge divide ! if not, skip this junk
- mov %o0,%g1 ! record sign of result in sign of %g1
- tst %o1
- bge 2f
- tst %o0
- ! %o1 < 0
- bge divide
- neg %o1
- 2:
- ! %o0 < 0
- neg %o0
- ! FALL THROUGH
-
-
-divide:
-! compute size of quotient, scale comparand
- orcc %o1,%g0,%o5 ! movcc %o1,%o5
- bnz 0f ! if %o1 != 0
- mov %o0,%o3
- ba zero_divide
- nop
-0:
- cmp %o3,%o5
- blu got_result ! if %o3<%o5 already, there's no point in continuing
- mov 0,%o2
- sethi %hi(1<<(32-4 -1)),%g2
- cmp %o3,%g2
- blu not_really_big
- mov 0,%o4
- !
- ! here, the %o0 is >= 2^(31-4) or so. We must be careful here, as
- ! our usual 4-at-a-shot divide step will cause overflow and havoc. The
- ! total number of bits in the result here is 4*%o4+%g3, where %g3 <= 4.
- ! compute %o4, in an unorthodox manner: know we need to Shift %o5 into
- ! the top decade: so don't even bother to compare to %o3.
- 1:
- cmp %o5,%g2
- bgeu 3f
- mov 1,%g3
- sll %o5,4,%o5
- b 1b
- inc %o4
- ! now compute %g3
- 2: addcc %o5,%o5,%o5
- bcc not_too_big ! bcc not_too_big
- add %g3,1,%g3
- !
- ! here if the %o1 overflowed when Shifting
- ! this means that %o3 has the high-order bit set
- ! restore %o5 and subtract from %o3
- sll %g2,4 ,%g2 ! high order bit
- srl %o5,1,%o5 ! rest of %o5
- add %o5,%g2,%o5
- b do_single_div
- sub %g3,1,%g3
- not_too_big:
- 3: cmp %o5,%o3
- blu 2b
- nop
- be do_single_div
- nop
- ! %o5 > %o3: went too far: back up 1 step
- ! srl %o5,1,%o5
- ! dec %g3
- ! do single-bit divide steps
- !
- ! we have to be careful here. We know that %o3 >= %o5, so we can do the
- ! first divide step without thinking. BUT, the others are conditional,
- ! and are only done if %o3 >= 0. Because both %o3 and %o5 may have the high-
- ! order bit set in the first step, just falling into the regular
- ! division loop will mess up the first time around.
- ! So we unroll slightly...
- do_single_div:
- deccc %g3
- bl end_regular_divide
- nop
- sub %o3,%o5,%o3
- mov 1,%o2
- b,a end_single_divloop
- single_divloop:
- sll %o2,1,%o2
- bl 1f
- srl %o5,1,%o5
- ! %o3 >= 0
- sub %o3,%o5,%o3
- b 2f
- inc %o2
- 1: ! %o3 < 0
- add %o3,%o5,%o3
- dec %o2
- 2:
- end_single_divloop:
- deccc %g3
- bge single_divloop
- tst %o3
- b,a end_regular_divide
-
-not_really_big:
-1:
- sll %o5,4,%o5
- cmp %o5,%o3
- bleu 1b
- inccc %o4
- be got_result
- dec %o4
-do_regular_divide:
-
-! do the main division iteration
- tst %o3
-! fall through into divide loop
-divloop:
- sll %o2,4,%o2
- !depth 1, accumulated bits 0
- bl L.1.16
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 2, accumulated bits 1
- bl L.2.17
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 3, accumulated bits 3
- bl L.3.19
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 4, accumulated bits 7
- bl L.4.23
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (7*2+1), %o2
-
-L.4.23: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (7*2-1), %o2
-
-
-
-
-L.3.19: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 4, accumulated bits 5
- bl L.4.21
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (5*2+1), %o2
-
-L.4.21: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (5*2-1), %o2
-
-
-
-
-
-
-
-L.2.17: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 3, accumulated bits 1
- bl L.3.17
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 4, accumulated bits 3
- bl L.4.19
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (3*2+1), %o2
-
-L.4.19: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (3*2-1), %o2
-
-
-
-
-L.3.17: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 4, accumulated bits 1
- bl L.4.17
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (1*2+1), %o2
-
-L.4.17: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (1*2-1), %o2
-
-
-
-
-
-
-
-
-
-
-L.1.16: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 2, accumulated bits -1
- bl L.2.15
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 3, accumulated bits -1
- bl L.3.15
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 4, accumulated bits -1
- bl L.4.15
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-1*2+1), %o2
-
-L.4.15: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-1*2-1), %o2
-
-
-
-
-L.3.15: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 4, accumulated bits -3
- bl L.4.13
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-3*2+1), %o2
-
-L.4.13: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-3*2-1), %o2
-
-
-
-
-
-
-
-L.2.15: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 3, accumulated bits -3
- bl L.3.13
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- !depth 4, accumulated bits -5
- bl L.4.11
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-5*2+1), %o2
-
-L.4.11: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-5*2-1), %o2
-
-
-
-
-L.3.13: ! remainder is negative
- addcc %o3,%o5,%o3
- !depth 4, accumulated bits -7
- bl L.4.9
- srl %o5,1,%o5
- ! remainder is positive
- subcc %o3,%o5,%o3
- b 9f
- add %o2, (-7*2+1), %o2
-
-L.4.9: ! remainder is negative
- addcc %o3,%o5,%o3
- b 9f
- add %o2, (-7*2-1), %o2
-
-
-
-
-
-
-
-
-
-
- 9:
-
-end_regular_divide:
- deccc %o4
- bge divloop
- tst %o3
- bl,a got_result
- add %o3,%o1,%o3
-
-
-got_result:
- tst %g1
- bl,a 1f
- neg %o3 ! remainder <- -%o3
-
-1:
- retl
- mov %o3,%o0 ! remainder <- %o3
-
-
-zero_divide:
- ta ST_DIV0 ! divide by zero trap
- retl ! if handled, ignored, return
- mov 0, %o0
diff --git a/usr/src/cmd/sgs/rtld.4.x/rtld.4.x.c b/usr/src/cmd/sgs/rtld.4.x/rtld.4.x.c
deleted file mode 100644
index 627331942e..0000000000
--- a/usr/src/cmd/sgs/rtld.4.x/rtld.4.x.c
+++ /dev/null
@@ -1,567 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- *
- * Binary compatibility ld.so. Intercepts the reference of a pre-SVR4
- * SunOS executable to the dynamic linker, and then redirects to the
- * "real" post-SVR4 SunOS ld.so.
- */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Import data structures (N.B.: from 5.x).
- */
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <sys/sysconfig.h>
-#include <sys/auxv.h>
-#include <sys/archsystm.h>
-#include <elf.h>
-#include <link.h>
-
-/*
- * Relocation manifest constants and macros.
- */
-#define ALIGN(x, a) ((int)(x) & ~((int)(a) - 1))
-#define ROUND(x, a) (((int)(x) + ((int)(a) - 1)) & \
- ~((int)(a) - 1))
-#define DYNAMIC_VERSION2 2
-#define RELOC_SIZE (sizeof (struct relocation_info))
-#define RELOCOFF(x) (x)->v2->ld_rel
-#define MASK(n) ((1<<(n))-1)
-#define IN_RANGE(v, n) ((-(1<<((n)-1))) <= (v) && (v) < (1<<((n)-1)))
-
-void aout_reloc_write();
-
-/*
- * 4.x SunOS Dynamic Link Editor public definitions (much derived from
- * SunOS 4.x <link.h>.)
- */
-
-/*
- * Dynamic linking information. With the exception of
- * ld_loaded (determined at execution time) and ld_stab_hash (a special
- * case of relocation handled at execution time), the values in this
- * structure reflect offsets from the containing link_dynamic structure.
- */
-struct link_dynamic_1 {
- struct link_map *ld_loaded; /* list of loaded objects */
- long ld_need; /* list of needed objects */
- long ld_rules; /* search rules for library objects */
- long ld_got; /* global offset table */
- long ld_plt; /* procedure linkage table */
- long ld_rel; /* relocation table */
- long ld_hash; /* symbol hash table */
- long ld_stab; /* symbol table itself */
- long (*ld_stab_hash)(); /* "pointer" to symbol hash function */
- long ld_buckets; /* number of hash buckets */
- long ld_symbols; /* symbol strings */
- long ld_symb_size; /* size of symbol strings */
- long ld_text; /* size of text area */
-};
-
-struct link_dynamic_2 {
- struct link_map *ld_loaded; /* list of loaded objects */
- long ld_need; /* list of needed objects */
- long ld_rules; /* search rules for library objects */
- long ld_got; /* global offset table */
- long ld_plt; /* procedure linkage table */
- long ld_rel; /* relocation table */
- long ld_hash; /* symbol hash table */
- long ld_stab; /* symbol table itself */
- long (*ld_stab_hash)(); /* "pointer" to symbol hash function */
- long ld_buckets; /* number of hash buckets */
- long ld_symbols; /* symbol strings */
- long ld_symb_size; /* size of symbol strings */
- long ld_text; /* size of text area */
- long ld_plt_sz; /* size of procedure linkage table */
-};
-
-/*
- * Debugger interface structure.
- */
-struct ld_debug {
- int ldd_version; /* version # of interface */
- int ldd_in_debugger; /* a debugger is running us */
- int ldd_sym_loaded; /* we loaded some symbols */
- char *ldd_bp_addr; /* place for ld-generated bpt */
- int ldd_bp_inst; /* instruction which was there */
- struct rtc_symb *ldd_cp; /* commons we built */
-};
-
-/*
- * Structure associated with each object which may be or which requires
- * execution-time link editing. Used by the run-time linkage editor to
- * identify needed objects and symbol definitions and references.
- */
-struct link_dynamic {
- int ld_version;
- struct ld_debug *ldd;
- union {
- struct link_dynamic_1 *ld_1;
- struct link_dynamic_2 *ld_2;
- } ld_un;
-};
-
-struct old_link_dynamic {
- int ld_version; /* version # of this structure */
- union {
- struct link_dynamic_1 ld_1;
- } ld_un;
-
- int in_debugging;
- int sym_loaded;
- char *bp_addr;
- int bp_inst;
- struct rtc_symb *cp; /* pointer to an array of runtime */
- /* allocated common symbols. */
-};
-
-#define v2 ld_un.ld_2 /* short hands */
-#define v1 ld_un.ld_1
-
-/*
- * SunOS 4.x SPARC relocation types and relocation record. Note that
- * these, among other things, make this program not portable to things
- * other than SPARC.
- */
-enum reloc_type {
- RELOC_8, RELOC_16, RELOC_32, /* simplest relocs */
- RELOC_DISP8, RELOC_DISP16, RELOC_DISP32,
- /* Disp's (pc-rel) */
- RELOC_WDISP30, RELOC_WDISP22, /* SR word disp's */
- RELOC_HI22, RELOC_22, /* SR 22-bit relocs */
- RELOC_13, RELOC_LO10, /* SR 13&10-bit relocs */
- RELOC_SFA_BASE, RELOC_SFA_OFF13, /* SR S.F.A. relocs */
- RELOC_BASE10, RELOC_BASE13, RELOC_BASE22,
- /* PIC GOT references */
- RELOC_PC10, RELOC_PC22, /* PIC reference to GOT */
- RELOC_JMP_TBL, /* PIC call */
- RELOC_SEGOFF16, /* .so offset-in-segment */
- RELOC_GLOB_DAT, RELOC_JMP_SLOT, RELOC_RELATIVE,
- /* ld.so relocation types */
-};
-
-struct relocation_info {
- unsigned long int r_address; /* relocation addr */
- unsigned int r_index :24; /* segment index or symbol index */
- unsigned int r_extern : 1; /* if F, r_index==SEG#; if T, SYM idx */
- int : 2; /* <unused> */
- enum reloc_type r_type : 5; /* type of relocation to perform */
- long int r_addend; /* addend for relocation value */
-};
-
-/*
- * Size of relocations.
- */
-#define GETRELSZ(x) \
- (x->ld_version < 2 ? \
- ((struct old_link_dynamic *)x)->v1.ld_hash - \
- ((struct old_link_dynamic *)x)->v1.ld_rel : \
- (x)->v2->ld_hash - (x)->v2->ld_rel)
-
-/*
- * Interface between crt0 & ld.so.
- */
-struct crt_i1 {
- int crt_baseaddr; /* Address ld.so is at */
- int crt_dzfd; /* /dev/zero file descriptor */
- int crt_rlfd; /* ld.so file descriptor */
- struct link_dynamic *crt_udp; /* "main_" dynamic */
- char **crt_ep; /* environment strings */
- caddr_t crt_breakp; /* place to put initial breakpoint */
-};
-
-/*
- * Structure we provide to ELF ld.so upon entry.
- */
-Elf32_Boot eb[EB_MAX];
-
-/*
- * Global data.
- */
-char *program_name; /* used in messages */
-
-/*
- * 4.0 ld.so main entry point.
- */
-rtld(version, ip, dp, argp)
- int version; /* interface version */
- struct crt_i1 *ip; /* interface passed from program */
- register struct link_dynamic *dp; /* ld.so dynamic pointer */
- caddr_t argp; /* pointer to begining of args */
-{
- char *ldso; /* name of what we really want to be */
- int i, p; /* working */
- int r; /* working (# of *our* relocations */
- int page_size = 0; /* size of a page */
- struct relocation_info *rp; /* working pointer to our relocs */
- int fd; /* fd assigned to ld.so */
- Elf32_Ehdr *ehdr; /* ELF header of ld.so */
- Elf32_Phdr *phdr; /* first Phdr in file */
- Elf32_Phdr *pptr; /* working Phdr */
- Elf32_Phdr *lph; /* last loadable Phdr */
- Elf32_Phdr *fph = 0; /* first loadable Phdr */
- caddr_t maddr; /* pointer to mapping claim */
- Elf32_Off mlen; /* total mapping claim */
- caddr_t faddr; /* first program mapping of ld.so */
- Elf32_Off foff; /* file offset for segment mapping */
- Elf32_Off flen; /* file length for segment mapping */
- caddr_t addr; /* working mapping address */
- caddr_t zaddr; /* /dev/zero working mapping addr */
- Elf32_Boot *ebp; /* communication with ld.so */
- struct stat sb; /* stat buffer for sizing */
- auxv_t *ap; /* working aux pointer */
- void (* wrt)(); /* address of write/iflush routine */
-
- /*
- * ld.so must itself be relocated, take care of this now.
- * We can not refer to global data before this step is
- * complete. Perform the relocation by stepping over all
- * entries in the relocation table and turn them into
- * absolute addresses. Note that, in order to avoid invoking
- * as yet unrelocated items, we perform the relocation count
- * by counting rather than risk invoking subroutine calls
- * to intrinsic .div or .mul routines. Note also that we
- * assume that there are no symbolic relocations to be
- * performed here.
- */
- dp->v2 = (struct link_dynamic_2 *)
- ((caddr_t)dp->v2 + ip->crt_baseaddr);
- r = 0;
- i = GETRELSZ(dp);
- while (i != 0) {
- i -= RELOC_SIZE;
- r++;
- }
- rp = (struct relocation_info *)(RELOCOFF(dp) +
- (dp->ld_version < DYNAMIC_VERSION2 ?
- (int)dp : ip->crt_baseaddr));
-
- /*
- * Determine the location of the routine that will write the relocation.
- * This hasn't yet been relocated so determine the real address using
- * our base address.
- */
- wrt = (void (*)())((caddr_t)aout_reloc_write + ip->crt_baseaddr);
-
- /*
- * Relocate ourselves - we only need RELOC_RELATIVE and RELOC_32.
- * Note, if panic() was called its probable that it will barf as the
- * corresponding plt wouldn't have been relocated yet.
- */
- for (i = 0; i < r; i++) {
- long *where = (long *)((caddr_t)rp->r_address + ip->crt_baseaddr);
- long what = ip->crt_baseaddr;
- long value;
-
- switch (rp->r_type) {
- case RELOC_RELATIVE:
- what += *where << (32-22);
- value = (*where & ~MASK(22)) | ((what >> (32-22)) & MASK(22));
- wrt(where, value);
- where++;
- what += (*where & MASK(10));
- value = (*where & ~MASK(10)) | (what & MASK(10));
- wrt(where, value);
- break;
-
- case RELOC_32:
- what += *where;
- wrt(where, what);
- break;
-
- default:
- panic("unknown relocation type %d\n", rp->r_type);
- break;
- }
- rp++;
- }
-
- /*
- * We're relocated, we can now initialize things referencing
- * static storage.
- */
- ldso = "/usr/lib/ld.so.1";
-
- /*
- * Close off the file descriptor used to get us here -- let it
- * be available for the next (probable) use below.
- */
- (void) close(ip->crt_rlfd);
-
- /*
- * Discover things about our environment: auxiliary vector (if
- * any), arguments, program name, and the like.
- */
- ebp = eb;
- program_name = (char *)(argp + sizeof (int));
- if (version != 1)
- panic("bad startup interface version of %d",
- version);
- ebp->eb_tag = EB_DYNAMIC,
- (ebp++)->eb_un.eb_ptr = (Elf32_Addr)ip->crt_udp;
- ebp->eb_tag = EB_ARGV, (ebp++)->eb_un.eb_ptr = (Elf32_Addr)program_name;
- ebp->eb_tag = EB_ENVP, (ebp++)->eb_un.eb_ptr = (Elf32_Addr)ip->crt_ep;
- ebp->eb_tag = EB_DEVZERO,
- (ebp++)->eb_un.eb_val = (Elf32_Word)ip->crt_dzfd;
- for (addr = (caddr_t)ip->crt_ep; *addr; addr += sizeof (char *))
- ;
- addr += sizeof (char *);
-
- /*
- * The kernel sends us an abbreviated aux vector with some
- * potentially handy stuff that saves us on syscalls.
- *
- * Notes on 1226113
- *
- * The f77 compiler shipped as part of SC1.0 on 4.x creates binaries
- * that use the _fix_libc_ feature of acc. This makes the resulting
- * executable object dependent on the undocumented behaviour of
- * libc's .rem and .div routines e.g. that .div returns the
- * remainder in %o3 (and similarly .rem returns the division in %o3).
- *
- * The only simple solution is to disable hardware divide for
- * all 4.x applications so that the old software routines that have
- * this "support" in them are used instead. And we do that by
- * clearing the divide-in-hardware flag from the aux vector before
- * libc's .init routine gets to see it. Awful isn't it.
- */
- ebp->eb_tag = EB_AUXV, (ebp++)->eb_un.eb_ptr = (Elf32_Addr)addr;
- for (ap = (auxv_t *)addr; ap->a_type != AT_NULL; ap++)
- if (ap->a_type == AT_PAGESZ) {
- page_size = ap->a_un.a_val;
- ebp->eb_tag = EB_PAGESIZE, (ebp++)->eb_un.eb_val =
- (Elf32_Word)page_size;
- } else if (ap->a_type == AT_SUN_HWCAP)
- ap->a_un.a_val &= ~AV_SPARC_HWDIV_32x32;
-
- /*
- * If we didn't get a page size from looking in the auxiliary
- * vector, we need to get one now.
- */
- if (page_size == 0) {
- page_size = sysconfig(_CONFIG_PAGESIZE);
- ebp->eb_tag = EB_PAGESIZE, (ebp++)->eb_un.eb_val =
- (Elf32_Word)page_size;
- }
-
- /*
- * Map in the ELF-based ld.so. Note that we're mapping it as
- * an ELF database, not as a program -- we just want to walk it's
- * data structures. Further mappings will actually establish the
- * program in the address space.
- */
- if ((fd = open(ldso, O_RDONLY)) == -1)
- panic("unable to open %s", ldso);
- if (fstat(fd, &sb) == -1)
- panic("unable to find size of %s", ldso);
- ehdr = (Elf32_Ehdr *)mmap(0, sb.st_size, PROT_READ | PROT_EXEC,
- MAP_SHARED, fd, 0);
- if (ehdr == (Elf32_Ehdr *)-1)
- panic("unable to map %s", ldso);
-
- /*
- * Validate the file we're looking at, ensure it has the correct
- * ELF structures, such as: ELF magic numbers, coded for SPARC,
- * is a ".so", etc.
- */
- if (ehdr->e_ident[EI_MAG0] != ELFMAG0 ||
- ehdr->e_ident[EI_MAG1] != ELFMAG1 ||
- ehdr->e_ident[EI_MAG2] != ELFMAG2 ||
- ehdr->e_ident[EI_MAG3] != ELFMAG3)
- panic("%s is not an ELF file", ldso);
- if (ehdr->e_ident[EI_CLASS] != ELFCLASS32 ||
- ehdr->e_ident[EI_DATA] != ELFDATA2MSB)
- panic("%s has wrong class or data encoding", ldso);
- if (ehdr->e_type != ET_DYN)
- panic("%s is not a shared object", ldso);
- if ((ehdr->e_machine != EM_SPARC) &&
- (ehdr->e_machine != EM_SPARC32PLUS))
- panic("%s is not a valid SPARC object: e_machine: %x",
- ldso, ehdr->e_machine);
- if (ehdr->e_version > EV_CURRENT)
- panic("%s has bad ELF version of %d", ldso, ehdr->e_version);
-
- /*
- * Point at program headers and start figuring out what to load.
- */
- phdr = (Elf32_Phdr *)((caddr_t)ehdr + ehdr->e_phoff);
- for (p = 0, pptr = phdr; p < (int)ehdr->e_phnum; p++,
- pptr = (Elf32_Phdr *)((caddr_t)pptr + ehdr->e_phentsize))
- if (pptr->p_type == PT_LOAD) {
- if (fph == 0) {
- fph = pptr;
- } else if (pptr->p_vaddr <= lph->p_vaddr)
- panic(
- "%s invalid program header - segments out of order", ldso);
- lph = pptr;
- }
-
- /*
- * We'd better have at least one loadable segment.
- */
- if (fph == 0)
- panic("%s has no loadable segments", ldso);
-
- /*
- * Map enough address space to hold the program (as opposed to the
- * file) represented by ld.so. The amount to be assigned is the
- * range between the end of the last loadable segment and the
- * beginning of the first PLUS the alignment of the first segment.
- * mmap() can assign us any page-aligned address, but the relocations
- * assume the alignments included in the program header. As an
- * optimization, however, let's assume that mmap() will actually
- * give us an aligned address -- since if it does, we can save
- * an munmap() later on. If it doesn't -- then go try it again.
- */
- mlen = ROUND((lph->p_vaddr + lph->p_memsz) -
- ALIGN(fph->p_vaddr, page_size), page_size);
- maddr = (caddr_t)mmap(0, mlen, PROT_READ | PROT_EXEC,
- MAP_SHARED, fd, 0);
- if (maddr == (caddr_t)-1)
- panic("unable to reserve space for %s", ldso);
- faddr = (caddr_t)ROUND(maddr, fph->p_align);
-
- /*
- * Check to see whether alignment skew was really needed.
- */
- if (faddr != maddr) {
- (void) munmap(maddr, mlen);
- mlen = ROUND((lph->p_vaddr + lph->p_memsz) -
- ALIGN(fph->p_vaddr, fph->p_align) + fph->p_align,
- page_size);
- maddr = (caddr_t)mmap(0, mlen, PROT_READ | PROT_EXEC,
- MAP_SHARED, fd, 0);
- if (maddr == (caddr_t)-1)
- panic("unable to reserve space for %s", ldso);
- faddr = (caddr_t)ROUND(maddr, fph->p_align);
- }
- ebp->eb_tag = EB_LDSO_BASE, (ebp++)->eb_un.eb_ptr = (Elf32_Addr)faddr;
-
- /*
- * We have the address space reserved, so map each loadable segment.
- */
- for (pptr = phdr; (pptr - phdr) < (int)ehdr->e_phnum; pptr++) {
-
- /*
- * Skip non-loadable segments or segments that don't occupy
- * any memory.
- */
- if ((pptr->p_type != PT_LOAD) || (pptr->p_memsz == 0))
- continue;
-
- /*
- * Determine the file offset to which the mapping will
- * directed (must be aligned) and how much to map (might
- * be more than the file in the case of .bss.)
- */
- foff = ALIGN(pptr->p_offset, page_size);
- flen = pptr->p_memsz + (pptr->p_offset - foff);
-
- /*
- * Set address of this segment relative to our base.
- */
- addr = (caddr_t)ALIGN(faddr + pptr->p_vaddr, page_size);
-
- /*
- * Unmap anything form the last mapping address to this
- * one.
- */
- if (addr - maddr) {
- (void) munmap(maddr, addr - maddr);
- mlen -= addr - maddr;
- }
-
- /*
- * Determine the mapping protection from the section
- * attributes.
- */
- i = 0;
- if (pptr->p_flags & PF_R)
- i |= PROT_READ;
- if (pptr->p_flags & PF_W)
- i |= PROT_WRITE;
- if (pptr->p_flags & PF_X)
- i |= PROT_EXEC;
- if ((caddr_t)mmap((caddr_t)addr, flen, i,
- MAP_FIXED | MAP_PRIVATE, fd, foff) == (caddr_t)-1)
- panic("unable to map a segment from %s", ldso);
-
- /*
- * If the memory occupancy of the segment overflows the
- * definition in the file, we need to "zero out" the
- * end of the mapping we've established, and if necessary,
- * map some more space from /dev/zero.
- */
- if (pptr->p_memsz > pptr->p_filesz) {
- foff = (int)faddr + pptr->p_vaddr + pptr->p_filesz;
- zaddr = (caddr_t)ROUND(foff, page_size);
- _zero(foff, zaddr - foff);
- r = (faddr + pptr->p_vaddr + pptr->p_memsz) - zaddr;
- if (r > 0)
- if ((caddr_t)mmap((caddr_t)zaddr, r, i,
- MAP_FIXED | MAP_PRIVATE, ip->crt_dzfd,
- 0) == (caddr_t)-1)
- panic(
- "unable to map .bss /dev/zero for %s",
- ldso);
- }
-
- /*
- * Update the mapping claim pointer.
- */
- maddr = addr + ROUND(flen, page_size);
- mlen -= maddr - addr;
- }
-
- /*
- * Unmap any final reservation.
- */
- if (mlen > 0)
- (void) munmap(maddr, mlen);
-
- /*
- * Clean up file descriptor space we've consumed. Pass along
- * the /dev/zero file descriptor we got -- every cycle counts.
- */
- (void) close(fd);
-
- /*
- * The call itself. Note that we start 1 instruction word in.
- * The ELF ld.so contains an "entry vector" of branch instructions,
- * which, for our interest are:
- * +0: ba, a <normal startup>
- * +4: ba, a <compatibility startup>
- * By starting at the compatibility startup, the ELF ld.so knows
- * that a pointer to "eb" is available to it and further knows
- * how to calculate the offset to the program's arguments and
- * other structures.
- */
- ebp->eb_tag = EB_NULL, ebp->eb_un.eb_val = 0;
- (*((void (*)())(ehdr->e_entry + faddr + sizeof (long))))(eb);
- return (0);
-}
diff --git a/usr/src/cmd/sgs/rtld.4.x/rtldlib.s b/usr/src/cmd/sgs/rtld.4.x/rtldlib.s
deleted file mode 100644
index dcaf82ac45..0000000000
--- a/usr/src/cmd/sgs/rtld.4.x/rtldlib.s
+++ /dev/null
@@ -1,145 +0,0 @@
-! CDDL HEADER START
-!
-! The contents of this file are subject to the terms of the
-! Common Development and Distribution License (the "License").
-! You may not use this file except in compliance with the License.
-!
-! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-! or http://www.opensolaris.org/os/licensing.
-! See the License for the specific language governing permissions
-! and limitations under the License.
-!
-! When distributing Covered Code, include this CDDL HEADER in each
-! file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-! If applicable, add the following below this CDDL HEADER, with the
-! fields enclosed by brackets "[]" replaced with your own identifying
-! information: Portions Copyright [yyyy] [name of copyright owner]
-!
-! CDDL HEADER END
-!
-! Copyright 2010 Sun Microsystems, Inc. All rights reserved.
-! Use is subject to license terms.
-!
-! SPARC support routines for 4.x compatibility dynamic linker.
-
-#include <sys/asm_linkage.h> ! N.B.: although this is the 4.x
-#include <sys/syscall.h> ! compatibility stuff, it actually
- ! runs only on the SVR4 base, and
- ! is compiled in an SVR4 .h environment
-
-#define AT_FDCWD 0xffd19553
-
-! ld.so bootstrap. Called from crt0 of a dynamically linked program with:
-! %i0: version number (always 1)
-! %i1: address of crt0 structure, which contains:
-! +0 base address of where we are mapped
-! +4 open file descriptor for /dev/zero
-! +8 open file descriptor for ld.so
-! +c a.out _DYNAMIC address
-! +10 environment strings
-! +14 break address for adb/dbx
-
-start_rtld:
- save %sp,-SA(MINFRAME),%sp ! build frame
-L1:
- call 1f ! get absolute address of _GOT_
- nop
-1:
- sethi %hi(__GLOBAL_OFFSET_TABLE_ - (L1 - 1b)), %l7
-L2:
- or %l7, %lo(__GLOBAL_OFFSET_TABLE_ - (L1 - L2)), %l7
- add %l7, %o7, %l7
- mov %i0, %o0 ! pass version through
- add %fp, %i1, %l0 ! get interface pointer
- mov %l0, %o1 ! ptr to interface structure
- ld [%l0], %l2 ! address where ld.so is mapped in
- ld [%l7], %l1 ! ptr to ld.so first entry in globtable
- add %l2, %l1, %o2 ! relocate ld.so _DYNAMIC
- add %fp, 0xd8, %o3 ! point to arg count (is it safe?)
- ld [%l7 + _rtld], %g1 ! manually fix pic reference to rtld
- add %g1, %l2, %g1 ! by adding offset to GOT entry
- jmpl %g1, %o7 ! go there
- nop ! delay
- mov 0,%o0
- mov %o0,%i0
- ret
- restore
-
-
-!
-! aout_reloc_write
-! Update a relocation offset, the value replaces any original
-! value in the relocation offset.
-!
-
- .global _aout_reloc_write
-
-_aout_reloc_write:
- st %o1, [%o0] ! Store value in the offset
- retl
- iflush %o0 ! Flush instruction memory
-
-
-! Special system call stubs to save system call overhead
-
- .global _open, _mmap, _munmap, _read, _write, _lseek, _close
- .global _fstat, _sysconfig, __exit
-_open: ! open(path, oflags, mode) =>
- mov %o2, %o3 ! openat(AT_FDCWD, path, oflag, mode)
- mov %o1, %o2
- mov %o0, %o1
- sethi %hi(AT_FDCWD), %o0
- or %o0, %lo(AT_FDCWD), %o0
- ba __syscall
- mov SYS_openat, %g1
-
-_mmap:
- sethi %hi(0x80000000), %g1 ! MAP_NEW
- or %g1, %o3, %o3
- ba __syscall
- mov SYS_mmap, %g1
-
-_munmap:
- ba __syscall
- mov SYS_munmap, %g1
-
-_read:
- ba __syscall
- mov SYS_read, %g1
-
-_write:
- ba __syscall
- mov SYS_write, %g1
-
-_lseek:
- ba __syscall
- mov SYS_lseek, %g1
-
-_close:
- ba __syscall
- mov SYS_close, %g1
-
-_fstat: ! fstat(fd, statb) =>
- mov %g0, %o3 ! fstatat(fd, NULL, statb, 0)
- mov %o1, %o2
- mov %g0, %o1
- ba __syscall
- mov SYS_fstatat, %g1
-
-_sysconfig:
- ba __syscall
- mov SYS_sysconfig, %g1
-
-__exit:
- mov SYS_exit, %g1
-
-__syscall:
- t 0x8 ! call the system call
- bcs __err_exit ! test for error
- nop
- retl ! return
- nop
-
-__err_exit:
- retl ! return
- mov -1, %o0
diff --git a/usr/src/cmd/sgs/rtld.4.x/rtsubrs.c b/usr/src/cmd/sgs/rtld.4.x/rtsubrs.c
deleted file mode 100644
index f08a707a94..0000000000
--- a/usr/src/cmd/sgs/rtld.4.x/rtsubrs.c
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Copyright (c) 1987, 1988, 1989, 1990 by Sun Microsystems, Inc.
- */
-
-/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
-
-/*
- * Subroutines for the 4.0 compatibility run-time link editor.
- */
-#include <varargs.h>
-#include <sys/types.h>
-
-/*
- * Local "printf" & stdio facilities.
- */
-int stdout = 1; /* File descriptor for output */
-int stderr = 2; /* File descriptor for errors */
-
-static char *printn();
-static void prf();
-static void doprf();
-static int _write();
-
-/*
- * printf
- */
-/*VARARGS1*/
-printf(fmt, va_alist)
- char *fmt;
- va_dcl
-{
- va_list x1;
-
- va_start(x1);
- prf(stdout, fmt, x1);
- va_end(x1);
-}
-
-/*
- * fprintf
- */
-/*VARARGS2*/
-fprintf(fd, fmt, va_alist)
- int fd;
- char *fmt;
- va_dcl
-{
- va_list x1;
-
- va_start(x1);
- prf(fd, fmt, x1);
- va_end(x1);
-}
-
-/*
- * panic
- */
-/*VARARGS2*/
-panic(fmt, va_alist)
- char *fmt;
- va_dcl
-{
- va_list x1;
- extern char *program_name;
-
- va_start(x1);
- prf(stderr, "%s (4.x.ld.so): ", program_name);
- prf(stderr, fmt, x1);
- prf(stderr, "\n", x1);
- va_end(x1);
- _exit(127);
- /* NOTREACHED */
-}
-
-/*
- * sprintf
- */
-/*VARARGS2*/
-sprintf(cp, fmt, va_alist)
- char *cp;
- char *fmt;
- va_dcl
-{
- va_list x1;
-
- va_start(x1);
- doprf(-1, fmt, x1, cp);
- va_end(x1);
-}
-
-/*
- * printf worker functions
- */
-static void
-prf(fd, fmt, adx)
- int fd;
- char *fmt;
- va_list adx;
-{
- char linebuf[128];
-
- doprf(fd, fmt, adx, linebuf);
-}
-
-static void
-doprf(fd, fmt, adx, linebuf)
- int fd;
- register char *fmt;
- register va_list adx;
- char *linebuf;
-{
- register int c; /* Character temporary */
- register char *lbp; /* Pointer into stack buffer */
- register char *s; /* %s temporary */
- int i; /* General integer temporary */
- int b; /* Conversion base */
-
-#define PUTCHAR(c) { \
- if (lbp >= &linebuf[128]) { \
- _write(fd, linebuf, lbp - &linebuf[0]); \
- lbp = &linebuf[0]; \
- } \
- *lbp++ = (c); \
- }
-
- lbp = &linebuf[0];
-loop:
- while ((c = *fmt++) != '%') {
- if (c == '\0') {
- _write(fd, linebuf, lbp - &linebuf[0]);
- return;
- }
- PUTCHAR(c);
- }
-again:
- c = *fmt++;
- /* THIS CODE IS VAX DEPENDENT IN HANDLING %l? AND %c */
- switch (c) {
-
- case 'x': case 'X':
- b = 16;
- goto number;
- case 'd': case 'D':
- case 'u': /* what a joke */
- b = 10;
- goto number;
- case 'o': case 'O':
- b = 8;
-number:
- lbp = printn(fd, va_arg(adx, u_long), b, &linebuf[0], lbp,
- &linebuf[128]);
- break;
-
- case 'c':
- b = va_arg(adx, int);
- for (i = 24; i >= 0; i -= 8)
- if (c = (b >> i) & 0x7f) {
- PUTCHAR(c);
- }
- break;
-
- case 's':
- s = va_arg(adx, char *);
- while (c = *s++) {
- PUTCHAR(c);
- }
- break;
-
- case '%':
- PUTCHAR('%');
- break;
- }
- goto loop;
-}
-
-/*
- * Printn prints a number n in base b.
- */
-static char *
-printn(fd, n, b, linebufp, lbp, linebufend)
- int fd; /* File descriptor to get output */
- u_long n; /* Number */
- int b; /* Base */
- char *linebufp; /* Buffer location */
- register char *lbp; /* Current offset in buffer */
- char *linebufend; /* Where buffer ends */
-{
- char prbuf[11]; /* Local result accumulator */
- register char *cp;
-
-#undef PUTCHAR
-#define PUTCHAR(c) { \
- if (lbp >= linebufend) { \
- _write(fd, linebufp, lbp - linebufp); \
- lbp = linebufp; \
- } \
- *lbp++ = (c); \
- }
-
- if (b == 10 && (int)n < 0) {
- PUTCHAR('-');
- n = (unsigned)(-(int)n);
- }
- cp = prbuf;
- do {
- *cp++ = "0123456789abcdef"[n%b];
- n /= b;
- } while (n);
- do {
- PUTCHAR(*--cp);
- } while (cp > prbuf);
- return (lbp);
-}
-
-static int
-_write(fd, buf, len)
- int fd;
- char *buf;
- int len;
-{
-
- if (fd == -1) {
- *(buf + len) = '\0';
- return (0);
- }
- return (write(fd, buf, len));
-}
diff --git a/usr/src/cmd/sgs/rtld.4.x/umultiply.s b/usr/src/cmd/sgs/rtld.4.x/umultiply.s
deleted file mode 100644
index 2547339a7e..0000000000
--- a/usr/src/cmd/sgs/rtld.4.x/umultiply.s
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * .seg "data"
- * .asciz "Copyr 1987 Sun Micro"
- * .align 4
- */
- .seg "text"
-
-#ident "%Z%%M% %I% %E% SMI"
-
-! Copyright (c) 1987 by Sun Microsystems, Inc.
-
-
-#include <sys/asm_linkage.h>
-
-/*
- * procedure to perform a 32 by 32 unsigned integer multiply.
- * pass the multiplier into %o0, and the multiplicand into %o1
- * the least significant 32 bits of the result will be returned in %o0,
- * and the most significant in %o1
- *
- * Most unsigned integer multiplies involve small numbers, so it is
- * worthwhile to optimize for short multiplies at the expense of long
- * multiplies. This code checks the size of the multiplier, and has
- * special cases for the following:
- *
- * 4 or fewer bit multipliers: 19 or 21 instruction cycles
- * 8 or fewer bit multipliers: 26 or 28 instruction cycles
- * 12 or fewer bit multipliers: 34 or 36 instruction cycles
- * 16 or fewer bit multipliers: 42 or 44 instruction cycles
- *
- * Long multipliers require 58 or 60 instruction cycles:
- *
- * This code indicates that overflow has occured, by leaving the Z condition
- * code clear. The following call sequence would be used if you wish to
- * deal with overflow:
- *
- * call .umul
- * nop ( or set up last parameter here )
- * bnz overflow_code (or tnz to overflow handler)
- */
-
-! RTENTRY(.umul)
- .global .umul
-.umul:
- wr %o0, %y ! multiplier to Y register
-
- andncc %o0, 0xf, %o4 ! mask out lower 4 bits; if branch
- ! taken, %o4, N and V have been cleared
-
- be umul_4bit ! 4-bit multiplier
- sethi %hi(0xffff0000), %o5 ! mask for 16-bit case; have to
- ! wait 3 instructions after wd
- ! before %y has stabilized anyway
-
- andncc %o0, 0xff, %o4
- be,a umul_8bit ! 8-bit multiplier
- mulscc %o4, %o1, %o4 ! first iteration of 9
-
- andncc %o0, 0xfff, %o4
- be,a umul_12bit ! 12-bit multiplier
- mulscc %o4, %o1, %o4 ! first iteration of 13
-
- andcc %o0, %o5, %o4
- be,a umul_16bit ! 16-bit multiplier
- mulscc %o4, %o1, %o4 ! first iteration of 17
-
- andcc %g0, %g0, %o4 ! zero the partial product
- ! and clear N and V conditions
- !
- ! long multiply
- !
- mulscc %o4, %o1, %o4 ! first iteration of 33
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4 ! 32nd iteration
- mulscc %o4, %g0, %o4 ! last iteration only shifts
- !
- ! For unsigned multiplies, a pure shifty-add approach yields the
- ! correct result. Signed multiplies introduce complications.
- !
- ! With 32-bit twos-complement numbers, -x can be represented as
- !
- ! ((2 - (x/(2**32)) mod 2) * 2**32.
- !
- ! To simplify the equations, the radix point can be moved to just
- ! to the left of the sign bit. So:
- !
- ! x * y = (xy) mod 2
- ! -x * y = (2 - x) mod 2 * y = (2y - xy) mod 2
- ! x * -y = x * (2 - y) mod 2 = (2x - xy) mod 2
- ! -x * -y = (2 - x) * (2 - y) = (4 - 2x - 2y + xy) mod 2
- !
- ! Because of the way the shift into the partial product is calculated
- ! (N xor V), the extra term is automagically removed for negative
- ! multiplicands, so no adjustment is necessary.
- !
- ! But for unsigned multiplies, the high-order bit of the multiplicand
- ! is incorrectly treated as a sign bit. For unsigned multiplies where
- ! the high-order bit of the multiplicand is one, the result is
- !
- ! xy - y * (2**32)
- !
- ! we fix that here
- !
- tst %o1
- bge 1f
- nop
-
- add %o4, %o0, %o4 ! add (2**32) * %o0; bits 63-32
- ! of the product are in %o4
- !
- ! The multiply hasn't overflowed if the high-order bits are 0
- !
- ! if you are not interested in detecting overflow,
- ! replace the following code with:
- !
- ! 1:
- ! rd %y, %o0
- ! retl
- ! mov %o4, %o1
- !
-1:
- rd %y, %o0
- retl ! leaf routine return
- addcc %o4, %g0, %o1 ! return high-order bits and set Z if
- ! high order bits are 0
- !
- ! 4-bit multiply
- !
-umul_4bit:
- mulscc %o4, %o1, %o4 ! first iteration of 5
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4 ! 4th iteration
- mulscc %o4, %g0, %o4 ! last iteration only shifts
-
- rd %y, %o5
- !
- ! The folowing code adds (2**32) * %o0 to the product if the
- ! multiplicand had it's high bit set (see 32-bit case for explanation)
- !
- tst %o1
- bge 2f
- sra %o4, 28, %o1 ! right shift high bits by 28 bits
-
- add %o1, %o0, %o1
- !
- ! The multiply hasn't overflowed if high-order bits are 0
- !
- ! if you are not interested in detecting overflow,
- ! replace the following code with:
- !
- ! 2:
- ! sll %o4, 4, %o0
- ! srl %o5, 28, %o5
- ! retl
- ! or %o5, %o0, %o0
- !
-2:
- sll %o4, 4, %o0 ! left shift middle bits by 4 bits
- srl %o5, 28, %o5 ! right shift low bits by 28 bits
- or %o5, %o0, %o0 ! merge for true product
- retl ! leaf routine return
- tst %o1 ! set Z if high order bits are 0
- !
- ! 8-bit multiply
- !
-umul_8bit:
- mulscc %o4, %o1, %o4 ! second iteration of 9
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4 ! 8th iteration
- mulscc %o4, %g0, %o4 ! last iteration only shifts
-
- rd %y, %o5
- !
- ! The folowing code adds (2**32) * %o0 to the product if the
- ! multiplicand had it's high bit set (see 32-bit case for explanation)
- !
- tst %o1
- bge 3f
- sra %o4, 24, %o1 ! right shift high bits by 24 bits
-
- add %o1, %o0, %o1
- !
- ! The multiply hasn't overflowed if high-order bits are 0
- !
- ! if you are not interested in detecting overflow,
- ! replace the following code with:
- !
- ! 3:
- ! sll %o4, 8, %o0
- ! srl %o5, 24, %o5
- ! retl
- ! or %o5, %o0, %o0
- !
-3:
- sll %o4, 8, %o0 ! left shift middle bits by 8 bits
- srl %o5, 24, %o5 ! right shift low bits by 24 bits
- or %o5, %o0, %o0 ! merge for true product
- retl ! leaf routine return
- tst %o1 ! set Z if high order bits are 0
- !
- ! 12-bit multiply
- !
-umul_12bit:
- mulscc %o4, %o1, %o4 ! second iteration of 13
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4 ! 12th iteration
- mulscc %o4, %g0, %o4 ! last iteration only shifts
-
- rd %y, %o5
- !
- ! The folowing code adds (2**32) * %o0 to the product if the
- ! multiplicand had it's high bit set (see 32-bit case for explanation)
- !
- tst %o1
- bge 4f
- sra %o4, 20, %o1 ! right shift high bits by 20 bits
-
- add %o1, %o0, %o1
- !
- ! The multiply hasn't overflowed if high-order bits are 0
- !
- ! if you are not interested in detecting overflow,
- ! replace the following code with:
- !
- ! 4:
- ! sll %o4, 12, %o0
- ! srl %o5, 20, %o5
- ! retl
- ! or %o5, %o0, %o0
- !
-4:
- sll %o4, 12, %o0 ! left shift middle bits by 12 bits
- srl %o5, 20, %o5 ! right shift low bits by 20 bits
- or %o5, %o0, %o0 ! merge for true product
- retl ! leaf routine return
- tst %o1 ! set Z if high order bits are 0
- !
- ! 16-bit multiply
- !
-umul_16bit:
- mulscc %o4, %o1, %o4 ! second iteration of 17
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4
- mulscc %o4, %o1, %o4 ! 16th iteration
- mulscc %o4, %g0, %o4 ! last iteration only shifts
-
- rd %y, %o5
- !
- ! The folowing code adds (2**32) * %o0 to the product if the
- ! multiplicand had it's high bit set (see 32-bit case for explanation)
- !
- tst %o1
- bge 5f
- sra %o4, 16, %o1 ! right shift high bits by 16 bits
-
- add %o1, %o0, %o1
- !
- ! The multiply hasn't overflowed if high-order bits are 0
- !
- ! if you are not interested in detecting overflow,
- ! replace the following code with:
- !
- ! 5:
- ! sll %o4, 16, %o0
- ! srl %o5, 16, %o5
- ! retl
- ! or %o5, %o0, %o0
- !
-5:
- sll %o4, 16, %o0 ! left shift middle bits by 16 bits
- srl %o5, 16, %o5 ! right shift low bits by 16 bits
- or %o5, %o0, %o0 ! merge for true product
- retl ! leaf routine return
- tst %o1 ! set Z if high order bits are 0
diff --git a/usr/src/cmd/sgs/rtld.4.x/zero.s b/usr/src/cmd/sgs/rtld.4.x/zero.s
deleted file mode 100644
index d1efb94138..0000000000
--- a/usr/src/cmd/sgs/rtld.4.x/zero.s
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright (c) 1990, 1991 Sun Microsystems, Inc.
- */
-
-#ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Routine to zero out a section of memory (the tail end of the data segment
- * upto a page boundary). First nibble off any bytes up to the first double
- * aligned word, and then clear doubles until the byte count is zero. Note,
- * this assumes the count specified has been rounded to end on a double word
- * boundary.
- *
- * %o0 = addr, %o1 = len
- */
-
- .seg "text"
- .global __zero
-__zero:
- tst %o1 ! Have we any count at all?
- ba 3f ! Go find out,
- clr %g1 ! but prepare for long loop
-
-! Byte clearing loop
-
-0:
- inc %o0 ! Bump address
- deccc %o1 ! Decrement count
-3:
- bz 1f ! If no count left, exit
- andcc %o0, 7, %g0 ! Is the address less than double-word aligned?
- bnz,a 0b ! Branch if so
- clrb [%o0] ! but clear the current byte anyway
-
-! Double clearing loop
-
-2:
- std %g0, [%o0] ! Clear next 8 bytes
- subcc %o1, 8, %o1 ! Decrement count
- bnz 2b ! Branch if any left
- inc 8, %o0 ! but always increment address by 8
-1:
- retl ! Go home
- nop
diff --git a/usr/src/man/man5/system.5 b/usr/src/man/man5/system.5
index ff7b84c0b7..b4cef157ba 100644
--- a/usr/src/man/man5/system.5
+++ b/usr/src/man/man5/system.5
@@ -3,15 +3,15 @@
.\" Copyright 2016 Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
.\" Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
.\" Copyright 2019 Peter Tribble
+.\" Copyright 2022 Garrett D'Amore <garrett@damore.org>
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH SYSTEM 5 "Apr 20, 2019"
+.TH SYSTEM 5 "June 30, 2022"
.SH NAME
system \- system configuration information file
.SH DESCRIPTION
-.LP
The \fBsystem\fR file is used for customizing the operation of the operating
system kernel. The recommended procedure is to preserve the original
\fBsystem\fR file before modifying it.
@@ -52,54 +52,36 @@ namespace. The following namespaces are currently supported on all platforms:
.sp
.ne 2
.na
-\fB\fBdrv\fR\fR
+\fBdacf\fR
.ad
.RS 10n
-Modules in this namespace are device drivers.
+These modules provide rules and actions for device auto-configuration.
.RE
.sp
.ne 2
.na
-\fB\fBexec\fR\fR
+\fB\fBdrv\fR\fR
.ad
.RS 10n
-Modules in this namespace are execution format modules. The following
-\fBexec\fR modules are currently provided:
-.sp
-.ne 2
-.na
-\fBOnly on SPARC systems:\fR
-.ad
-.RS 28n
-.sp
-.in +2
-.nf
-aoutexec
-.fi
-.in -2
-.sp
-
+Modules in this namespace are device drivers.
.RE
.sp
.ne 2
.na
-\fBOn SPARC and IA systems:\fR
+\fB\fBexec\fR\fR
.ad
-.RS 28n
+.RS 10n
+Modules in this namespace are execution format modules. The following
+\fBexec\fR modules are currently provided:
.sp
-.in +2
+.ne 2
.nf
elfexec
intpexec
javaexec
.fi
-.in -2
-.sp
-
-.RE
-
.RE
.sp
@@ -160,36 +142,6 @@ These modules do not fit into any of the above categories, so are considered
.sp
.LP
-SPARC only:
-.sp
-.ne 2
-.na
-\fB\fBdacf\fR\fR
-.ad
-.RS 8n
-These modules provide rules and actions for device auto-configuration.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBtod\fR\fR
-.ad
-.RS 8n
-These modules provide support for the time of day hardware.
-.RE
-
-.sp
-.ne 2
-.na
-\fB\fBcpu\fR\fR
-.ad
-.RS 8n
-These modules provide \fBCPU\fR-specific kernel routines.
-.RE
-
-.sp
-.LP
A description of each of the supported commands follows:
.sp
.ne 2
@@ -299,9 +251,7 @@ escape sequences are supported within the quoted string:
.RE
.SH EXAMPLES
-.LP
\fBExample 1 \fRA sample \fBsystem\fR file.
-.sp
.LP
The following is a sample \fBsystem\fR file.
@@ -350,12 +300,10 @@ set moddebug | 0x40
.sp
.SH SEE ALSO
-.LP
.BR boot (8),
.BR init (8),
.BR kernel (8)
.SH WARNINGS
-.LP
Use care when modifying the \fBsystem\fR file; it modifies the operation of the
kernel. If you preserved the original \fBsystem\fR file, you can boot using
\fBboot -a\fR, which will ask you to specify the path to the saved file. This
@@ -364,5 +312,4 @@ file that will work, you may specify \fB/dev/null\fR. This acts as an empty
\fBsystem\fR file, and the system will attempt to boot using its default
settings.
.SH NOTES
-.LP
The \fBsystem\fR files are read only once, at boot time.
diff --git a/usr/src/pkg/manifests/system-kernel.p5m b/usr/src/pkg/manifests/system-kernel.p5m
index 208bd86844..4ab8a619b7 100644
--- a/usr/src/pkg/manifests/system-kernel.p5m
+++ b/usr/src/pkg/manifests/system-kernel.p5m
@@ -276,7 +276,6 @@ file path=kernel/drv/vnic.conf group=sys
file path=kernel/drv/wc.conf group=sys
dir path=kernel/exec group=sys
dir path=kernel/exec/$(ARCH64) group=sys
-$(sparc_ONLY)file path=kernel/exec/$(ARCH64)/aoutexec group=sys mode=0755
file path=kernel/exec/$(ARCH64)/elfexec group=sys mode=0755
file path=kernel/exec/$(ARCH64)/intpexec group=sys mode=0755
dir path=kernel/firmware group=sys
diff --git a/usr/src/tools/findunref/exception_list.open b/usr/src/tools/findunref/exception_list.open
index ebf81e1c4e..25a4d3efd7 100644
--- a/usr/src/tools/findunref/exception_list.open
+++ b/usr/src/tools/findunref/exception_list.open
@@ -85,7 +85,6 @@
# Ignore internal packages, scripts, and tools that are intentionally not
# built or used during a nightly.
#
-./usr/src/cmd/sgs/rtld.4.x
./usr/src/prototypes
./usr/src/cmd/pools/poold/com/sun/solaris/*/*/package.html
./usr/src/uts/intel/io/acpica/cmp_ca.sh
diff --git a/usr/src/uts/common/conf/param.c b/usr/src/uts/common/conf/param.c
index 9a7a08d380..a4266ba267 100644
--- a/usr/src/uts/common/conf/param.c
+++ b/usr/src/uts/common/conf/param.c
@@ -23,6 +23,7 @@
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1983, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Milan Jurik. All rights reserved.
+ * Copyright 2022 Garrett D'Amore <garrett@damore.org>
*/
#include <sys/types.h>
@@ -336,11 +337,6 @@ short elfmagic = 0x7f45;
short intpmagic = 0x2321;
short jmagic = 0x504b;
-#if defined(__sparc)
-short aout_nmagic = NMAGIC;
-short aout_zmagic = ZMAGIC;
-short aout_omagic = OMAGIC;
-#endif
short nomagic = 0;
/*
@@ -350,9 +346,6 @@ short nomagic = 0;
#define ELF64MAGIC_STRING "\x7f""ELF\x2"
#define INTPMAGIC_STRING "#!"
#define JAVAMAGIC_STRING "PK\003\004"
-#define AOUT_OMAGIC_STRING "\x1""\x07" /* 0407 */
-#define AOUT_NMAGIC_STRING "\x1""\x08" /* 0410 */
-#define AOUT_ZMAGIC_STRING "\x1""\x0b" /* 0413 */
#define NOMAGIC_STRING ""
#define SHBIN_CNTL(x) ((x)&037)
@@ -364,11 +357,6 @@ char elf64magicstr[] = ELF64MAGIC_STRING;
char intpmagicstr[] = INTPMAGIC_STRING;
char shbinmagicstr[] = SHBINMAGIC_STRING;
char javamagicstr[] = JAVAMAGIC_STRING;
-#if defined(__sparc)
-char aout_nmagicstr[] = AOUT_NMAGIC_STRING;
-char aout_zmagicstr[] = AOUT_ZMAGIC_STRING;
-char aout_omagicstr[] = AOUT_OMAGIC_STRING;
-#endif
char nomagicstr[] = NOMAGIC_STRING;
char *execswnames[] = {
@@ -379,11 +367,6 @@ char *execswnames[] = {
"intpexec",
"shbinexec",
"javaexec",
-#if defined(__sparc)
- "aoutexec",
- "aoutexec",
- "aoutexec",
-#endif
NULL,
NULL,
NULL
@@ -397,11 +380,6 @@ struct execsw execsw[] = {
{ intpmagicstr, 0, 2, NULL, NULL, NULL },
{ shbinmagicstr, 0, SHBINMAGIC_LEN, NULL, NULL, NULL },
{ javamagicstr, 0, 4, NULL, NULL, NULL },
-#if defined(__sparc)
- { aout_zmagicstr, 2, 2, NULL, NULL, NULL },
- { aout_nmagicstr, 2, 2, NULL, NULL, NULL },
- { aout_omagicstr, 2, 2, NULL, NULL, NULL },
-#endif
{ nomagicstr, 0, 0, NULL, NULL, NULL },
{ nomagicstr, 0, 0, NULL, NULL, NULL },
{ nomagicstr, 0, 0, NULL, NULL, NULL },
diff --git a/usr/src/uts/common/exec/aout/aout.c b/usr/src/uts/common/exec/aout/aout.c
deleted file mode 100644
index fc45bd9544..0000000000
--- a/usr/src/uts/common/exec/aout/aout.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- * Copyright (c) 2011 Bayard G. Bell. All rights reserved.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/fpu/fpusystm.h>
-#include <sys/sysmacros.h>
-#include <sys/signal.h>
-#include <sys/cred.h>
-#include <sys/user.h>
-#include <sys/errno.h>
-#include <sys/vnode.h>
-#include <sys/mman.h>
-#include <sys/kmem.h>
-#include <sys/proc.h>
-#include <sys/pathname.h>
-#include <sys/cmn_err.h>
-#include <sys/debug.h>
-#include <sys/exec.h>
-#include <sys/exechdr.h>
-#include <sys/auxv.h>
-#include <sys/core.h>
-#include <sys/vmparam.h>
-#include <sys/archsystm.h>
-#include <sys/fs/swapnode.h>
-#include <sys/modctl.h>
-#include <vm/anon.h>
-#include <vm/as.h>
-#include <vm/seg.h>
-
-static int aoutexec(vnode_t *vp, execa_t *uap, uarg_t *args,
- intpdata_t *idatap, int level, long *execsz, int setid,
- caddr_t exec_file, cred_t *cred, int brand_action);
-static int get_aout_head(struct vnode **vpp, struct exdata *edp, long *execsz,
- int *isdyn);
-static int aoutcore(vnode_t *vp, proc_t *pp, cred_t *credp,
- rlim64_t rlimit, int sig, core_content_t content);
-extern int elf32exec(vnode_t *, execa_t *, uarg_t *, intpdata_t *, int,
- long *, int, caddr_t, cred_t *, int);
-extern int elf32core(vnode_t *, proc_t *, cred_t *, rlim64_t, int,
- core_content_t);
-
-static struct execsw nesw = {
- aout_nmagicstr,
- 2,
- 2,
- aoutexec,
- aoutcore
-};
-
-static struct execsw zesw = {
- aout_zmagicstr,
- 2,
- 2,
- aoutexec,
- aoutcore
-};
-
-static struct execsw oesw = {
- aout_omagicstr,
- 2,
- 2,
- aoutexec,
- aoutcore
-};
-
-/*
- * Module linkage information for the kernel.
- */
-static struct modlexec nexec = {
- &mod_execops, "exec for NMAGIC", &nesw
-};
-
-static struct modlexec zexec = {
- &mod_execops, "exec for ZMAGIC", &zesw
-};
-
-static struct modlexec oexec = {
- &mod_execops, "exec for OMAGIC", &oesw
-};
-
-static struct modlinkage modlinkage = {
- MODREV_1, &nexec, &zexec, &oexec, NULL
-};
-
-int
-_init(void)
-{
- return (mod_install(&modlinkage));
-}
-
-int
-_fini(void)
-{
- return (mod_remove(&modlinkage));
-}
-
-int
-_info(struct modinfo *modinfop)
-{
- return (mod_info(&modlinkage, modinfop));
-}
-
-
-/*ARGSUSED*/
-static int
-aoutexec(vnode_t *vp, struct execa *uap, struct uarg *args,
- struct intpdata *idatap, int level, long *execsz, int setid,
- caddr_t exec_file, cred_t *cred, int brand_action)
-{
- auxv32_t auxflags_auxv32;
- int error;
- struct exdata edp, edpout;
- struct execenv exenv;
- proc_t *pp = ttoproc(curthread);
- struct vnode *nvp;
- int pagetext, pagedata;
- int dataprot = PROT_ALL;
- int textprot = PROT_ALL & ~PROT_WRITE;
- int isdyn;
-
-
- args->to_model = DATAMODEL_ILP32;
- *execsz = btopr(SINCR) + btopr(SSIZE) + btopr(NCARGS32-1);
-
- /*
- * Read in and validate the file header.
- */
- if (error = get_aout_head(&vp, &edp, execsz, &isdyn))
- return (error);
-
- if (error = chkaout(&edp))
- return (error);
-
- /*
- * Take a quick look to see if it looks like we will have
- * enough swap space for the program to get started. This
- * is not a guarantee that we will succeed, but it is definitely
- * better than finding this out after we are committed to the
- * new memory image. Maybe what is needed is a way to "prereserve"
- * swap space for some segment mappings here.
- *
- * But with shared libraries the process can make it through
- * the exec only to have ld.so fail to get the program going
- * because its mmap's will not be able to succeed if the system
- * is running low on swap space. In fact this is a far more
- * common failure mode, but we cannot do much about this here
- * other than add some slop to our anonymous memory resources
- * requirements estimate based on some guess since we cannot know
- * what else the program will really need to get to a useful state.
- *
- * XXX - The stack size (clrnd(SSIZE + btopr(nargc))) should also
- * be used when checking for swap space. This requires some work
- * since nargc is actually determined in exec_args() which is done
- * after this check and hence we punt for now.
- *
- * nargc = SA(nc + (na + 4) * NBPW) + sizeof (struct rwindow);
- */
- if (CURRENT_TOTAL_AVAILABLE_SWAP < btopr(edp.ux_dsize) + btopr(SSIZE))
- return (ENOMEM);
-
- /*
- * Load the trap 0 interpreter.
- */
- if (error = lookupname("/usr/4lib/sbcp", UIO_SYSSPACE, FOLLOW,
- NULLVPP, &nvp)) {
- goto done;
- }
- if (error = elf32exec(nvp, uap, args, idatap, level, execsz,
- setid, exec_file, cred, brand_action)) {
- VN_RELE(nvp);
- return (error);
- }
- VN_RELE(nvp);
-
- /*
- * Determine the a.out's characteristics.
- */
- getexinfo(&edp, &edpout, &pagetext, &pagedata);
-
- /*
- * Load the a.out's text and data.
- */
- if (error = execmap(edp.vp, edp.ux_txtorg, edp.ux_tsize,
- (size_t)0, edp.ux_toffset, textprot, pagetext, 0))
- goto done;
- if (error = execmap(edp.vp, edp.ux_datorg, edp.ux_dsize,
- edp.ux_bsize, edp.ux_doffset, dataprot, pagedata, 0))
- goto done;
-
- exenv.ex_bssbase = (caddr_t)edp.ux_datorg;
- exenv.ex_brkbase = (caddr_t)edp.ux_datorg;
- exenv.ex_brksize = edp.ux_dsize + edp.ux_bsize;
- exenv.ex_magic = edp.ux_mag;
- exenv.ex_vp = edp.vp;
- setexecenv(&exenv);
-
- /*
- * It's time to manipulate the process aux vectors.
- * We need to update the AT_SUN_AUXFLAGS aux vector to set
- * the AF_SUN_NOPLM flag.
- */
- if (copyin(args->auxp_auxflags, &auxflags_auxv32,
- sizeof (auxflags_auxv32)) != 0)
- return (EFAULT);
-
- ASSERT(auxflags_auxv32.a_type == AT_SUN_AUXFLAGS);
- auxflags_auxv32.a_un.a_val |= AF_SUN_NOPLM;
- if (copyout(&auxflags_auxv32, args->auxp_auxflags,
- sizeof (auxflags_auxv32)) != 0)
- return (EFAULT);
-
-done:
- if (error != 0)
- psignal(pp, SIGKILL);
- else {
- /*
- * Ensure that the max fds do not exceed 256 (this is
- * applicable to 4.x binaries, which is why we only
- * do it on a.out files).
- */
- struct rlimit64 fdno_rlim;
- rctl_alloc_gp_t *gp = rctl_rlimit_set_prealloc(1);
-
- mutex_enter(&curproc->p_lock);
- (void) rctl_rlimit_get(rctlproc_legacy[RLIMIT_NOFILE], curproc,
- &fdno_rlim);
- if (fdno_rlim.rlim_cur > 256) {
- fdno_rlim.rlim_cur = fdno_rlim.rlim_max = 256;
- (void) rctl_rlimit_set(rctlproc_legacy[RLIMIT_NOFILE],
- curproc, &fdno_rlim, gp,
- rctlproc_flags[RLIMIT_NOFILE],
- rctlproc_signals[RLIMIT_NOFILE], CRED());
- } else if (fdno_rlim.rlim_max > 256) {
- fdno_rlim.rlim_max = 256;
- (void) rctl_rlimit_set(rctlproc_legacy[RLIMIT_NOFILE],
- curproc, &fdno_rlim, gp,
- rctlproc_flags[RLIMIT_NOFILE],
- rctlproc_signals[RLIMIT_NOFILE], CRED());
- }
- mutex_exit(&curproc->p_lock);
-
- rctl_prealloc_destroy(gp);
- }
-
- return (error);
-}
-
-/*
- * Read in and validate the file header.
- */
-static int
-get_aout_head(struct vnode **vpp, struct exdata *edp, long *execsz, int *isdyn)
-{
- struct vnode *vp = *vpp;
- struct exec filhdr;
- int error;
- ssize_t resid;
- rlim64_t limit;
- rlim64_t roundlimit;
-
- if (error = vn_rdwr(UIO_READ, vp, (caddr_t)&filhdr,
- (ssize_t)sizeof (filhdr), (offset_t)0, UIO_SYSSPACE, 0,
- (rlim64_t)0, CRED(), &resid))
- return (error);
-
- if (resid != 0)
- return (ENOEXEC);
-
- switch (filhdr.a_magic) {
- case OMAGIC:
- filhdr.a_data += filhdr.a_text;
- filhdr.a_text = 0;
- break;
- case ZMAGIC:
- case NMAGIC:
- break;
- default:
- return (ENOEXEC);
- }
-
- /*
- * Check total memory requirements (in pages) for a new process
- * against the available memory or upper limit of memory allowed.
- *
- * For the 64-bit kernel, the limit can be set large enough so that
- * rounding it up to a page can overflow, so we check for btopr()
- * overflowing here by comparing it with the unrounded limit in pages.
- */
- *execsz += btopr(filhdr.a_text + filhdr.a_data);
- limit = btop(curproc->p_vmem_ctl);
- roundlimit = btopr(curproc->p_vmem_ctl);
- if ((roundlimit > limit && *execsz > roundlimit) ||
- (roundlimit < limit && *execsz > limit)) {
- mutex_enter(&curproc->p_lock);
- (void) rctl_action(rctlproc_legacy[RLIMIT_VMEM],
- curproc->p_rctls, curproc, RCA_SAFE);
- mutex_exit(&curproc->p_lock);
- return (ENOMEM);
- }
-
- edp->ux_mach = filhdr.a_machtype;
- edp->ux_tsize = filhdr.a_text;
- edp->ux_dsize = filhdr.a_data;
- edp->ux_bsize = filhdr.a_bss;
- edp->ux_mag = filhdr.a_magic;
- edp->ux_toffset = gettfile(&filhdr);
- edp->ux_doffset = getdfile(&filhdr);
- edp->ux_txtorg = gettmem(&filhdr);
- edp->ux_datorg = getdmem(&filhdr);
- edp->ux_entloc = (caddr_t)(uintptr_t)filhdr.a_entry;
- edp->vp = vp;
- *isdyn = filhdr.a_dynamic;
-
- return (0);
-}
-
-static int
-aoutcore(vnode_t *vp, proc_t *pp, struct cred *credp, rlim64_t rlimit, int sig,
- core_content_t content)
-{
- return (elf32core(vp, pp, credp, rlimit, sig, content));
-}
diff --git a/usr/src/uts/common/os/mmapobj.c b/usr/src/uts/common/os/mmapobj.c
index 779cd340f4..d85df39a62 100644
--- a/usr/src/uts/common/os/mmapobj.c
+++ b/usr/src/uts/common/os/mmapobj.c
@@ -22,6 +22,7 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2014 Joyent, Inc. All rights reserved.
+ * Copyright 2022 Garrett D'Amore <garrett@damore.org>
*/
#include <sys/types.h>
@@ -179,19 +180,6 @@ struct mobj_stats {
uint_t mobjs_lib_va_add_delete;
uint_t mobjs_lib_va_create_failure;
uint_t mobjs_min_align;
-#if defined(__sparc)
- uint_t mobjs_aout_uzero_fault;
- uint_t mobjs_aout_64bit_try;
- uint_t mobjs_aout_noexec;
- uint_t mobjs_aout_e2big;
- uint_t mobjs_aout_lib;
- uint_t mobjs_aout_fixed;
- uint_t mobjs_aout_zfoddiff;
- uint_t mobjs_aout_map_bss;
- uint_t mobjs_aout_bss_fail;
- uint_t mobjs_aout_nlist;
- uint_t mobjs_aout_addr_in_use;
-#endif
} mobj_stats;
#define MOBJ_STAT_ADD(stat) ((mobj_stats.mobjs_##stat)++)
@@ -2054,244 +2042,6 @@ doelfwork(Ehdr *ehdrp, vnode_t *vp, mmapobj_result_t *mrp,
return (error);
}
-#if defined(__sparc)
-/*
- * Hack to support 64 bit kernels running AOUT 4.x programs.
- * This is the sizeof (struct nlist) for a 32 bit kernel.
- * Since AOUT programs are 32 bit only, they will never use the 64 bit
- * sizeof (struct nlist) and thus creating a #define is the simplest
- * way around this since this is a format which is not being updated.
- * This will be used in the place of sizeof (struct nlist) below.
- */
-#define NLIST_SIZE (0xC)
-
-static int
-doaoutwork(vnode_t *vp, mmapobj_result_t *mrp,
- uint_t *num_mapped, struct exec *hdr, cred_t *fcred)
-{
- int error;
- size_t size;
- size_t osize;
- size_t nsize; /* nlist size */
- size_t msize;
- size_t zfoddiff;
- caddr_t addr;
- caddr_t start_addr;
- struct as *as = curproc->p_as;
- int prot = PROT_USER | PROT_READ | PROT_EXEC;
- uint_t mflag = MAP_PRIVATE | _MAP_LOW32;
- offset_t off = 0;
- int segnum = 0;
- uint_t to_map;
- int is_library = 0;
- struct segvn_crargs crargs = SEGVN_ZFOD_ARGS(PROT_ZFOD, PROT_ALL);
-
- /* Only 32bit apps supported by this file format */
- if (get_udatamodel() != DATAMODEL_ILP32) {
- MOBJ_STAT_ADD(aout_64bit_try);
- return (ENOTSUP);
- }
-
- /* Check to see if this is a library */
- if (hdr->a_magic == ZMAGIC && hdr->a_entry < PAGESIZE) {
- is_library = 1;
- }
-
- /*
- * Can't execute code from "noexec" mounted filesystem. Unlike ELF,
- * aout libraries are always mapped with something PROT_EXEC, so this
- * doesn't need to be checked for specific parts
- */
- if ((vp->v_vfsp->vfs_flag & VFS_NOEXEC) != 0) {
- MOBJ_STAT_ADD(aout_noexec);
- return (EACCES);
- }
-
- /*
- * There are 2 ways to calculate the mapped size of executable:
- * 1) rounded text size + data size + bss size.
- * 2) starting offset for text + text size + data size + text relocation
- * size + data relocation size + room for nlist data structure.
- *
- * The larger of the two sizes will be used to map this binary.
- */
- osize = P2ROUNDUP(hdr->a_text, PAGESIZE) + hdr->a_data + hdr->a_bss;
-
- off = hdr->a_magic == ZMAGIC ? 0 : sizeof (struct exec);
-
- nsize = off + hdr->a_text + hdr->a_data + hdr->a_trsize +
- hdr->a_drsize + NLIST_SIZE;
-
- size = MAX(osize, nsize);
- if (size != nsize) {
- nsize = 0;
- }
-
- /*
- * 1 seg for text and 1 seg for initialized data.
- * 1 seg for bss (if can't fit in leftover space of init data)
- * 1 seg for nlist if needed.
- */
- to_map = 2 + (nsize ? 1 : 0) +
- (hdr->a_bss > PAGESIZE - P2PHASE(hdr->a_data, PAGESIZE) ? 1 : 0);
- if (*num_mapped < to_map) {
- *num_mapped = to_map;
- MOBJ_STAT_ADD(aout_e2big);
- return (E2BIG);
- }
-
- /* Reserve address space for the whole mapping */
- if (is_library) {
- /* We'll let VOP_MAP below pick our address for us */
- addr = NULL;
- MOBJ_STAT_ADD(aout_lib);
- } else {
- /*
- * default start address for fixed binaries from AOUT 4.x
- * standard.
- */
- MOBJ_STAT_ADD(aout_fixed);
- mflag |= MAP_FIXED;
- addr = (caddr_t)0x2000;
- as_rangelock(as);
- if (as_gap(as, size, &addr, &size, 0, NULL) != 0) {
- as_rangeunlock(as);
- MOBJ_STAT_ADD(aout_addr_in_use);
- return (EADDRINUSE);
- }
- crargs.flags |= MAP_NORESERVE;
- error = as_map(as, addr, size, segvn_create, &crargs);
- ASSERT(addr == (caddr_t)0x2000);
- as_rangeunlock(as);
- }
-
- start_addr = addr;
- osize = size;
-
- /*
- * Map as large as we need, backed by file, this will be text, and
- * possibly the nlist segment. We map over this mapping for bss and
- * initialized data segments.
- */
- error = VOP_MAP(vp, off, as, &addr, size, prot, PROT_ALL,
- mflag, fcred, NULL);
- if (error) {
- if (!is_library) {
- (void) as_unmap(as, start_addr, osize);
- }
- return (error);
- }
-
- /* pickup the value of start_addr and osize for libraries */
- start_addr = addr;
- osize = size;
-
- /*
- * We have our initial reservation/allocation so we need to use fixed
- * addresses from now on.
- */
- mflag |= MAP_FIXED;
-
- mrp[0].mr_addr = addr;
- mrp[0].mr_msize = hdr->a_text;
- mrp[0].mr_fsize = hdr->a_text;
- mrp[0].mr_offset = 0;
- mrp[0].mr_prot = PROT_READ | PROT_EXEC;
- mrp[0].mr_flags = MR_HDR_AOUT;
-
-
- /*
- * Map initialized data. We are mapping over a portion of the
- * previous mapping which will be unmapped in VOP_MAP below.
- */
- off = P2ROUNDUP((offset_t)(hdr->a_text), PAGESIZE);
- msize = off;
- addr += off;
- size = hdr->a_data;
- error = VOP_MAP(vp, off, as, &addr, size, PROT_ALL, PROT_ALL,
- mflag, fcred, NULL);
- if (error) {
- (void) as_unmap(as, start_addr, osize);
- return (error);
- }
- msize += size;
- mrp[1].mr_addr = addr;
- mrp[1].mr_msize = size;
- mrp[1].mr_fsize = size;
- mrp[1].mr_offset = 0;
- mrp[1].mr_prot = PROT_READ | PROT_WRITE | PROT_EXEC;
- mrp[1].mr_flags = 0;
-
- /* Need to zero out remainder of page */
- addr += hdr->a_data;
- zfoddiff = P2PHASE((size_t)addr, PAGESIZE);
- if (zfoddiff) {
- label_t ljb;
-
- MOBJ_STAT_ADD(aout_zfoddiff);
- zfoddiff = PAGESIZE - zfoddiff;
- if (on_fault(&ljb)) {
- no_fault();
- MOBJ_STAT_ADD(aout_uzero_fault);
- (void) as_unmap(as, start_addr, osize);
- return (EFAULT);
- }
- uzero(addr, zfoddiff);
- no_fault();
- }
- msize += zfoddiff;
- segnum = 2;
-
- /* Map bss */
- if (hdr->a_bss > zfoddiff) {
- struct segvn_crargs crargs =
- SEGVN_ZFOD_ARGS(PROT_ZFOD, PROT_ALL);
- MOBJ_STAT_ADD(aout_map_bss);
- addr += zfoddiff;
- size = hdr->a_bss - zfoddiff;
- as_rangelock(as);
- (void) as_unmap(as, addr, size);
- error = as_map(as, addr, size, segvn_create, &crargs);
- as_rangeunlock(as);
- msize += size;
-
- if (error) {
- MOBJ_STAT_ADD(aout_bss_fail);
- (void) as_unmap(as, start_addr, osize);
- return (error);
- }
- mrp[2].mr_addr = addr;
- mrp[2].mr_msize = size;
- mrp[2].mr_fsize = 0;
- mrp[2].mr_offset = 0;
- mrp[2].mr_prot = PROT_READ | PROT_WRITE | PROT_EXEC;
- mrp[2].mr_flags = 0;
-
- addr += size;
- segnum = 3;
- }
-
- /*
- * If we have extra bits left over, we need to include that in how
- * much we mapped to make sure the nlist logic is correct
- */
- msize = P2ROUNDUP(msize, PAGESIZE);
-
- if (nsize && msize < nsize) {
- MOBJ_STAT_ADD(aout_nlist);
- mrp[segnum].mr_addr = addr;
- mrp[segnum].mr_msize = nsize - msize;
- mrp[segnum].mr_fsize = 0;
- mrp[segnum].mr_offset = 0;
- mrp[segnum].mr_prot = PROT_READ | PROT_EXEC;
- mrp[segnum].mr_flags = 0;
- }
-
- *num_mapped = to_map;
- return (0);
-}
-#endif
-
/*
* These are the two types of files that we can interpret and we want to read
* in enough info to cover both types when looking at the initial header.
@@ -2412,17 +2162,6 @@ mmapobj_map_interpret(vnode_t *vp, mmapobj_result_t *mrp,
padding, fcred));
}
-#if defined(__sparc)
- /* On sparc, check for 4.X AOUT format */
- switch (((struct exec *)header)->a_magic) {
- case OMAGIC:
- case ZMAGIC:
- case NMAGIC:
- return (doaoutwork(vp, mrp, num_mapped,
- (struct exec *)lheader, fcred));
- }
-#endif
-
/* Unsupported type */
MOBJ_STAT_ADD(unsupported);
return (ENOTSUP);
diff --git a/usr/src/uts/common/sys/exec.h b/usr/src/uts/common/sys/exec.h
index 8056f9a8e8..7849e75370 100644
--- a/usr/src/uts/common/sys/exec.h
+++ b/usr/src/uts/common/sys/exec.h
@@ -21,6 +21,7 @@
/*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2022 Garrett D'Amore <garrett@damore.org>
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -190,22 +191,12 @@ extern kmutex_t execsw_lock;
extern short elfmagic;
extern short intpmagic;
extern short javamagic;
-#if defined(__sparc)
-extern short aout_zmagic;
-extern short aout_nmagic;
-extern short aout_omagic;
-#endif
extern short nomagic;
extern char elf32magicstr[];
extern char elf64magicstr[];
extern char intpmagicstr[];
extern char javamagicstr[];
-#if defined(__sparc)
-extern char aout_nmagicstr[];
-extern char aout_zmagicstr[];
-extern char aout_omagicstr[];
-#endif
extern char nomagicstr[];
extern int exec_args(execa_t *, uarg_t *, intpdata_t *, void **);
@@ -260,18 +251,6 @@ extern int core_seg(proc_t *, vnode_t *, offset_t, caddr_t,
extern int core_write(vnode_t *, enum uio_seg, offset_t,
const void *, size_t, rlim64_t, cred_t *);
-/* a.out stuff */
-
-struct exec;
-
-extern caddr_t gettmem(struct exec *exp);
-extern caddr_t getdmem(struct exec *exp);
-extern ulong_t getdfile(struct exec *exp);
-extern uint_t gettfile(struct exec *exp);
-extern int chkaout(struct exdata *exp);
-extern void getexinfo(struct exdata *edp_in, struct exdata *edp_out,
- int *pagetext, int *pagedata);
-
#endif /* _KERNEL */
#ifdef __cplusplus
diff --git a/usr/src/uts/sparc/Makefile.sparc b/usr/src/uts/sparc/Makefile.sparc
index a031e1606c..8c8ca81e30 100644
--- a/usr/src/uts/sparc/Makefile.sparc
+++ b/usr/src/uts/sparc/Makefile.sparc
@@ -350,7 +350,7 @@ DRV_KMODS += pcic
#
# Exec Class Modules (/kernel/exec):
#
-EXEC_KMODS += aoutexec elfexec intpexec shbinexec javaexec
+EXEC_KMODS += elfexec intpexec shbinexec javaexec
#
# Scheduling Class Modules (/kernel/sched):
diff --git a/usr/src/uts/sparc/aoutexec/Makefile b/usr/src/uts/sparc/aoutexec/Makefile
deleted file mode 100644
index 225726fc7c..0000000000
--- a/usr/src/uts/sparc/aoutexec/Makefile
+++ /dev/null
@@ -1,88 +0,0 @@
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License"). You may not use this file except in compliance
-# with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-# uts/sparc/aoutexec/Makefile
-# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-# Copyright (c) 2011 Bayard G. Bell. All rights reserved.
-#
-# This makefile drives the production of the aoutexec exec kernel
-# module (binary compatibility).
-#
-# sparc architecture dependent
-#
-
-#
-# Path to the base of the uts directory tree (usually /usr/src/uts).
-#
-UTSBASE = ../..
-
-#
-# Define the module and object file sets.
-#
-MODULE = aoutexec
-OBJECTS = $(AOUTEXEC_OBJS:%=$(OBJS_DIR)/%)
-ROOTMODULE = $(ROOT_EXEC_DIR)/$(MODULE)
-
-#
-# Include common rules.
-#
-include $(UTSBASE)/sparc/Makefile.sparc
-
-#
-# Define targets
-#
-ALL_TARGET = $(BINARY)
-INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
-
-#
-# For now, disable these warnings; maintainers should endeavor
-# to investigate and remove these for maximum coverage.
-# Please do not carry these forward to new Makefiles.
-#
-CFLAGS += $(CCVERBOSE)
-CERRWARN += -_gcc=-Wno-parentheses
-
-#
-# Define dependency on elfexec
-#
-LDFLAGS += -N exec/elfexec
-
-#
-# Default build targets.
-#
-.KEEP_STATE:
-
-def: $(DEF_DEPS)
-
-all: $(ALL_DEPS)
-
-clean: $(CLEAN_DEPS)
-
-clobber: $(CLOBBER_DEPS)
-
-install: $(INSTALL_DEPS)
-
-#
-# Include common targets.
-#
-include $(UTSBASE)/sparc/Makefile.targ
diff --git a/usr/src/uts/sun4/vm/vm_dep.c b/usr/src/uts/sun4/vm/vm_dep.c
index 835d321c1d..1243162085 100644
--- a/usr/src/uts/sun4/vm/vm_dep.c
+++ b/usr/src/uts/sun4/vm/vm_dep.c
@@ -22,6 +22,7 @@
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2016 Joyent, Inc.
+ * Copyright 2022 Garrett D'Amore <garrett@damore.org>
*/
/*
@@ -426,82 +427,6 @@ chkaout(struct exdata *exp)
return (ENOEXEC);
}
-/*
- * The following functions return information about an a.out
- * which is used when a program is executed.
- */
-
-/*
- * Return the load memory address for the data segment.
- */
-caddr_t
-getdmem(struct exec *exp)
-{
- /*
- * XXX - Sparc Reference Hack approaching
- * Remember that we are loading
- * 8k executables into a 4k machine
- * DATA_ALIGN == 2 * PAGESIZE
- */
- if (exp->a_text)
- return ((caddr_t)(roundup(USRTEXT + exp->a_text, DATA_ALIGN)));
- else
- return ((caddr_t)USRTEXT);
-}
-
-/*
- * Return the starting disk address for the data segment.
- */
-ulong_t
-getdfile(struct exec *exp)
-{
- if (exp->a_magic == ZMAGIC)
- return (exp->a_text);
- else
- return (sizeof (struct exec) + exp->a_text);
-}
-
-/*
- * Return the load memory address for the text segment.
- */
-
-/*ARGSUSED*/
-caddr_t
-gettmem(struct exec *exp)
-{
- return ((caddr_t)USRTEXT);
-}
-
-/*
- * Return the file byte offset for the text segment.
- */
-uint_t
-gettfile(struct exec *exp)
-{
- if (exp->a_magic == ZMAGIC)
- return (0);
- else
- return (sizeof (struct exec));
-}
-
-void
-getexinfo(
- struct exdata *edp_in,
- struct exdata *edp_out,
- int *pagetext,
- int *pagedata)
-{
- *edp_out = *edp_in; /* structure copy */
-
- if ((edp_in->ux_mag == ZMAGIC) &&
- ((edp_in->vp->v_flag & VNOMAP) == 0)) {
- *pagetext = 1;
- *pagedata = 1;
- } else {
- *pagetext = 0;
- *pagedata = 0;
- }
-}
/*
* Return non 0 value if the address may cause a VAC alias with KPM mappings.
@@ -747,7 +672,7 @@ map_pgszcvec(caddr_t addr, size_t size, uintptr_t off, int flags, int type,
*
* page_counters[page_size][region_size]
*
- * page_size: TTE size code of pages on page_size freelist.
+ * page_size: TTE size code of pages on page_size freelist.
*
* region_size: TTE size code of a candidate larger page made up
* made up of contiguous free page_size pages.
@@ -757,7 +682,7 @@ map_pgszcvec(caddr_t addr, size_t size, uintptr_t off, int flags, int type,
* made up of page_size free pages can be coalesced into a
* regsion_size page. Yuck! Lets try an example:
*
- * page_counters[1][3] is the table element used for identifying
+ * page_counters[1][3] is the table element used for identifying
* candidate 4M pages from contiguous pages off the 64K free list.
* Each index in the page_counters[1][3].array spans 4M. Its the
* number of free 512K size (regsion_size - 1) groups of contiguous