Sun May 24 15:00:24 2009 UTC ()
Split out kobj structures so crash/ddb can get at them.


(ad)
diff -r1.35 -r1.36 src/sys/kern/subr_kobj.c
diff -r0 -r1.1 src/sys/sys/kobj_impl.h

cvs diff -r1.35 -r1.36 src/sys/kern/subr_kobj.c (expand / switch to context diff)
--- src/sys/kern/subr_kobj.c 2009/05/23 15:13:57 1.35
+++ src/sys/kern/subr_kobj.c 2009/05/24 15:00:24 1.36
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kobj.c,v 1.35 2009/05/23 15:13:57 ad Exp $	*/
+/*	$NetBSD: subr_kobj.c,v 1.36 2009/05/24 15:00:24 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,16 +63,12 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.35 2009/05/23 15:13:57 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.36 2009/05/24 15:00:24 ad Exp $");
 
 #include "opt_modular.h"
 
-#define	ELFSIZE		ARCH_ELFSIZE
+#include <sys/kobj_impl.h>
 
-#include <sys/systm.h>
-#include <sys/kobj.h>
-#include <sys/errno.h>
-
 #ifdef MODULAR
 
 #include <sys/param.h>
@@ -84,65 +80,10 @@
 #include <sys/fcntl.h>
 #include <sys/ksyms.h>
 #include <sys/module.h>
-#include <sys/exec.h>
-#include <sys/exec_elf.h>
 
 #include <machine/stdarg.h>
 
 #include <uvm/uvm_extern.h>
-
-typedef struct {
-	void		*addr;
-	Elf_Off		size;
-	int		flags;
-	int		sec;		/* Original section */
-	const char	*name;
-} progent_t;
-
-typedef struct {
-	Elf_Rel		*rel;
-	int 		nrel;
-	int 		sec;
-	size_t		size;
-} relent_t;
-
-typedef struct {
-	Elf_Rela	*rela;
-	int		nrela;
-	int		sec;
-	size_t		size;
-} relaent_t;
-
-typedef enum kobjtype {
-	KT_UNSET,
-	KT_VNODE,
-	KT_MEMORY
-} kobjtype_t;
-
-struct kobj {
-	char		ko_name[MAXMODNAME];
-	kobjtype_t	ko_type;
-	void		*ko_source;
-	ssize_t		ko_memsize;
-	vaddr_t		ko_address;	/* Relocation address */
-	Elf_Shdr	*ko_shdr;
-	progent_t	*ko_progtab;
-	relaent_t	*ko_relatab;
-	relent_t	*ko_reltab;
-	Elf_Sym		*ko_symtab;	/* Symbol table */
-	char		*ko_strtab;	/* String table */
-	char		*ko_shstrtab;	/* Section name string table */
-	size_t		ko_size;	/* Size of text/data/bss */
-	size_t		ko_symcnt;	/* Number of symbols */
-	size_t		ko_strtabsz;	/* Number of bytes in string table */
-	size_t		ko_shstrtabsz;	/* Number of bytes in scn str table */
-	size_t		ko_shdrsz;
-	int		ko_nrel;
-	int		ko_nrela;
-	int		ko_nprogtab;
-	bool		ko_ksyms;
-	bool		ko_loaded;
-};
 
 static int	kobj_relocate(kobj_t, bool);
 static int	kobj_checksyms(kobj_t, bool);

File Added: src/sys/sys/kobj_impl.h
/*	$NetBSD: kobj_impl.h,v 1.1 2009/05/24 15:00:24 ad Exp $	*/

/*-
 * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software developed for The NetBSD Foundation
 * by Andrew Doran.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*-
 * Copyright (c) 1998-2000 Doug Rabson
 * Copyright (c) 2004 Peter Wemm
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

/*
 * Data structures private to kobj, shared only with kernel grovellers.
 */

#ifndef _SYS_KOBJ_IMPL_H_
#define	_SYS_KOBJ_IMPL_H_

#define	ELFSIZE		ARCH_ELFSIZE

#include <sys/systm.h>
#include <sys/kobj.h>
#include <sys/exec.h>
#include <sys/exec_elf.h>
#include <sys/module.h>

typedef struct {
	void		*addr;
	Elf_Off		size;
	int		flags;
	int		sec;		/* Original section */
	const char	*name;
} progent_t;

typedef struct {
	Elf_Rel		*rel;
	int 		nrel;
	int 		sec;
	size_t		size;
} relent_t;

typedef struct {
	Elf_Rela	*rela;
	int		nrela;
	int		sec;
	size_t		size;
} relaent_t;

typedef enum kobjtype {
	KT_UNSET,
	KT_VNODE,
	KT_MEMORY
} kobjtype_t;

struct kobj {
	char		ko_name[MAXMODNAME];
	kobjtype_t	ko_type;
	void		*ko_source;
	ssize_t		ko_memsize;
	vaddr_t		ko_address;	/* Relocation address */
	Elf_Shdr	*ko_shdr;
	progent_t	*ko_progtab;
	relaent_t	*ko_relatab;
	relent_t	*ko_reltab;
	Elf_Sym		*ko_symtab;	/* Symbol table */
	char		*ko_strtab;	/* String table */
	char		*ko_shstrtab;	/* Section name string table */
	size_t		ko_size;	/* Size of text/data/bss */
	size_t		ko_symcnt;	/* Number of symbols */
	size_t		ko_strtabsz;	/* Number of bytes in string table */
	size_t		ko_shstrtabsz;	/* Number of bytes in scn str table */
	size_t		ko_shdrsz;
	int		ko_nrel;
	int		ko_nrela;
	int		ko_nprogtab;
	bool		ko_ksyms;
	bool		ko_loaded;
};

#endif	/* _SYS_KOBJ_IMPL_H_ */