Module Name:    src
Committed By:   phx
Date:           Mon Jan  4 14:10:15 UTC 2016

Modified Files:
        src/sys/arch/amiga/stand/bootblock/boot: amigatypes.h main.c

Log Message:
Make the -p option work, like with loadbsd.
Otherwise the kernel could load into a low-priority 512MB Z3 RAM segment.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amiga/stand/bootblock/boot/amigatypes.h
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amiga/stand/bootblock/boot/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amiga/stand/bootblock/boot/amigatypes.h
diff -u src/sys/arch/amiga/stand/bootblock/boot/amigatypes.h:1.7 src/sys/arch/amiga/stand/bootblock/boot/amigatypes.h:1.8
--- src/sys/arch/amiga/stand/bootblock/boot/amigatypes.h:1.7	Mon Apr 28 20:23:13 2008
+++ src/sys/arch/amiga/stand/bootblock/boot/amigatypes.h	Mon Jan  4 14:10:15 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: amigatypes.h,v 1.7 2008/04/28 20:23:13 martin Exp $ */
+/* $NetBSD: amigatypes.h,v 1.8 2016/01/04 14:10:15 phx Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@ struct Library {
 struct MemHead {
 	struct MemHead *next;
 	u_int8_t Dmy1[  9-  4];
-	u_int8_t Pri;
+	int8_t Pri;
 	u_int8_t Dmy2[ 14- 10];
 	u_int16_t Attribs;
 	u_int32_t First, Lower, Upper, Free;

Index: src/sys/arch/amiga/stand/bootblock/boot/main.c
diff -u src/sys/arch/amiga/stand/bootblock/boot/main.c:1.29 src/sys/arch/amiga/stand/bootblock/boot/main.c:1.30
--- src/sys/arch/amiga/stand/bootblock/boot/main.c:1.29	Sat Mar 29 12:49:15 2014
+++ src/sys/arch/amiga/stand/bootblock/boot/main.c	Mon Jan  4 14:10:15 2016
@@ -1,5 +1,5 @@
 /*
- * $NetBSD: main.c,v 1.29 2014/03/29 12:49:15 mlelstv Exp $
+ * $NetBSD: main.c,v 1.30 2016/01/04 14:10:15 phx Exp $
  *
  *
  * Copyright (c) 1996,1999 Ignatios Souvatzis
@@ -122,6 +122,7 @@ pain(void *aio,	void *cons)
 	struct MemHead *mh;
 	u_int32_t from, size, vfrom, vsize;
 	int contflag, mapped1to1;
+	int8_t mempri;
 
 	int ncd, nseg;
 	char c;
@@ -200,7 +201,7 @@ again:
 					    (get_number(&path) & 3) << 1;
 					break;
 				case 'p':	/* Select fastmem by priority */
-					p_flag++;
+					p_flag = 1;
 					break;
 				case 'q':
 					boothowto |= AB_QUIET;
@@ -274,6 +275,7 @@ again:
 	vfrom = mh->Lower & -__PGSZ;
 	vsize = (mh->Upper & -__PGSZ) - vfrom;
 	contflag = mapped1to1 = 0;
+	mempri = -128;
 
 	do {
 		size = vsize;
@@ -318,9 +320,12 @@ again:
 			size += from;
 			cmemsz = size;
 			from = 0;
-		} else if ((fmemsz < size) && mapped1to1) {
+		} else if (mapped1to1 && ((!p_flag && fmemsz < size) ||
+		    (p_flag && (mempri < mh->Pri ||
+		    (mempri == mh->Pri && fmemsz < size))))) {
 			fmem = from;
 			fmemsz = size;
+			mempri = mh->Pri;
 		}
 
 		memseg[nseg].ms_start = from;

Reply via email to