Deleted Added
full compact
kern_linker.c (50068) kern_linker.c (50272)
1/*-
2 * Copyright (c) 1997 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1997 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $Id: kern_linker.c,v 1.34 1999/07/01 13:21:39 peter Exp $
26 * $Id: kern_linker.c,v 1.35 1999/08/20 00:18:07 grog Exp $
27 */
28
29#include "opt_ddb.h"
30
31#include <sys/param.h>
32#include <sys/kernel.h>
33#include <sys/systm.h>
34#include <sys/malloc.h>

--- 552 unchanged lines hidden (view full) ---

587 }
588 return ENOENT;
589}
590
591int
592linker_ddb_search_symbol(caddr_t value, c_linker_sym_t *sym, long *diffp)
593{
594 linker_file_t lf;
27 */
28
29#include "opt_ddb.h"
30
31#include <sys/param.h>
32#include <sys/kernel.h>
33#include <sys/systm.h>
34#include <sys/malloc.h>

--- 552 unchanged lines hidden (view full) ---

587 }
588 return ENOENT;
589}
590
591int
592linker_ddb_search_symbol(caddr_t value, c_linker_sym_t *sym, long *diffp)
593{
594 linker_file_t lf;
595 u_long off = (u_long)value;
595 u_long off = (uintptr_t)value;
596 u_long diff, bestdiff;
597 c_linker_sym_t best;
598 c_linker_sym_t es;
599
600 best = 0;
601 bestdiff = off;
602 for (lf = TAILQ_FIRST(&linker_files); lf; lf = TAILQ_NEXT(lf, link)) {
603 if (lf->ops->search_symbol(lf, value, &es, &diff) != 0)

--- 251 unchanged lines hidden (view full) ---

855 if (SCARG(uap, fileid) != 0) {
856 lf = linker_find_file_by_id(SCARG(uap, fileid));
857 if (lf == NULL) {
858 error = ENOENT;
859 goto out;
860 }
861 if (lf->ops->lookup_symbol(lf, symstr, &sym) == 0 &&
862 lf->ops->symbol_values(lf, sym, &symval) == 0) {
596 u_long diff, bestdiff;
597 c_linker_sym_t best;
598 c_linker_sym_t es;
599
600 best = 0;
601 bestdiff = off;
602 for (lf = TAILQ_FIRST(&linker_files); lf; lf = TAILQ_NEXT(lf, link)) {
603 if (lf->ops->search_symbol(lf, value, &es, &diff) != 0)

--- 251 unchanged lines hidden (view full) ---

855 if (SCARG(uap, fileid) != 0) {
856 lf = linker_find_file_by_id(SCARG(uap, fileid));
857 if (lf == NULL) {
858 error = ENOENT;
859 goto out;
860 }
861 if (lf->ops->lookup_symbol(lf, symstr, &sym) == 0 &&
862 lf->ops->symbol_values(lf, sym, &symval) == 0) {
863 lookup.symvalue = (u_long)symval.value;
863 lookup.symvalue = (uintptr_t)symval.value;
864 lookup.symsize = symval.size;
865 error = copyout(&lookup, SCARG(uap, data), sizeof(lookup));
866 } else
867 error = ENOENT;
868 } else {
869 for (lf = TAILQ_FIRST(&linker_files); lf; lf = TAILQ_NEXT(lf, link)) {
870 if (lf->ops->lookup_symbol(lf, symstr, &sym) == 0 &&
871 lf->ops->symbol_values(lf, sym, &symval) == 0) {
864 lookup.symsize = symval.size;
865 error = copyout(&lookup, SCARG(uap, data), sizeof(lookup));
866 } else
867 error = ENOENT;
868 } else {
869 for (lf = TAILQ_FIRST(&linker_files); lf; lf = TAILQ_NEXT(lf, link)) {
870 if (lf->ops->lookup_symbol(lf, symstr, &sym) == 0 &&
871 lf->ops->symbol_values(lf, sym, &symval) == 0) {
872 lookup.symvalue = (u_long)symval.value;
872 lookup.symvalue = (uintptr_t)symval.value;
873 lookup.symsize = symval.size;
874 error = copyout(&lookup, SCARG(uap, data), sizeof(lookup));
875 break;
876 }
877 }
878 if (!lf)
879 error = ENOENT;
880 }

--- 85 unchanged lines hidden (view full) ---

966 *
967 * If the module name is qualified in any way (contains path, etc.)
968 * the we simply return a copy of it.
969 *
970 * The search path can be manipulated via sysctl. Note that we use the ';'
971 * character as a separator to be consistent with the bootloader.
972 */
973
873 lookup.symsize = symval.size;
874 error = copyout(&lookup, SCARG(uap, data), sizeof(lookup));
875 break;
876 }
877 }
878 if (!lf)
879 error = ENOENT;
880 }

--- 85 unchanged lines hidden (view full) ---

966 *
967 * If the module name is qualified in any way (contains path, etc.)
968 * the we simply return a copy of it.
969 *
970 * The search path can be manipulated via sysctl. Note that we use the ';'
971 * character as a separator to be consistent with the bootloader.
972 */
973
974static char linker_path[MAXPATHLEN + 1] = "/;/boot/;/modules/";
974static char linker_path[MAXPATHLEN] = "/;/boot/;/modules/";
975
976SYSCTL_STRING(_kern, OID_AUTO, module_path, CTLFLAG_RW, linker_path,
977 sizeof(linker_path), "module load search path");
978
979static char *
980linker_strdup(const char *str)
981{
982 char *result;

--- 54 unchanged lines hidden ---
975
976SYSCTL_STRING(_kern, OID_AUTO, module_path, CTLFLAG_RW, linker_path,
977 sizeof(linker_path), "module load search path");
978
979static char *
980linker_strdup(const char *str)
981{
982 char *result;

--- 54 unchanged lines hidden ---