Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Nov 2006 03:17:26 GMT
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 109902 for review
Message-ID:  <200611140317.kAE3HQ5O003550@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=109902

Change 109902 by marcel@marcel_cluster on 2006/11/14 03:16:25

	More formally define Loader Virtual Memory (LVM).

Affected files ...

.. //depot/projects/ia64/sys/boot/ia64/common/copy.c#4 edit
.. //depot/projects/ia64/sys/ia64/include/bootinfo.h#12 edit
.. //depot/projects/ia64/sys/ia64/include/vmparam.h#16 edit

Differences ...

==== //depot/projects/ia64/sys/boot/ia64/common/copy.c#4 (text+ko) ====

@@ -32,8 +32,6 @@
 
 #include "libia64.h"
 
-#define	LDR_LOG2_PGSZ	20
-
 uint64_t *ia64_pgtbl;
 uint32_t ia64_pgtblsz;
 
@@ -52,26 +50,27 @@
 	printf("\n%s: va=%lx, *len=%lx: pa=", __func__, va, *len);
 
 	/* We can not copy more than a page at a time. */
-	if (*len > (1UL << LDR_LOG2_PGSZ))
-		*len = 1UL << LDR_LOG2_PGSZ;
+	if (*len > IA64_LVM_PAGE_SIZE)
+		*len = IA64_LVM_PAGE_SIZE;
 
-	if (va < IA64_KERNELBASE) {
+	if (va < IA64_LVM_BASE) {
 		printf("\n%s: %lx: invalid loader virtual address\n",
 		    __func__, va);
 		*len = 0;
 		return (NULL);
 	}
 
-	va -= IA64_KERNELBASE;
-	idx = va >> LDR_LOG2_PGSZ;
+	va -= IA64_LVM_BASE;
+	idx = va >> IA64_LVM_PAGE_SHIFT;
 	if (idx >= (ia64_pgtblsz >> 3)) {
+		/* XXX We can extend the loader page table. */
 		printf("\n%s: %lx: loader virtual address out of bounds\n",
 		    __func__, va);
 		*len = 0;
 		return (NULL);
 	}
 
-	ofs = va & ((1U << LDR_LOG2_PGSZ) - 1);
+	ofs = va & IA64_LVM_PAGE_MASK;
 	pa = ia64_pgtbl[idx];
 	if (pa == 0) {
 		pa = ldr_alloc(va - ofs);

==== //depot/projects/ia64/sys/ia64/include/bootinfo.h#12 (text+ko) ====

@@ -1,42 +1,37 @@
+/* $FreeBSD: src/sys/ia64/include/bootinfo.h,v 1.8 2005/01/06 22:18:23 imp Exp $ */
 /*-
- * Copyright (c) 2004,2005 Marcel Moolenaar
+ * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
  * All rights reserved.
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
+ * Author: Chris G. Demetriou
+ * 
+ * Permission to use, copy, modify and distribute this software and
+ * its documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ * 
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 
+ * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 
+ * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ * 
+ * Carnegie Mellon requests users of this software to return to
  *
- * 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.
+ *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+ *  School of Computer Science
+ *  Carnegie Mellon University
+ *  Pittsburgh PA 15213-3890
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
- *
- * $FreeBSD$
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
  */
 
-#ifndef _MACHINE_BOOTINFO_H_
-#define	_MACHINE_BOOTINFO_H_
-
-#ifndef BOOTINFO_TAGVAL_PAIRS
-
 struct bootinfo {
 	uint64_t	bi_magic;		/* BOOTINFO_MAGIC */
 #define	BOOTINFO_MAGIC		0xdeadbeeffeedface
 	uint64_t	bi_version;		/* version 1 */
 	uint64_t	bi_spare[5];		/* was: name of kernel */
-	uint64_t	bi_pgtbl;		/* PA of loader page table */
+	uint64_t	bi_pgtbl;		/* Loader page table PA.*/
 	uint64_t	bi_hcdp;		/* DIG64 HCDP table */
 	uint64_t	bi_fpswa;		/* FPSWA interface */
 	uint64_t	bi_boothowto;		/* value for boothowto */
@@ -45,7 +40,7 @@
 	uint64_t	bi_memmap_size;		/* size of EFI memory map */
 	uint64_t	bi_memdesc_size;	/* sizeof EFI memory desc */
 	uint32_t	bi_memdesc_version;	/* EFI memory desc version */
-	uint32_t	bi_pgtblsz;		/* size of loader page table */
+	uint32_t	bi_pgtblsz;		/* Loader page table size. */
 	uint64_t	bi_symtab;		/* start of kernel sym table */
 	uint64_t	bi_esymtab;		/* end of kernel sym table */
 	uint64_t	bi_kernend;		/* end of kernel space */
@@ -54,45 +49,3 @@
 };
 
 extern struct bootinfo bootinfo;
-
-#else
-
-/*
- * (tag,val) array based hand-off.
- */
-
-struct bi_tagval {
-	uint64_t	tag;
-	uint64_t	val;
-};
-
-/* Non-optional tags. */
-#define	BI_TAG_BI_MAGIC		0x62695f6d61676963ul	/* bi_magic */
-#define		BI_VAL_BI_MAGIC		0x3d46726565425344ul
-#define	BI_TAG_BI_REDIR		0x62695f7265646972ul	/* bi_redir */
-
-/* Tags for MI (meta) data. */
-#define	BI_TAG_BOOTHOW		0x626f6f74686f7700ul	/* boothow */
-#define	BI_TAG_ENVIRON		0x656e7669726f6e00ul	/* environ */
-#define	BI_TAG_KERNEND		0x1
-#define	BI_TAG_PRELOAD		0x7072656c6f616400ul	/* preload */
-#define	BI_TAG_SSYMTAB		0x7373796d74616200ul	/* ssymtab */
-#define	BI_TAG_ESYMTAB		0x6573796d74616200ul	/* esymtab */
-
-/* Tags for MD (meta) data. */
-#define	BI_TAG_FPSWA		0x2
-#define	BI_TAG_HCDP		0x3
-#define	BI_TAG_MM_ADDR		0x6d6d5f6164647200ul	/* mm_addr */
-#define	BI_TAG_MM_SIZE		0x6d6d5f73697a6500ul	/* mm_size */
-#define	BI_TAG_MMD_SIZE		0x6d6d645f73697a65ul	/* mmd_size */
-#define	BI_TAG_MMD_VERS		0x6d6d645f76657273ul	/* mmd_vers */
-#define	BI_TAG_SYSTABLE		0x4
-
-#define	BI_TAG_PGTBL		0x10
-#define	BI_TAG_PGTBLSZ		0x11
-
-uint64_t ia64_bi_lookup(uint64_t);
-
-#endif
-
-#endif	/* _MACHINE_BOOTINFO_H_ */

==== //depot/projects/ia64/sys/ia64/include/vmparam.h#16 (text+ko) ====

@@ -133,7 +133,16 @@
 #define	IA64_ID_PAGE_MASK	(IA64_ID_PAGE_SIZE-1)
 
 #define	IA64_BACKINGSTORE	IA64_RR_BASE(4)
-#define	IA64_KERNELBASE		0xbffc000000000000
+
+/*
+ * Parameters for loader virtual memory (LVM). The kernel, its modules and
+ * metadata are loaded in the LVM by the loader. The kernel is given the PA
+ * and size of the page table that provides the mapping of the LVM.
+ */
+#define	IA64_LVM_BASE		0xbffc000000000000
+#define	IA64_LVM_PAGE_SHIFT	20		/* 1MB */
+#define	IA64_LVM_PAGE_SIZE	(1U<<IA64_LVM_PAGE_SHIFT)
+#define	IA64_LVM_PAGE_MASK	(IA64_LVM_PAGE_SIZE - 1)
 
 /*
  * Mach derived constants



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