Subject: Re: Booting from disk not working
To: None <port-sgimips@netbsd.org>
From: Michael L. Hitch <mhitch@lightning.msu.montana.edu>
List: port-sgimips
Date: 10/27/2001 09:58:11
On Sat, 27 Oct 2001, Hendrik Scholz wrote:

> What could I do here ? Does compiling gdb support into the kernel
> help at that point to track down the problem ?

  Try commenting out the line

                esym += ((Elf_Ehdr *)end)->e_entry;

in machdep.c.  This is taking the kernel address of 'end' and adding to it
the kernel address of the kernel entry address.  The result will probably
overflow into a user address for esym (and kernend).  That will cause big
problems as soon as the kernel tries to access anything using that
address.

  [If you want to use the kernel symbols in ddb, you can add a fourth
argument to mach_init() and use it to set the value of esym.  The boot
loader currently passes the address of the symbol table as the fourth
parameter.]

--- machdep.c.orig	Sun Sep 23 21:56:03 2001
+++ machdep.c	Mon Oct  8 21:37:48 2001
@@ -135,7 +135,7 @@
 
 void * cpu_intr_establish(int, int, int (*)(void *), void *);
 
-void	mach_init(int, char **, char **);
+void	mach_init(int, char **, char **, void *);
 void	unconfigured_system_type(int);
 
 void	sgimips_count_cpus(struct arcbios_component *,
@@ -179,10 +179,11 @@
  * Process arguments passed to us by the ARCS firmware.
  */
 void
-mach_init(argc, argv, envp)
+mach_init(argc, argv, envp, endsym)
 	int argc;
 	char **argv;
 	char **envp;
+	void *endsym;
 {
 	unsigned long first, last;
 	caddr_t kernend, v;
@@ -198,8 +200,12 @@
 #ifdef DDB 
 	if (memcmp(((Elf_Ehdr *)end)->e_ident, ELFMAG, SELFMAG) == 0 &&
 	    ((Elf_Ehdr *)end)->e_ident[EI_CLASS] == ELFCLASS) {
+#if 0	/* XXX doesn't work */
 		esym = end;
 		esym += ((Elf_Ehdr *)end)->e_entry;
+#else
+		esym = endsym;
+#endif
 		kernend = (caddr_t)mips_round_page(esym);
 		memset(edata, 0, end - edata);
 	} else

--
Michael L. Hitch			mhitch@montana.edu
Computer Consultant
Information Technology Center
Montana State University	Bozeman, MT	USA