Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Sep 2002 01:58:37 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 17844 for review
Message-ID:  <200209210858.g8L8wbqM000768@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=17844

Change 17844 by peter@peter_overcee on 2002/09/21 01:57:58

	adjust for new modulep args.  exterminate bootinfo.

Affected files ...

.. //depot/projects/hammer/sys/boot/i386/libi386/elf_freebsd.c#3 edit
.. //depot/projects/hammer/sys/x86_64/x86_64/locore.s#10 edit

Differences ...

==== //depot/projects/hammer/sys/boot/i386/libi386/elf_freebsd.c#3 (text+ko) ====

@@ -83,7 +83,7 @@
 #endif
 
     dev_cleanup();
-    __exec((void *)entry, boothowto, bootdev, modulep, 0, 0, bootinfop);
+    __exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop, modulep, bi->bi_kernend);
 
     panic("exec returned");
 }

==== //depot/projects/hammer/sys/x86_64/x86_64/locore.s#10 (text+ko) ====

@@ -107,8 +107,8 @@
 	.space	0x2000			/* space for tmpstk - temporary stack */
 HIDENAME(tmpstk):
 
-	.globl	bootinfo
-bootinfo:	.space	BOOTINFO_SIZE	/* bootinfo that we can handle */
+	.globl	modulep
+bootinfo:	.long	0		/* phys addr of module table */
 
 		.globl KERNend
 KERNend:	.long	0		/* phys addr end of kernel (just after bss) */
@@ -185,7 +185,10 @@
 /* Tell the bios to warmboot next time */
 	movw	$0x1234,0x472
 
-/* Set up a real frame in case the double return in newboot is executed. */
+/* Get onto a stack that we can trust. */
+	movl	$R(HIDENAME(tmpstk)),%esp
+
+/* Set up a real frame */
 	pushl	%ebp
 	movl	%esp, %ebp
 
@@ -203,14 +206,6 @@
 
 	call	recover_bootinfo
 
-/* Get onto a stack that we can trust. */
-/*
- * XXX this step is delayed in case recover_bootinfo needs to return via
- * the old stack, but it need not be, since recover_bootinfo actually
- * returns via the old frame.
- */
-	movl	$R(HIDENAME(tmpstk)),%esp
-
 	call	identify_cpu
 
 	call	create_pagetables
@@ -250,9 +245,13 @@
 	call	mi_startup		/* autoconfiguration, mountroot etc */
 	/* NOTREACHED */
 	addl	$0,%esp			/* for db_numargs() again */
+0:	hlt
+	jmp	0b
 
-/*
+/**********************************************************************
+ *
  * Signal trampoline, copied to top of user stack
+ *
  */
 NON_GPROF_ENTRY(sigcode)
 	call	*SIGF_HANDLER(%esp)	/* call signal handler */
@@ -262,7 +261,8 @@
 	movl	$SYS_sigreturn,%eax
 	pushl	%eax			/* junk to fake return addr. */
 	int	$0x80			/* enter kernel with args */
-0:	jmp	0b
+0:	hlt				/* priviliged instruction */
+	jmp	0b
 
 	ALIGN_TEXT
 esigcode:
@@ -280,26 +280,8 @@
  */
 recover_bootinfo:
 	/*
-	 * This code is called in different ways depending on what loaded
-	 * and started the kernel.  This is used to detect how we get the
-	 * arguments from the other code and what we do with them.
-	 *
-	 * Old disk boot blocks:
-	 *	(*btext)(howto, bootdev, cyloffset, esym);
-	 *	[return address == 0, and can NOT be returned to]
-	 *	[cyloffset was not supported by the FreeBSD boot code
-	 *	 and always passed in as 0]
-	 *	[esym is also known as total in the boot code, and
-	 *	 was never properly supported by the FreeBSD boot code]
-	 *
-	 * Old diskless netboot code:
-	 *	(*btext)(0,0,0,0,&nfsdiskless,0,0,0);
-	 *	[return address != 0, and can NOT be returned to]
-	 *	If we are being booted by this code it will NOT work,
-	 *	so we are just going to halt if we find this case.
-	 *
 	 * New uniform boot code:
-	 *	(*btext)(howto, bootdev, 0, 0, 0, &bootinfo)
+	 *	(*btext)(howto, bootdev, 0, 0, 0, &bootinfo, modulep, kernend)
 	 *	[return address != 0, and can be returned to]
 	 *
 	 * There may seem to be a lot of wasted arguments in here, but
@@ -307,65 +289,11 @@
 	 * and old boot code can load new kernels.
 	 */
 
-	/*
-	 * We have some form of return address, so this is either the
-	 * old diskless netboot code, or the new uniform code.  That can
-	 * be detected by looking at the 5th argument, if it is 0
-	 * we are being booted by the new uniform boot code.
-	 */
-	cmpl	$0,24(%ebp)
-	je	newboot
-
-	/*
-	 * Seems we have been loaded by the old diskless boot code, we
-	 * don't stand a chance of running as the diskless structure
-	 * changed considerably between the two, so just halt.
-	 */
-	 hlt
+	movl	32(%ebp),%eax		/* modulep */
+	movl	%eax,R(modulep)
+	movl	36(%ebp),%eax		/* kernend */
+	movl	%eax,R(kernend)
 
-	/*
-	 * We have been loaded by the new uniform boot code.
-	 * Let's check the bootinfo version, and if we do not understand
-	 * it we return to the loader with a status of 1 to indicate this error
-	 */
-newboot:
-	movl	28(%ebp),%ebx		/* &bootinfo.version */
-	movl	BI_VERSION(%ebx),%eax
-	cmpl	$1,%eax			/* We only understand version 1 */
-	je	1f
-	movl	$1,%eax			/* Return status */
-	leave
-	/*
-	 * XXX this returns to our caller's caller (as is required) since
-	 * we didn't set up a frame and our caller did.
-	 */
-	ret
-
-1:
-	/*
-	 * Determine the size of the boot loader's copy of the bootinfo
-	 * struct. 
-	 */
-	movl	BI_SIZE(%ebx),%ecx
-
-	/*
-	 * Copy the common part of the bootinfo struct
-	 */
-	movl	%ebx,%esi
-	movl	$R(bootinfo),%edi
-	cmpl	$BOOTINFO_SIZE,%ecx
-	jbe	got_common_bi_size
-	movl	$BOOTINFO_SIZE,%ecx
-got_common_bi_size:
-	cld
-	rep
-	movsb
-
-	movl	8(%ebp),%eax
-	movl	%eax,R(boothowto)
-	movl	12(%ebp),%eax
-	movl	%eax,R(bootdev)
-
 	ret
 
 
@@ -401,25 +329,8 @@
 
 create_pagetables:
 
-/* Find end of kernel image (rounded up to a page boundary). */
-	movl	$R(_end),%esi
-
-/* Include symbols, if any. */
-	movl	R(bootinfo+BI_ESYMTAB),%edi
-	testl	%edi,%edi
-	je	over_symalloc
-	movl	%edi,%esi
-	movl	$KERNBASE,%edi
-	addl	%edi,R(bootinfo+BI_SYMTAB)
-	addl	%edi,R(bootinfo+BI_ESYMTAB)
-over_symalloc:
-
-/* If we are told where the end of the kernel space is, believe it. */
-	movl	R(bootinfo+BI_KERNEND),%edi
-	testl	%edi,%edi
-	je	no_kernend
-	movl	%edi,%esi
-no_kernend:
+/* We are told where the end of the kernel space is, believe it. */
+	movl	R(kernend),%esi
 	
 	addl	$PAGE_MASK,%esi
 	andl	$~PAGE_MASK,%esi

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209210858.g8L8wbqM000768>