CVS commit: src/sys/arch/i386/stand/lib

2023-10-01 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Mon Oct  2 00:02:34 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Fix build with -DNO_GPT


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/i386/stand/lib/biosdisk.c

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



CVS commit: src/sys/arch/i386/stand/lib

2023-10-01 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Mon Oct  2 00:02:34 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Fix build with -DNO_GPT


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/i386/stand/lib/biosdisk.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/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.59 src/sys/arch/i386/stand/lib/biosdisk.c:1.60
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.59	Thu Sep 28 15:46:55 2023
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Mon Oct  2 00:02:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.59 2023/09/28 15:46:55 manu Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.60 2023/10/02 00:02:33 manu Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -328,7 +328,6 @@ guid_is_equal(const struct uuid *a, cons
 	return (memcmp(a, b, sizeof(*a)) == 0 ? true : false);
 }
 
-#ifndef NO_GPT
 static void
 part_name_utf8(const uint16_t *utf16_src, size_t utf16_srclen,
 	   char *utf8_dst, size_t utf8_dstlen)
@@ -351,7 +350,6 @@ part_name_utf8(const uint16_t *utf16_src
 
 	return;
 }
-#endif
 
 static int
 check_gpt(struct biosdisk *d, daddr_t rf_offset, daddr_t sector)
@@ -1562,14 +1560,17 @@ next_disk:
 			if (d->part[part].fstype == FS_UNUSED)
 continue;
 
+#ifndef NO_GPT
 			if (first_bootme == -1 &&
 			d->part[part].attr & GPT_ENT_ATTR_BOOTME)
 first_bootme = part;
+#endif
 
 			if (first_ffs == -1 &&
 			(d->part[part].fstype == FS_BSDFFS ||
 			 d->part[part].fstype == FS_BSDLFS))
 first_ffs = part;
+
 			if (part == target_part) {
 *biosdev = raidframe[i].biosdev;
 *offset = raidframe[i].offset



CVS commit: src/sys/arch/i386/stand/lib

2023-09-28 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Sep 28 15:46:55 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Align the behavior of different boot methods in RAIDframe

We enforce the documented and paritally implemented behavior when
looking for the kernel in RAID 1 sets without a partition name given.
We search for:
- A GPT partition with bootme attribute set
- A FFS or LFS patititon
- The first partition


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/i386/stand/lib/biosdisk.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/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.58 src/sys/arch/i386/stand/lib/biosdisk.c:1.59
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.58	Tue May  3 10:09:40 2022
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Thu Sep 28 15:46:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.58 2022/05/03 10:09:40 jmcneill Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.59 2023/09/28 15:46:55 manu Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -105,6 +105,7 @@
 struct biosdisk {
 	struct biosdisk_ll ll;
 	daddr_t boff;
+	daddr_t size;
 	charbuf[BIOSDISK_BUFSIZE];
 #if !defined(NO_DISKLABEL) || !defined(NO_GPT)
 	struct biosdisk_partition part[BIOSDISKNPART];
@@ -666,6 +667,7 @@ read_label(struct biosdisk *d, daddr_t o
 	dflt_lbl.d_npartitions = 8;
 
 	d->boff = 0;
+	d->size = 0;
 
 	if (d->ll.type != BIOSDISK_TYPE_HD)
 		/* No label on floppy and CD */
@@ -1208,7 +1210,7 @@ add_biosdisk_bootinfo(void)
 #endif
 
 #ifndef NO_GPT
-static daddr_t
+static void
 raidframe_part_offset(struct biosdisk *d, int part)
 {
 	struct biosdisk raidframe;
@@ -1221,8 +1223,10 @@ raidframe_part_offset(struct biosdisk *d
 
 	rf_offset = d->part[part].offset + RF_PROTECTED_SECTORS;
 	rf_size = d->part[part].size;
-	if (read_gpt(, rf_offset, rf_size) != 0)
-		return RF_PROTECTED_SECTORS;
+	if (read_gpt(, rf_offset, rf_size) != 0) {
+		d->boff += RF_PROTECTED_SECTORS;
+		return;
+	}
 
 	candidate = 0;
 	for (i = 0; i < BIOSDISKNPART; i++) {
@@ -1231,12 +1235,20 @@ raidframe_part_offset(struct biosdisk *d
 		if (raidframe.part[i].fstype == FS_UNUSED)
 			continue;
 #ifndef NO_GPT
-		if (raidframe.part[i].attr & GPT_ENT_ATTR_BOOTME)
+		if (raidframe.part[i].attr & GPT_ENT_ATTR_BOOTME) {
 			candidate = i;
+			break;
+		}
 #endif
+		if (raidframe.part[i].fstype == FS_BSDFFS ||
+		raidframe.part[i].fstype == FS_BSDLFS) {
+			if (candidate == 0)
+candidate = i;
+		}
 	}
 
-	return RF_PROTECTED_SECTORS + raidframe.part[candidate].offset;
+	d->boff += RF_PROTECTED_SECTORS + raidframe.part[candidate].offset;
+	d->size = raidframe.part[candidate].size;
 }
 #endif
 
@@ -1285,17 +1297,18 @@ biosdisk_open(struct open_file *f, ...)
 	}
 
 	d->boff = d->part[partition].offset;
+	d->size = d->part[partition].size;
 
 	if (d->part[partition].fstype == FS_RAID)
 #ifndef NO_GPT
-		d->boff += raidframe_part_offset(d, partition);
+		raidframe_part_offset(d, partition);
 #else
 		d->boff += RF_PROTECTED_SECTORS;
 #endif
 
 #ifdef _STANDALONE
-	bi_wedge.startblk = d->part[partition].offset;
-	bi_wedge.nblks = d->part[partition].size;
+	bi_wedge.startblk = d->boff;
+	bi_wedge.nblks = d->size;
 #endif
 
 nolabel:
@@ -1389,6 +1402,8 @@ next_disk:
 
 #ifndef NO_RAIDFRAME
 	for (i = 0; i < raidframe_count; i++) {
+		int first_bootme = -1;
+		int first_ffs = -1;
 		int candidate = -1;
 
 		if ((d = alloc_biosdisk(raidframe[i].biosdev)) == NULL) {
@@ -1402,12 +1417,20 @@ next_disk:
 			goto next_raidframe;
 
 		for (part = 0; part < BIOSDISKNPART; part++) {
-			bool bootme = d->part[part].attr & GPT_ENT_ATTR_BOOTME;
 			if (d->part[part].size == 0)
 continue;
 			if (d->part[part].fstype == FS_UNUSED)
 continue;
 
+			if (first_bootme == -1 && 
+			d->part[part].attr & GPT_ENT_ATTR_BOOTME)
+first_bootme = part;
+
+			if (first_ffs == -1 && 
+			(d->part[part].fstype == FS_BSDFFS ||
+			 d->part[part].fstype == FS_BSDLFS))
+first_ffs = part;
+
 			if (d->part[part].part_name != NULL &&
 			strcmp(d->part[part].part_name, name) == 0) {
 *biosdev = raidframe[i].biosdev;
@@ -1418,11 +1441,13 @@ next_disk:
 ret = 0;
 goto out;
 			}
-			if (strcmp(raidframe[i].parent_name, name) == 0) {
-if (candidate == -1 || bootme)
-	candidate = part;
-continue;
-			}
+		}
+
+		if (strcmp(raidframe[i].parent_name, name) == 0) {
+			if (first_bootme != -1)
+candidate = first_bootme;
+			else if (first_ffs != -1)
+candidate = first_ffs;
 		}
 
 		if (candidate != -1) {
@@ -1514,6 +1539,10 @@ next_disk:
 	}
 
 	for (i = 0; i < raidframe_count; i++) {
+		int first_bootme = -1;
+		int first_ffs = -1;
+		int candidate = -1;
+
 		if (raidframe[i].last_unit != target_unit)
 			continue;
 
@@ -1532,6 +1561,15 @@ next_disk:
 continue;
 			if (d->part[part].fstype == 

CVS commit: src/sys/arch/i386/stand/lib

2023-09-28 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Sep 28 15:46:55 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Align the behavior of different boot methods in RAIDframe

We enforce the documented and paritally implemented behavior when
looking for the kernel in RAID 1 sets without a partition name given.
We search for:
- A GPT partition with bootme attribute set
- A FFS or LFS patititon
- The first partition


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/i386/stand/lib/biosdisk.c

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



CVS commit: src/sys/arch/i386/stand/lib

2023-08-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 30 18:44:48 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: Makefile.inc

Log Message:
Explicitly pass COPTS


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/lib/Makefile.inc

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/i386/stand/lib/Makefile.inc
diff -u src/sys/arch/i386/stand/lib/Makefile.inc:1.19 src/sys/arch/i386/stand/lib/Makefile.inc:1.20
--- src/sys/arch/i386/stand/lib/Makefile.inc:1.19	Wed Jun 13 12:03:10 2018
+++ src/sys/arch/i386/stand/lib/Makefile.inc	Wed Aug 30 14:44:48 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.19 2018/06/13 16:03:10 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.20 2023/08/30 18:44:48 christos Exp $
 #
 #	Configuration variables (default values are below):
 #
@@ -26,6 +26,7 @@ I386MAKE= \
 	MAKEOBJDIR=${I386DST} ${MAKE} \
 	CC=${CC:q} CFLAGS=${CFLAGS:q} \
 	AS=${AS:q} AFLAGS=${AFLAGS:q} \
+	COPTS=${COPTS:q} \
 	LD=${LD:q} STRIP=${STRIP:q} \
 	MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \
 	I386CPPFLAGS=${CPPFLAGS:S@^-I.@-I../../.@g:q} \



CVS commit: src/sys/arch/i386/stand/lib

2023-08-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 30 18:44:48 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: Makefile.inc

Log Message:
Explicitly pass COPTS


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/stand/lib/Makefile.inc

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



CVS commit: src/sys/arch/i386/stand/lib

2023-08-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  4 07:21:57 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: exec_multiboot2.c

Log Message:
x86/multiboot2: Fix short read for 64-bit ELF headers

XXX document this
At the moment, this cannot affect NetBSD/amd64, as we have not
supported multiboot for kernel side.

Found by GCC12.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/lib/exec_multiboot2.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/i386/stand/lib/exec_multiboot2.c
diff -u src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.5 src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.6
--- src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.5	Wed Jul 21 23:16:08 2021
+++ src/sys/arch/i386/stand/lib/exec_multiboot2.c	Fri Aug  4 07:21:57 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_multiboot2.c,v 1.5 2021/07/21 23:16:08 jmcneill Exp $ */
+/* $NetBSD: exec_multiboot2.c,v 1.6 2023/08/04 07:21:57 rin Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -976,7 +976,10 @@ mbi_elf_sections(struct multiboot_packag
 {
 	size_t len = 0;
 	struct multiboot_tag_elf_sections *mbt = buf;
-	Elf_Ehdr ehdr;
+	union {
+		Elf32_Ehdr e32;
+		Elf64_Ehdr e64;
+	} ehdr;
 	int class;
 	Elf32_Ehdr *ehdr32 = NULL;
 	Elf64_Ehdr *ehdr64 = NULL;
@@ -991,21 +994,21 @@ mbi_elf_sections(struct multiboot_packag
 	/*
 	 * Check this is a ELF header
 	 */
-	if (memcmp(_ident, ELFMAG, SELFMAG) != 0)
+	if (memcmp(_ident, ELFMAG, SELFMAG) != 0)
 		goto out;
 
-	class = ehdr.e_ident[EI_CLASS];
+	class = ehdr.e32.e_ident[EI_CLASS];
 
 	switch (class) {
 	case ELFCLASS32:
-		ehdr32 = (Elf32_Ehdr *)
+		ehdr32 = 
 		shnum = ehdr32->e_shnum;
 		shentsize = ehdr32->e_shentsize;
 		shstrndx = ehdr32->e_shstrndx;
 		shoff = ehdr32->e_shoff;
 		break;
 	case ELFCLASS64:
-		ehdr64 = (Elf64_Ehdr *)
+		ehdr64 = 
 		shnum = ehdr64->e_shnum;
 		shentsize = ehdr64->e_shentsize;
 		shstrndx = ehdr64->e_shstrndx;



CVS commit: src/sys/arch/i386/stand/lib

2023-08-04 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  4 07:21:57 UTC 2023

Modified Files:
src/sys/arch/i386/stand/lib: exec_multiboot2.c

Log Message:
x86/multiboot2: Fix short read for 64-bit ELF headers

XXX document this
At the moment, this cannot affect NetBSD/amd64, as we have not
supported multiboot for kernel side.

Found by GCC12.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/lib/exec_multiboot2.c

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



CVS commit: src/sys/arch/i386/stand/lib

2022-09-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Sep 21 14:29:45 UTC 2022

Modified Files:
src/sys/arch/i386/stand/lib: exec.c

Log Message:
i386/stand: Handle 9.99.100 by taking four, not two, digits.

We haven't used the revision part of __NetBSD_Version__ = MMmmrrpp00
in almos two decades so we're apparently reclaiming it as MMmm00.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/i386/stand/lib/exec.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/i386/stand/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.77 src/sys/arch/i386/stand/lib/exec.c:1.78
--- src/sys/arch/i386/stand/lib/exec.c:1.77	Sun May 30 05:59:23 2021
+++ src/sys/arch/i386/stand/lib/exec.c	Wed Sep 21 14:29:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.77 2021/05/30 05:59:23 mlelstv Exp $	 */
+/*	$NetBSD: exec.c,v 1.78 2022/09/21 14:29:45 riastradh Exp $	 */
 
 /*
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -684,7 +684,7 @@ module_base_path(char *buf, size_t bufsi
 		"/stand/%s/%d.%d.%d/modules", machine,
 		netbsd_version / 1,
 		netbsd_version / 100 % 100,
-		netbsd_version / 100 % 100);
+		netbsd_version / 100 % 1);
 	} else if (netbsd_version != 0) {
 		/* release */
 		snprintf(buf, bufsize,



CVS commit: src/sys/arch/i386/stand/lib

2022-09-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Sep 21 14:29:45 UTC 2022

Modified Files:
src/sys/arch/i386/stand/lib: exec.c

Log Message:
i386/stand: Handle 9.99.100 by taking four, not two, digits.

We haven't used the revision part of __NetBSD_Version__ = MMmmrrpp00
in almos two decades so we're apparently reclaiming it as MMmm00.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/i386/stand/lib/exec.c

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



CVS commit: src/sys/arch/i386/stand/lib

2022-05-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue May  3 10:09:40 UTC 2022

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/i386/stand/lib/biosdisk.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/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.57 src/sys/arch/i386/stand/lib/biosdisk.c:1.58
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.57	Tue Dec 28 00:37:16 2021
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Tue May  3 10:09:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.57 2021/12/28 00:37:16 simonb Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.58 2022/05/03 10:09:40 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -544,7 +544,7 @@ ingest_label(struct biosdisk *d, struct 
 		d->part[part].size = lp->d_partitions[part].p_size;
 	}
 }
-	
+
 static int
 check_label(struct biosdisk *d, daddr_t sector)
 {
@@ -787,7 +787,6 @@ read_partitions(struct biosdisk *d, dadd
 #endif
 #ifndef NO_DISKLABEL
 	error = read_label(d, offset);
-	
 #endif
 	return error;
 }
@@ -893,7 +892,7 @@ biosdisk_probe(void)
 
 		if (read_partitions(d, 0, 0) != 0)
 			goto next_disk;
-			
+
 		for (part = 0; part < BIOSDISKNPART; part++) {
 			if (d->part[part].size == 0)
 continue;
@@ -969,7 +968,7 @@ next_disk:
 		raidframe[i].offset + RF_PROTECTED_SECTORS,
 		raidframe[i].size) != 0)
 			goto next_raidrame;
-			
+
 		first = 1;
 		for (part = 0; part < BIOSDISKNPART; part++) {
 #ifndef NO_GPT
@@ -1240,7 +1239,7 @@ raidframe_part_offset(struct biosdisk *d
 	return RF_PROTECTED_SECTORS + raidframe.part[candidate].offset;
 }
 #endif
-	
+
 int
 biosdisk_open(struct open_file *f, ...)
 /* struct open_file *f, int biosdev, int partition */
@@ -1356,7 +1355,7 @@ biosdisk_find_name(const char *fname, in
 
 		if (read_partitions(d, 0, 0) != 0)
 			goto next_disk;
-			
+
 		for (part = 0; part < BIOSDISKNPART; part++) {
 			if (d->part[part].size == 0)
 continue;
@@ -1401,7 +1400,7 @@ next_disk:
 		raidframe[i].offset + RF_PROTECTED_SECTORS,
 		raidframe[i].size) != 0)
 			goto next_raidframe;
-			
+
 		for (part = 0; part < BIOSDISKNPART; part++) {
 			bool bootme = d->part[part].attr & GPT_ENT_ATTR_BOOTME;
 			if (d->part[part].size == 0)
@@ -1499,7 +1498,7 @@ biosdisk_find_raid(const char *name, int
 
 		if (read_partitions(d, 0, 0) != 0)
 			goto next_disk;
-			
+
 		for (part = 0; part < BIOSDISKNPART; part++) {
 			if (d->part[part].size == 0)
 continue;
@@ -1527,7 +1526,7 @@ next_disk:
 		raidframe[i].offset + RF_PROTECTED_SECTORS,
 		raidframe[i].size) != 0)
 			goto next_raidframe;
-			
+
 		for (part = 0; part < BIOSDISKNPART; part++) {
 			if (d->part[part].size == 0)
 continue;



CVS commit: src/sys/arch/i386/stand/lib

2022-05-03 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue May  3 10:09:40 UTC 2022

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/i386/stand/lib/biosdisk.c

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



CVS commit: src/sys/arch/i386/stand/lib

2022-04-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Apr  1 19:02:12 UTC 2022

Modified Files:
src/sys/arch/i386/stand/lib: realprot.S

Log Message:
s/potected/protected and s/investication/investigation/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/lib/realprot.S

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/i386/stand/lib/realprot.S
diff -u src/sys/arch/i386/stand/lib/realprot.S:1.11 src/sys/arch/i386/stand/lib/realprot.S:1.12
--- src/sys/arch/i386/stand/lib/realprot.S:1.11	Tue Dec 24 19:00:56 2013
+++ src/sys/arch/i386/stand/lib/realprot.S	Fri Apr  1 19:02:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: realprot.S,v 1.11 2013/12/24 19:00:56 jakllsch Exp $	*/
+/*	$NetBSD: realprot.S,v 1.12 2022/04/01 19:02:12 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -188,7 +188,7 @@ ENTRY(real_to_prot)
  *
  * It is speculated that the CPU is prefetching and decoding branch
  * targets and not invalidating this buffer on the long jump.
- * Further investication indicates that the caching of return addresses
+ * Further investigation indicates that the caching of return addresses
  * is most likely the problem.
  *
  * Previous versions just used some extra call/ret and a few NOPs, these
@@ -229,7 +229,7 @@ ENTRY(prot_to_real)
 	.code16
 	movl	%cr0, %eax
 	and 	$~CR0_PE, %eax
-	movl	%eax, %cr0		/* Disable potected mode */
+	movl	%eax, %cr0		/* Disable protected mode */
 
 	/* Jump far indirect to load real mode %cs */
 	ljmp	*%cs:toreal



CVS commit: src/sys/arch/i386/stand/lib

2022-04-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Apr  1 19:02:12 UTC 2022

Modified Files:
src/sys/arch/i386/stand/lib: realprot.S

Log Message:
s/potected/protected and s/investication/investigation/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/lib/realprot.S

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



CVS commit: src/sys/arch/i386/stand/lib

2021-12-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Dec 28 00:37:16 UTC 2021

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
In biosdisk_findpartition() check if part_name isn't NULL before
assigning *part_name.

Thanks to manu@ for the pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/i386/stand/lib/biosdisk.c

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



CVS commit: src/sys/arch/i386/stand/lib

2021-12-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Dec 28 00:37:16 UTC 2021

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
In biosdisk_findpartition() check if part_name isn't NULL before
assigning *part_name.

Thanks to manu@ for the pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/i386/stand/lib/biosdisk.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/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.56 src/sys/arch/i386/stand/lib/biosdisk.c:1.57
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.56	Tue Dec 28 00:34:30 2021
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Tue Dec 28 00:37:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.56 2021/12/28 00:34:30 simonb Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.57 2021/12/28 00:37:16 simonb Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -1028,7 +1028,8 @@ biosdisk_findpartition(int biosdev, dadd
 {
 #if defined(NO_DISKLABEL) && defined(NO_GPT)
 	*partition = 0;
-	*part_name = NULL;
+	if (part_name)
+		*part_name = NULL;
 	return 0;
 #else
 	int i;
@@ -1047,7 +1048,8 @@ biosdisk_findpartition(int biosdev, dadd
 
 	/* default to first partition */
 	*partition = 0;
-	*part_name = NULL;
+	if (part_name)
+		*part_name = NULL;
 
 	/* Look for netbsd partition that is the dos boot one */
 	d = alloc_biosdisk(biosdev);



CVS commit: src/sys/arch/i386/stand/lib

2021-12-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Dec 28 00:34:30 UTC 2021

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Fix a tyop.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/i386/stand/lib/biosdisk.c

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



CVS commit: src/sys/arch/i386/stand/lib

2021-12-27 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Tue Dec 28 00:34:30 UTC 2021

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Fix a tyop.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/i386/stand/lib/biosdisk.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/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.55 src/sys/arch/i386/stand/lib/biosdisk.c:1.56
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.55	Sun May 30 05:59:23 2021
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Tue Dec 28 00:34:30 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.55 2021/05/30 05:59:23 mlelstv Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.56 2021/12/28 00:34:30 simonb Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -1045,7 +1045,7 @@ biosdisk_findpartition(int biosdev, dadd
 	printf("looking for partition device %x, sector %"PRId64"\n", biosdev, sector);
 #endif
 
-	/* default ot first partition */
+	/* default to first partition */
 	*partition = 0;
 	*part_name = NULL;
 



CVS commit: src/sys/arch/i386/stand/lib

2019-10-17 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 18 01:24:51 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: libi386.h

Log Message:
Remove prototype added twice by mistake


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/stand/lib/libi386.h

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/i386/stand/lib/libi386.h
diff -u src/sys/arch/i386/stand/lib/libi386.h:1.46 src/sys/arch/i386/stand/lib/libi386.h:1.47
--- src/sys/arch/i386/stand/lib/libi386.h:1.46	Fri Oct 18 01:09:46 2019
+++ src/sys/arch/i386/stand/lib/libi386.h	Fri Oct 18 01:24:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libi386.h,v 1.46 2019/10/18 01:09:46 manu Exp $	*/
+/*	$NetBSD: libi386.h,v 1.47 2019/10/18 01:24:51 manu Exp $	*/
 
 /*
  * Copyright (c) 1996
@@ -173,6 +173,4 @@ void framebuffer_configure(struct btinfo
 
 void ksyms_addr_set(void *, void *, void *);
 
-void ksyms_addr_set(void *, void *, void *);
-
 #endif	/* __I386_STAND_LIBI386_H__ */



CVS commit: src/sys/arch/i386/stand/lib

2019-10-17 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 18 01:24:51 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: libi386.h

Log Message:
Remove prototype added twice by mistake


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/i386/stand/lib/libi386.h

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



CVS commit: src/sys/arch/i386/stand/lib

2019-10-17 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 18 01:15:54 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: exec_multiboot2.c

Log Message:
Fix kernel symbols for multiboot2

Previous version just provided the ELF section table, which is correct
as far as the multiboot 2 specification is concerned.

But in order to retreive kernel symboles, the NetBSD kernelneeds symbol
table and string table sections to be loaded in memory, and have an
address set in the section table.

Requires change: Add kernel symbols for multiboot1
src/sys/arch/i386/stand/lib/exec_multiboot1.c 1.2 - 1.3
src/sys/arch/i386/stand/lib/libi386.h 1.45 - 1.46


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/exec_multiboot2.c

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



CVS commit: src/sys/arch/i386/stand/lib

2019-10-17 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 18 01:15:54 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: exec_multiboot2.c

Log Message:
Fix kernel symbols for multiboot2

Previous version just provided the ELF section table, which is correct
as far as the multiboot 2 specification is concerned.

But in order to retreive kernel symboles, the NetBSD kernelneeds symbol
table and string table sections to be loaded in memory, and have an
address set in the section table.

Requires change: Add kernel symbols for multiboot1
src/sys/arch/i386/stand/lib/exec_multiboot1.c 1.2 - 1.3
src/sys/arch/i386/stand/lib/libi386.h 1.45 - 1.46


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/exec_multiboot2.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/i386/stand/lib/exec_multiboot2.c
diff -u src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.2 src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.3
--- src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.2	Sun Sep 15 23:55:26 2019
+++ src/sys/arch/i386/stand/lib/exec_multiboot2.c	Fri Oct 18 01:15:54 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_multiboot2.c,v 1.2 2019/09/15 23:55:26 manu Exp $ */
+/* $NetBSD: exec_multiboot2.c,v 1.3 2019/10/18 01:15:54 manu Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -976,9 +976,10 @@ mbi_elf_sections(struct multiboot_packag
 	size_t len = 0;
 	struct multiboot_tag_elf_sections *mbt = buf;
 	Elf_Ehdr ehdr;
+	int class;
 	Elf32_Ehdr *ehdr32 = NULL;
 	Elf64_Ehdr *ehdr64 = NULL;
-	uint32_t shnum, shentsize, shstrndx, shoff;
+	uint64_t shnum, shentsize, shstrndx, shoff;
 	size_t shdr_len;
 
 	if (mbp->mbp_marks[MARK_SYM] == 0)
@@ -992,7 +993,9 @@ mbi_elf_sections(struct multiboot_packag
 	if (memcmp(_ident, ELFMAG, SELFMAG) != 0)
 		goto out;
 
-	switch (ehdr.e_ident[EI_CLASS]) {
+	class = ehdr.e_ident[EI_CLASS];
+
+	switch (class) {
 	case ELFCLASS32:
 		ehdr32 = (Elf32_Ehdr *)
 		shnum = ehdr32->e_shnum;
@@ -1017,8 +1020,7 @@ mbi_elf_sections(struct multiboot_packag
 
 	len = sizeof(*mbt) + shdr_len;
 	if (mbt) {
-		int fd = -1;
-		int ret = -1;
+		char *shdr = (char *)mbp->mbp_marks[MARK_SYM] + shoff;
 
 		mbt->type = MULTIBOOT_TAG_TYPE_ELF_SECTIONS;
 		mbt->size = len;
@@ -1026,26 +1028,16 @@ mbi_elf_sections(struct multiboot_packag
 		mbt->entsize = shentsize;
 		mbt->shndx = shstrndx;
 		
-		if ((fd = open(mbp->mbp_file, 0)) == -1)
-			goto out_read;
-
-		if (lseek(fd, shoff, SEEK_SET) != shoff)
-			goto out_read;
- 
-		if (read(fd, mbt + 1,  shdr_len) != shdr_len)
-			goto out_read;
+		pvbcopy((void *)shdr, mbt + 1, shdr_len);
 
-		ret = 0;
-out_read:
-		if (fd != -1)
-			close(fd);
-
-		if (ret != 0) {
-			printf("Error reading ELF sections from %s\n",
-			mbp->mbp_file);
-			len = 0;
-		}
+		/*
+		 * Adjust sh_addr for symtab and strtab
+		 * section that have been loaded.
+		 */
+		ksyms_addr_set(, mbt + 1,
+		(void *)mbp->mbp_marks[MARK_SYM]);
 	}
+
 out:
 	return roundup(len, MULTIBOOT_TAG_ALIGN);
 }



CVS commit: src/sys/arch/i386/stand/lib

2019-10-17 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 18 01:09:47 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: exec_multiboot1.c libi386.h

Log Message:
Add kernel symbols for multiboot1


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/exec_multiboot1.c
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/i386/stand/lib/libi386.h

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/i386/stand/lib/exec_multiboot1.c
diff -u src/sys/arch/i386/stand/lib/exec_multiboot1.c:1.2 src/sys/arch/i386/stand/lib/exec_multiboot1.c:1.3
--- src/sys/arch/i386/stand/lib/exec_multiboot1.c:1.2	Fri Oct 18 01:04:24 2019
+++ src/sys/arch/i386/stand/lib/exec_multiboot1.c	Fri Oct 18 01:09:46 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_multiboot1.c,v 1.2 2019/10/18 01:04:24 manu Exp $ */
+/* $NetBSD: exec_multiboot1.c,v 1.3 2019/10/18 01:09:46 manu Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -42,6 +42,80 @@
 
 extern struct btinfo_modulelist *btinfo_modulelist;
 
+void
+ksyms_addr_set(void *ehdr, void *shdr, void *symbase)
+{
+	int class;
+	Elf32_Ehdr *ehdr32 = NULL;
+	Elf64_Ehdr *ehdr64 = NULL;
+	uint64_t shnum;
+	int i;
+
+	class = ((Elf_Ehdr *)ehdr)->e_ident[EI_CLASS];
+
+switch (class) {
+case ELFCLASS32: 
+ehdr32 = (Elf32_Ehdr *)ehdr;
+shnum = ehdr32->e_shnum;
+break;
+case ELFCLASS64:
+ehdr64 = (Elf64_Ehdr *)ehdr;
+shnum = ehdr64->e_shnum;
+break;
+default:
+		panic("Unexpected ELF class");
+		break;
+}
+
+	for (i = 0; i < shnum; i++) {
+		Elf64_Shdr *shdrp64 = NULL;
+		Elf32_Shdr *shdrp32 = NULL;
+		uint64_t shtype, shaddr, shsize, shoffset;
+
+		switch(class) {
+		case ELFCLASS64:
+			shdrp64 = &((Elf64_Shdr *)shdr)[i];	
+			shtype = shdrp64->sh_type;
+			shaddr = shdrp64->sh_addr;
+			shsize = shdrp64->sh_size;
+			shoffset = shdrp64->sh_offset;
+			break;
+		case ELFCLASS32:
+			shdrp32 = &((Elf32_Shdr *)shdr)[i];	
+			shtype = shdrp32->sh_type;
+			shaddr = shdrp32->sh_addr;
+			shsize = shdrp32->sh_size;
+			shoffset = shdrp32->sh_offset;
+			break;
+		default:
+			panic("Unexpected ELF class");
+			break;
+		}
+
+		if (shtype != SHT_SYMTAB && shtype != SHT_STRTAB)
+			continue;
+
+		if (shaddr != 0 || shsize == 0)
+			continue;
+
+		shaddr = (uint64_t)(uintptr_t)(symbase + shoffset);
+
+		switch(class) {
+		case ELFCLASS64:
+			shdrp64->sh_addr = shaddr;
+			break;
+		case ELFCLASS32:
+			shdrp32->sh_addr = shaddr;
+			break;
+		default:
+			panic("Unexpected ELF class");
+			break;
+		}
+	}
+
+	return;
+}
+
 static int
 exec_multiboot1(struct multiboot_package *mbp)
 {
@@ -85,6 +159,38 @@ exec_multiboot1(struct multiboot_package
 		mbi->mi_mods_addr = vtophys(mbm);
 	}
 
+	if (mbp->mbp_marks[MARK_SYM] != 0) {
+		Elf32_Ehdr ehdr;
+		void *shbuf;
+		size_t shlen;
+		u_long shaddr;
+
+		pvbcopy((void *)mbp->mbp_marks[MARK_SYM], , sizeof(ehdr));
+
+		if (memcmp(_ident, ELFMAG, SELFMAG) != 0)
+			goto skip_ksyms;
+
+		shaddr = mbp->mbp_marks[MARK_SYM] + ehdr.e_shoff;
+
+		shlen = ehdr.e_shnum * ehdr.e_shentsize;
+		shbuf = alloc(shlen);
+
+		pvbcopy((void *)shaddr, shbuf, shlen);
+		ksyms_addr_set(, shbuf,
+		(void *)(KERNBASE + mbp->mbp_marks[MARK_SYM]));
+		vpbcopy(shbuf, (void *)shaddr, shlen);
+
+		dealloc(shbuf, shlen);
+
+		mbi->mi_elfshdr_num = ehdr.e_shnum;
+		mbi->mi_elfshdr_size = ehdr.e_shentsize;
+		mbi->mi_elfshdr_addr = shaddr;
+		mbi->mi_elfshdr_shndx = ehdr.e_shstrndx;
+
+		mbi->mi_flags |= MULTIBOOT_INFO_HAS_ELF_SYMS;
+	}
+skip_ksyms:
+
 #ifdef DEBUG
 	printf("Start @ 0x%lx [%ld=0x%lx-0x%lx]...\n",
 	mbp->mbp_marks[MARK_ENTRY],

Index: src/sys/arch/i386/stand/lib/libi386.h
diff -u src/sys/arch/i386/stand/lib/libi386.h:1.45 src/sys/arch/i386/stand/lib/libi386.h:1.46
--- src/sys/arch/i386/stand/lib/libi386.h:1.45	Fri Sep 13 02:19:46 2019
+++ src/sys/arch/i386/stand/lib/libi386.h	Fri Oct 18 01:09:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libi386.h,v 1.45 2019/09/13 02:19:46 manu Exp $	*/
+/*	$NetBSD: libi386.h,v 1.46 2019/10/18 01:09:46 manu Exp $	*/
 
 /*
  * Copyright (c) 1996
@@ -171,4 +171,8 @@ void module_add_split(const char *, uint
 struct btinfo_framebuffer;
 void framebuffer_configure(struct btinfo_framebuffer *);
 
+void ksyms_addr_set(void *, void *, void *);
+
+void ksyms_addr_set(void *, void *, void *);
+
 #endif	/* __I386_STAND_LIBI386_H__ */



CVS commit: src/sys/arch/i386/stand/lib

2019-10-17 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 18 01:09:47 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: exec_multiboot1.c libi386.h

Log Message:
Add kernel symbols for multiboot1


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/lib/exec_multiboot1.c
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/i386/stand/lib/libi386.h

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



CVS commit: src/sys/arch/i386/stand/lib

2019-10-17 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 18 01:04:24 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: exec_multiboot1.c

Log Message:
Fix multiboot1 header detection

Specification states it must be must be longword (32-bit) aligned


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/lib/exec_multiboot1.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/i386/stand/lib/exec_multiboot1.c
diff -u src/sys/arch/i386/stand/lib/exec_multiboot1.c:1.1 src/sys/arch/i386/stand/lib/exec_multiboot1.c:1.2
--- src/sys/arch/i386/stand/lib/exec_multiboot1.c:1.1	Fri Sep 13 02:19:46 2019
+++ src/sys/arch/i386/stand/lib/exec_multiboot1.c	Fri Oct 18 01:04:24 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_multiboot1.c,v 1.1 2019/09/13 02:19:46 manu Exp $ */
+/* $NetBSD: exec_multiboot1.c,v 1.2 2019/10/18 01:04:24 manu Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -126,7 +126,7 @@ probe_multiboot1(const char *path)
 	if (readen < sizeof(struct multiboot_header))
 		goto out;
 
-	for (i = 0; i < readen; i += 8) {
+	for (i = 0; i < readen; i += 4) {
 		struct multiboot_header *mbh;
 
 		mbh = (struct multiboot_header *)(buf + i);



CVS commit: src/sys/arch/i386/stand/lib

2019-10-17 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Fri Oct 18 01:04:24 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: exec_multiboot1.c

Log Message:
Fix multiboot1 header detection

Specification states it must be must be longword (32-bit) aligned


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/lib/exec_multiboot1.c

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



CVS commit: src/sys/arch/i386/stand/lib

2019-09-15 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Sun Sep 15 23:55:26 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: exec_multiboot2.c

Log Message:
Remove debug define.

It remained there unseen because it was misspelled!


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/lib/exec_multiboot2.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/i386/stand/lib/exec_multiboot2.c
diff -u src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.1 src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.2
--- src/sys/arch/i386/stand/lib/exec_multiboot2.c:1.1	Fri Sep 13 02:19:46 2019
+++ src/sys/arch/i386/stand/lib/exec_multiboot2.c	Sun Sep 15 23:55:26 2019
@@ -1,5 +1,4 @@
-/* $NetBSD: exec_multiboot2.c,v 1.1 2019/09/13 02:19:46 manu Exp $ */
-#define MULTIBBOT2_DEBUG
+/* $NetBSD: exec_multiboot2.c,v 1.2 2019/09/15 23:55:26 manu Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.



CVS commit: src/sys/arch/i386/stand/lib

2019-09-15 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Sun Sep 15 23:55:26 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: exec_multiboot2.c

Log Message:
Remove debug define.

It remained there unseen because it was misspelled!


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/lib/exec_multiboot2.c

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



CVS commit: src/sys/arch/i386/stand/lib

2019-08-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Aug 18 16:49:30 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Correct the memset(3)'s third argument in i386 biosdisk.c

The size of allocation is the size of the structure biosdisk, not the size
of a pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/i386/stand/lib/biosdisk.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/i386/stand/lib/biosdisk.c
diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.50 src/sys/arch/i386/stand/lib/biosdisk.c:1.51
--- src/sys/arch/i386/stand/lib/biosdisk.c:1.50	Sun Aug 18 02:18:25 2019
+++ src/sys/arch/i386/stand/lib/biosdisk.c	Sun Aug 18 16:49:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: biosdisk.c,v 1.50 2019/08/18 02:18:25 manu Exp $	*/
+/*	$NetBSD: biosdisk.c,v 1.51 2019/08/18 16:49:30 kamil Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998
@@ -858,7 +858,7 @@ biosdisk_probe(void)
 			printf("Out of memory\n");
 			return;
 		}
-		memset(d, 0, sizeof(d));
+		memset(d, 0, sizeof(*d));
 		memset(, 0, sizeof(ed));
 		if (i >= MAX_BIOSDISKS)
 			d->ll.dev = 0x00 + i - MAX_BIOSDISKS;	/* fd */



CVS commit: src/sys/arch/i386/stand/lib

2019-08-18 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Aug 18 16:49:30 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: biosdisk.c

Log Message:
Correct the memset(3)'s third argument in i386 biosdisk.c

The size of allocation is the size of the structure biosdisk, not the size
of a pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/i386/stand/lib/biosdisk.c

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



CVS commit: src/sys/arch/i386/stand/lib

2019-08-01 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Aug  1 13:11:03 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: bootinfo_biosgeom.c

Log Message:
Fix buffer overflow in BIOS disk geometry collect for bootinfo

This spares a boot-time panic on iMac with fusion drive, which
feature both a hard drive and a solid-state drive.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/stand/lib/bootinfo_biosgeom.c

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



CVS commit: src/sys/arch/i386/stand/lib

2019-08-01 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Thu Aug  1 13:11:03 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: bootinfo_biosgeom.c

Log Message:
Fix buffer overflow in BIOS disk geometry collect for bootinfo

This spares a boot-time panic on iMac with fusion drive, which
feature both a hard drive and a solid-state drive.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/stand/lib/bootinfo_biosgeom.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/i386/stand/lib/bootinfo_biosgeom.c
diff -u src/sys/arch/i386/stand/lib/bootinfo_biosgeom.c:1.23 src/sys/arch/i386/stand/lib/bootinfo_biosgeom.c:1.24
--- src/sys/arch/i386/stand/lib/bootinfo_biosgeom.c:1.23	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/lib/bootinfo_biosgeom.c	Thu Aug  1 13:11:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo_biosgeom.c,v 1.23 2017/01/24 11:09:14 nonaka Exp $	*/
+/*	$NetBSD: bootinfo_biosgeom.c,v 1.24 2019/08/01 13:11:03 manu Exp $	*/
 
 /*
  * Copyright (c) 1997
@@ -60,6 +60,7 @@ void
 bi_getbiosgeom(void)
 {
 	struct btinfo_biosgeom *bibg;
+	size_t bibg_len = sizeof(*bibg);
 	int i, j, nvalid;
 	int nhd;
 	unsigned int cksum;
@@ -72,8 +73,8 @@ bi_getbiosgeom(void)
 	printf("nhd %d\n", nhd);
 #endif
 
-	bibg = alloc(sizeof(struct btinfo_biosgeom)
-		 + (nhd - 1) * sizeof(struct bi_biosgeom_entry));
+	bibg_len += nhd * sizeof(struct bi_biosgeom_entry); 
+	bibg = alloc(bibg_len);
 	if (bibg == NULL)
 		return;
 
@@ -175,6 +176,8 @@ bi_getbiosgeom(void)
 
 	bibg->num = nvalid;
 
-	BI_ADD(bibg, BTINFO_BIOSGEOM, sizeof(struct btinfo_biosgeom)
-	   + nvalid * sizeof(struct bi_biosgeom_entry));
+	if (nvalid < nhd)
+		bibg_len -= (nhd - nvalid) * sizeof(struct bi_biosgeom_entry);
+
+	BI_ADD(bibg, BTINFO_BIOSGEOM, bibg_len);
 }



CVS commit: src/sys/arch/i386/stand/lib

2019-06-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 24 02:48:51 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: exec.c

Log Message:
Remove double-include for reboot.h


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/i386/stand/lib/exec.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/i386/stand/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.70 src/sys/arch/i386/stand/lib/exec.c:1.71
--- src/sys/arch/i386/stand/lib/exec.c:1.70	Thu Jun 20 17:33:31 2019
+++ src/sys/arch/i386/stand/lib/exec.c	Mon Jun 24 02:48:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.70 2019/06/20 17:33:31 maxv Exp $	 */
+/*	$NetBSD: exec.c,v 1.71 2019/06/24 02:48:51 pgoyette Exp $	 */
 
 /*
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -94,7 +94,6 @@
 
 #include 
 #include 
-#include 
 
 #include 
 



CVS commit: src/sys/arch/i386/stand/lib

2019-06-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 24 02:48:51 UTC 2019

Modified Files:
src/sys/arch/i386/stand/lib: exec.c

Log Message:
Remove double-include for reboot.h


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/i386/stand/lib/exec.c

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



Re: CVS commit: src/sys/arch/i386/stand/lib

2018-06-11 Thread Christos Zoulas
In article <20180612032531.ga1...@homeworld.netbsd.org>,
  wrote:
>Hi christos!
>
>Could you explain what makes this necessary in the commit messages in
>the future? It isn't very obvious that it fixes a build failure with
>MKREPRO for future netbsd'ers, in case it isn't restructured.
>Ideally in every commit, so it appears in a 'cvs annotate'.

Unfortunately we have many different ways of building with OBJDIRS.
Some of them add a prefix (MAKEOBJDIRPREFIX) while others add
objdirs inside the build dirs. The same way we need to have consistent
SRC directories (we map all source directories to /usr/src so that
DW_AT_name is the same no matter what NETBSDSRCDIR is) we also need
to map objdirs consistently (for example to /usr/obj for DW_AT_comp_dir).
You can look at the dwarf bits by doing readelf --debug-dump in
any .debug file.

This is not specific to any commit, it just general background
knowledge that paths embedded in binaries need to be "normalized". 

christos



Re: CVS commit: src/sys/arch/i386/stand/lib

2018-06-11 Thread maya
On Tue, Jun 12, 2018 at 03:25:31AM +, m...@netbsd.org wrote:
> Hi christos!
> 
> Could you explain what makes this necessary in the commit messages in
> the future? It isn't very obvious that it fixes a build failure with
> MKREPRO for future netbsd'ers, in case it isn't restructured.
> Ideally in every commit, so it appears in a 'cvs annotate'.

It's amusing to have this alongside the comments by uwe about overly
verbose commit messages (I didn't notice), but note that MKREPRO isn't
the default, so I would personally miss it even if I tried to undo this
change and see what breaks.


Re: CVS commit: src/sys/arch/i386/stand/lib

2018-06-11 Thread maya
Hi christos!

Could you explain what makes this necessary in the commit messages in
the future? It isn't very obvious that it fixes a build failure with
MKREPRO for future netbsd'ers, in case it isn't restructured.
Ideally in every commit, so it appears in a 'cvs annotate'.

Thanks.

On Mon, Jun 11, 2018 at 05:35:13PM -0400, Christos Zoulas wrote:
> Module Name:  src
> Committed By: christos
> Date: Mon Jun 11 21:35:13 UTC 2018
> 
> Modified Files:
>   src/sys/arch/i386/stand/lib: Makefile.inc
> 
> Log Message:
> switch CFLAGS from using MAKEOBJDIRPREFIX to MAKEOBJDIR. This whole thing
> is disgusting, but fixing it properly. requires restructuring
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.17 -r1.18 src/sys/arch/i386/stand/lib/Makefile.inc
> 
> 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/i386/stand/lib/Makefile.inc
> diff -u src/sys/arch/i386/stand/lib/Makefile.inc:1.17 
> src/sys/arch/i386/stand/lib/Makefile.inc:1.18
> --- src/sys/arch/i386/stand/lib/Makefile.inc:1.17 Sat May 26 21:14:50 2018
> +++ src/sys/arch/i386/stand/lib/Makefile.inc  Mon Jun 11 17:35:13 2018
> @@ -1,4 +1,4 @@
> -#$NetBSD: Makefile.inc,v 1.17 2018/05/27 01:14:50 christos Exp $
> +#$NetBSD: Makefile.inc,v 1.18 2018/06/11 21:35:13 christos Exp $
>  #
>  #Configuration variables (default values are below):
>  #
> @@ -24,7 +24,7 @@ CWARNFLAGS.clang+=  -Wno-tautological-com
>  I386MAKE= \
>   cd ${I386DIR} && MAKEOBJDIRPREFIX= && unset MAKEOBJDIRPREFIX && \
>   MAKEOBJDIR=${I386DST} ${MAKE} \
> - CC=${CC:q} CFLAGS=${CFLAGS:q} \
> + CC=${CC:q} CFLAGS=${CFLAGS:S/MAKEOBJDIRPREFIX/MAKEOBJDIR/:q} \
>   AS=${AS:q} AFLAGS=${AFLAGS:q} \
>   LD=${LD:q} STRIP=${STRIP:q} \
>   MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:q} \
> 



re: CVS commit: src/sys/arch/i386/stand/lib

2016-06-05 Thread matthew green
"Maxime Villard" writes:
> Module Name:  src
> Committed By: maxv
> Date: Sun Jun  5 14:06:31 UTC 2016
> 
> Modified Files:
>   src/sys/arch/i386/stand/lib: biosdisk.c exec.c
> 
> Log Message:
> The bootinfo is refreshed each time the bootloader tries to execute a
> kernel, so there's no point in using this global variable. Because of
> this variable, only one "boot" command can be issued in the prompt, and
> you have to reboot the machine if you mistyped the kernel name.

ah, thanks!  this used to work a long time ago.  i recently
noticed it didn't work for me.


.mrg.


Re: CVS commit: src/sys/arch/i386/stand/lib

2015-02-02 Thread John Nemeth
On Jan 18,  8:18pm, Jonathan A. Kollasch wrote:
}
} This is a multi-part message in MIME format.
} 
} --_--=_1421612287110410
} Content-Disposition: inline
} Content-Transfer-Encoding: 8bit
} Content-Type: text/plain; charset=US-ASCII
} 
} Module Name:  src
} Committed By: jakllsch
} Date: Sun Jan 18 20:18:07 UTC 2015
} 
} Modified Files:
}   src/sys/arch/i386/stand/lib: biosdisk.c
} 
} Log Message:
} While the old gpt.S mbr code looks at both primary and alternate GPT
} partition tables, mbrgpt.S and DKWEDGE_METHOD_GPT only look in the
} primary.  Align the bootxx/boot2 biosdisk code with this so as to avoid
} situations where the disk becomes unbootable when it has an undestroyed
} secondary GPT.

 Wouldn't it have been better to go the opposite way and have
everything check for a secondary GPT?  Now, a disk becomes unbootable
if only the primary GPT is damaged, making the backup semi-pointless.

}-- End of excerpt from Jonathan A. Kollasch


Re: CVS commit: src/sys/arch/i386/stand/lib

2014-04-08 Thread Joerg Sonnenberger
On Tue, Apr 08, 2014 at 11:34:18AM -0400, Christos Zoulas wrote:
 Module Name:  src
 Committed By: christos
 Date: Tue Apr  8 15:34:18 UTC 2014
 
 Modified Files:
   src/sys/arch/i386/stand/lib: Makefile
 
 Log Message:
 make this more attractive (to me).

Except it is wrong. The choice of ACTIVE_CC has not been finalised
at this point.

Joerg


Re: CVS commit: src/sys/arch/i386/stand/lib

2014-04-08 Thread Christos Zoulas
In article 20140408184900.ga2...@britannica.bec.de,
Joerg Sonnenberger  jo...@britannica.bec.de wrote:
On Tue, Apr 08, 2014 at 11:34:18AM -0400, Christos Zoulas wrote:
 Module Name: src
 Committed By:christos
 Date:Tue Apr  8 15:34:18 UTC 2014
 
 Modified Files:
  src/sys/arch/i386/stand/lib: Makefile
 
 Log Message:
 make this more attractive (to me).

Except it is wrong. The choice of ACTIVE_CC has not been finalised
at this point.

Depending on the time of evaluation of certain variables in make keeps
biting us. We need to come up with something better. Why can't ACTIVE_CC
be set earlier?

christos



Re: CVS commit: src/sys/arch/i386/stand/lib

2014-04-07 Thread Joerg Sonnenberger
On Mon, Apr 07, 2014 at 05:09:55PM -0400, Christos Zoulas wrote:
 Module Name:  src
 Committed By: christos
 Date: Mon Apr  7 21:09:55 UTC 2014
 
 Modified Files:
   src/sys/arch/i386/stand/lib: Makefile
 
 Log Message:
 XXX: gcc-4.8 bug. Passes wrong arguments to biosdisk_read(). Turn optimization
 off.

Please only apply this to GCC...

Joerg


Re: CVS commit: src/sys/arch/i386/stand/lib

2014-04-07 Thread Christos Zoulas
In article 20140407234749.ga19...@britannica.bec.de,
Joerg Sonnenberger  jo...@britannica.bec.de wrote:
On Mon, Apr 07, 2014 at 05:09:55PM -0400, Christos Zoulas wrote:
 Module Name: src
 Committed By:christos
 Date:Mon Apr  7 21:09:55 UTC 2014
 
 Modified Files:
  src/sys/arch/i386/stand/lib: Makefile
 
 Log Message:
 XXX: gcc-4.8 bug. Passes wrong arguments to biosdisk_read(). Turn 
 optimization
 off.

Please only apply this to GCC...

I didn't? 

christos



Re: CVS commit: src/sys/arch/i386/stand/lib

2010-12-24 Thread Christos Zoulas
In article 20101224203651.e3c4117...@cvs.netbsd.org,
Jonathan A. Kollasch source-changes-d@NetBSD.org wrote:
-=-=-=-=-=-

Module Name:   src
Committed By:  jakllsch
Date:  Fri Dec 24 20:36:51 UTC 2010

Modified Files:
   src/sys/arch/i386/stand/lib: biosdisk.c biosdisk.h biosdisk_ll.c

Log Message:
Sprinkle daddr_t.
Adjust DISK_DEBUG printf formats to match.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/i386/stand/lib/biosdisk.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/lib/biosdisk.h
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/stand/lib/biosdisk_ll.c

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

@@ -178,7 +178,7 @@
   lp = (struct disklabel *) (d-buf + LABELOFFSET);
   if (lp-d_magic != DISKMAGIC || dkcksum(lp)) {
 #ifdef DISK_DEBUG
-  printf(warning: no disklabel in sector %u\n, sector);
+  printf(warning: no disklabel in sector %lld\n, sector);
 #endif

Are you sure this is right? My guess is that you would need PRId64
instead of lld.

christos



Re: CVS commit: src/sys/arch/i386/stand/lib

2010-12-24 Thread Jonathan A. Kollasch
On Fri, Dec 24, 2010 at 11:00:40PM +, Christos Zoulas wrote:
 In article 20101224203651.e3c4117...@cvs.netbsd.org,
 Jonathan A. Kollasch source-changes-d@NetBSD.org wrote:
 -=-=-=-=-=-
 
 Module Name: src
 Committed By:jakllsch
 Date:Fri Dec 24 20:36:51 UTC 2010
 
 Modified Files:
  src/sys/arch/i386/stand/lib: biosdisk.c biosdisk.h biosdisk_ll.c
 
 Log Message:
 Sprinkle daddr_t.
 Adjust DISK_DEBUG printf formats to match.
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.31 -r1.32 src/sys/arch/i386/stand/lib/biosdisk.c
 cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/lib/biosdisk.h
 cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/stand/lib/biosdisk_ll.c
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 
 @@ -178,7 +178,7 @@
  lp = (struct disklabel *) (d-buf + LABELOFFSET);
  if (lp-d_magic != DISKMAGIC || dkcksum(lp)) {
  #ifdef DISK_DEBUG
 -printf(warning: no disklabel in sector %u\n, sector);
 +printf(warning: no disklabel in sector %lld\n, sector);
  #endif
 
 Are you sure this is right? My guess is that you would need PRId64
 instead of lld.
 

Well, maybe.  But I expect int64_t will always be long long on i386.


Re: CVS commit: src/sys/arch/i386/stand/lib

2010-12-24 Thread Izumi Tsutsui
 Log Message:
 Sprinkle daddr_t.
 Adjust DISK_DEBUG printf formats to match.
 :
 -printf(warning: no disklabel in sector %u\n, sector);
 +printf(warning: no disklabel in sector %lld\n, sector);
  #endif
 
 Are you sure this is right? My guess is that you would need PRId64
 instead of lld.

libsa's printf(3) doesn't support %lld unless
-DLIBSA_PRINTF_LONGLONG_SUPPORT is specified.

---
Izumi Tsutsui


Re: CVS commit: src/sys/arch/i386/stand/lib

2010-12-24 Thread Christos Zoulas
On Dec 24, 11:05pm, jakll...@kollasch.net (Jonathan A. Kollasch) wrote:
-- Subject: Re: CVS commit: src/sys/arch/i386/stand/lib

|  Are you sure this is right? My guess is that you would need PRId64
|  instead of lld.
| 
| Well, maybe.  But I expect int64_t will always be long long on i386.

Isn't this code shared with amd64? Anyway PRId64 is more correct and
works in all cases.

christos


Re: CVS commit: src/sys/arch/i386/stand/lib

2010-12-24 Thread Jonathan A. Kollasch
On Fri, Dec 24, 2010 at 06:14:13PM -0500, Christos Zoulas wrote:
 On Dec 24, 11:05pm, jakll...@kollasch.net (Jonathan A. Kollasch) wrote:
 -- Subject: Re: CVS commit: src/sys/arch/i386/stand/lib
 
 |  Are you sure this is right? My guess is that you would need PRId64
 |  instead of lld.
 | 
 | Well, maybe.  But I expect int64_t will always be long long on i386.
 
 Isn't this code shared with amd64? Anyway PRId64 is more correct and
 works in all cases.

It is shared, in the sense that i386 stand code is built as part of
the amd64 build.  The kernel is responsible for the transition to Long
Mode.

Anyway, point taken...


Re: CVS commit: src/sys/arch/i386/stand/lib

2010-12-24 Thread Jonathan A. Kollasch
On Sat, Dec 25, 2010 at 08:07:50AM +0900, Izumi Tsutsui wrote:
  Log Message:
  Sprinkle daddr_t.
  Adjust DISK_DEBUG printf formats to match.
  :
  -  printf(warning: no disklabel in sector %u\n, sector);
  +  printf(warning: no disklabel in sector %lld\n, sector);
   #endif
  
  Are you sure this is right? My guess is that you would need PRId64
  instead of lld.
 
 libsa's printf(3) doesn't support %lld unless
 -DLIBSA_PRINTF_LONGLONG_SUPPORT is specified.

True, that but it's not like this code path is often compiled.
I should probably at least add the necessary gunk commented out
in the makefile.


Re: CVS commit: src/sys/arch/i386/stand/lib

2010-12-24 Thread Jonathan A. Kollasch
On Sat, Dec 25, 2010 at 12:09:43AM +, Jonathan A. Kollasch wrote:
 On Sat, Dec 25, 2010 at 08:07:50AM +0900, Izumi Tsutsui wrote:
   Log Message:
   Sprinkle daddr_t.
   Adjust DISK_DEBUG printf formats to match.
   :
   -printf(warning: no disklabel in sector %u\n, sector);
   +printf(warning: no disklabel in sector %lld\n, 
   sector);
#endif
   
   Are you sure this is right? My guess is that you would need PRId64
   instead of lld.
  
  libsa's printf(3) doesn't support %lld unless
  -DLIBSA_PRINTF_LONGLONG_SUPPORT is specified.
 
 True, that but it's not like this code path is often compiled.
 I should probably at least add the necessary gunk commented out
 in the makefile.

That has the problem that I can't find a nice way to enable
64-bit division runtime support in the amd64 libkern compiled
for i386.


Re: CVS commit: src/sys/arch/i386/stand/lib

2010-12-24 Thread Christos Zoulas
On Dec 25, 12:06am, jakll...@kollasch.net (Jonathan A. Kollasch) wrote:
-- Subject: Re: CVS commit: src/sys/arch/i386/stand/lib

| On Fri, Dec 24, 2010 at 06:14:13PM -0500, Christos Zoulas wrote:
|  On Dec 24, 11:05pm, jakll...@kollasch.net (Jonathan A. Kollasch) wrote:
|  -- Subject: Re: CVS commit: src/sys/arch/i386/stand/lib
|  
|  |  Are you sure this is right? My guess is that you would need PRId64
|  |  instead of lld.
|  | 
|  | Well, maybe.  But I expect int64_t will always be long long on i386.
|  
|  Isn't this code shared with amd64? Anyway PRId64 is more correct and
|  works in all cases.
| 
| It is shared, in the sense that i386 stand code is built as part of
| the amd64 build.  The kernel is responsible for the transition to Long
| Mode.
| 
| Anyway, point taken...

Yes and because all the code is compiled with -m32 %ll will always work
for int64_t because it is going to be long long. Strictly speaking this
is about writing correct code, so always print int64_t with PRId64.

christos


Re: CVS commit: src/sys/arch/i386/stand/lib

2010-12-24 Thread David Laight
On Sat, Dec 25, 2010 at 01:27:43AM +, Jonathan A. Kollasch wrote:
   
   libsa's printf(3) doesn't support %lld unless
   -DLIBSA_PRINTF_LONGLONG_SUPPORT is specified.
  
  True, that but it's not like this code path is often compiled.
  I should probably at least add the necessary gunk commented out
  in the makefile.
 
 That has the problem that I can't find a nice way to enable
 64-bit division runtime support in the amd64 libkern compiled
 for i386.

It is fairly easy to write the printf code so that it can convert
long long to decimal without requiring the 64bit division code
(or any division code!).
(Similarly you can avoid the double-word shifts for %x.)

David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/sys/arch/i386/stand/lib

2010-12-19 Thread David Laight
On Sun, Dec 19, 2010 at 05:18:23PM +, Jonathan A. Kollasch wrote:
 Module Name:  src
 Committed By: jakllsch
 Date: Sun Dec 19 17:18:23 UTC 2010
 
 Modified Files:
   src/sys/arch/i386/stand/lib: realprot.S
 
 Log Message:
 Compute real/protected %sp/%esp offset in 'gdt_fixup' using all 32-bits.
 Allows the case of %ss being less than %cs to work.
 Also, completely save and restore the general-purpose registers we use.

It ought to be possible to initialise the gdt (etc) as compile time.
The addresses are always fixed.

David

-- 
David Laight: da...@l8s.co.uk