CVS commit: src/sys/arch/i386/stand/lib
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
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
Module Name:src Committed By: manu Date: Thu Sep 28 15:50:24 UTC 2023 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c src/sys/rump/librump/rumpkern: emul.c Log Message: Fix root search in RAID 1 sets We use the wedge information given by bootstrap, where the kernel was found. This requires src/sys/arch/i386/stand/i386/lib/biosdisk.c 1.59 to work in all cases. To generate a diff of this commit: cvs rdiff -u -r1.415 -r1.416 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.199 -r1.200 src/sys/rump/librump/rumpkern/emul.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/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.415 src/sys/dev/raidframe/rf_netbsdkintf.c:1.416 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.415 Mon Sep 25 21:59:38 2023 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Thu Sep 28 15:50:23 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.415 2023/09/25 21:59:38 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.416 2023/09/28 15:50:23 manu Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.415 2023/09/25 21:59:38 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.416 2023/09/28 15:50:23 manu Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -157,6 +157,8 @@ int rf_kdebug_level = 0; #define db1_printf(a) { } #endif/* DEBUG */ +#define DEVICE_XNAME(dev) dev ? device_xname(dev) : "null" + #if (RF_INCLUDE_PARITY_DECLUSTERING_DS > 0) static rf_declare_mutex2(rf_sparet_wait_mutex); static rf_declare_cond2(rf_sparet_wait_cv); @@ -522,6 +524,134 @@ rf_rescan(void) return 0; } +/* + * Example setup: + * dk1 at wd0: "raid@wd0", 171965 blocks at 32802, type: raidframe + * dk3 at wd1: "raid@wd1", 171965 blocks at 32802, type: raidframz + * raid1: Components: /dev/dk1 /dev/dk3 + * dk4 at raid1: "empty@raid1", 8192 blocks at 34, type: msdos + * dk5 at raid1: "root@raid1", 163517 blocks at 8226, type: ffs + * + * If booted from wd0, booted_device will be + * disk wd0, startblk = 41092, nblks = 163517 + * + * That is, dk5 with startblk computed from the beginning of wd0 + * instead of beginning of raid1: + * 32802 + 64 (RF_PROTECTED_SECTORS) + 8226 = 41092 + * + * In order to find the boot wedge, we must iterate on each component, + * find its offset from disk beginning, abd look for the boot wedge with + * startblck adjusted. + */ +static device_t +rf_find_bootwedge(struct raid_softc *rsc) +{ + RF_Raid_t *r = >sc_r; + const char *bootname; + size_t len; + device_t rdev = NULL; + + if (booted_device == NULL) + goto out; + + bootname = device_xname(booted_device); + len = strlen(bootname); + + aprint_debug("%s: booted_device %s, startblk = %"PRId64", " + "nblks = %"PRId64"\n", __func__, + bootname, booted_startblk, booted_nblks); + + for (int col = 0; col < r->numCol; col++) { + const char *devname = r->Disks[col].devname; + const char *parent; + struct disk *dk; + u_int nwedges; + struct dkwedge_info *dkwi; + struct dkwedge_list dkwl; + size_t dkwi_len; + int i; + + devname += sizeof("/dev/") - 1; + if (strncmp(devname, "dk", 2) != 0) + continue; + + parent = dkwedge_get_parent_name(r->Disks[col].dev); + if (parent == NULL) { + aprint_debug("%s: cannot find parent for " + "component /dev/%s", __func__, devname); + continue; + } + + if (strncmp(parent, bootname, len) != 0) + continue; + + aprint_debug("%s: looking up wedge %s in device %s\n", + __func__, devname, parent); + + dk = disk_find(parent); + nwedges = dk->dk_nwedges; + dkwi_len = sizeof(*dkwi) * nwedges; + dkwi = RF_Malloc(dkwi_len); + + dkwl.dkwl_buf = dkwi; + dkwl.dkwl_bufsize = dkwi_len; + dkwl.dkwl_nwedges = 0; + dkwl.dkwl_ncopied = 0; + + if (dkwedge_list(dk, , curlwp) == 0) { + daddr_t startblk; + + for (i = 0; i < dkwl.dkwl_ncopied; i++) { +if (strcmp(dkwi[i].dkw_devname, devname) == 0) + break; + } + + KASSERT(i < dkwl.dkwl_ncopied); + + aprint_debug("%s: wedge %s, " + "startblk = %"PRId64", " + "nblks = %"PRId64"\n", + __func__, + dkwi[i].dkw_devname, + dkwi[i].dkw_offset, + dkwi[i].dkw_size); + + startblk = booted_startblk + - dkwi[i].dkw_offset + - RF_PROTECTED_SECTORS; + + aprint_debug("%s: looking for wedge in %s, " + "startblk = %"PRId64", " + "nblks = %"PRId64"\n", + __func__, + DEVICE_XNAME(rsc->sc_dksc.sc_dev), + startblk, booted_nblks); + + rdev = dkwedge_find_partition(rsc->sc_dksc.sc_dev, + startblk, + booted_nblks); + if (rdev) { +aprint_debug("%s: root candidate wedge %s " + "shifted from %s\n",
CVS commit: src/sys
Module Name:src Committed By: manu Date: Thu Sep 28 15:50:24 UTC 2023 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c src/sys/rump/librump/rumpkern: emul.c Log Message: Fix root search in RAID 1 sets We use the wedge information given by bootstrap, where the kernel was found. This requires src/sys/arch/i386/stand/i386/lib/biosdisk.c 1.59 to work in all cases. To generate a diff of this commit: cvs rdiff -u -r1.415 -r1.416 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.199 -r1.200 src/sys/rump/librump/rumpkern/emul.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
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
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/dev/usb
Module Name:src Committed By: manu Date: Fri Aug 4 13:25:18 UTC 2023 Modified Files: src/sys/dev/usb: umodeswitch.c Log Message: Add support for D-Link DWM-222 4G LTS USB adapter Oddly, the fake umass device does not detach after umodeswitch does its duty, but functionality is there, thanks to five u3g devices that attach. u3g devices 0, 3 and 4 does not seem to accept AT commands. u3g devices 1 and 2 are fine to be used as modems. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/umodeswitch.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/dev/usb/umodeswitch.c diff -u src/sys/dev/usb/umodeswitch.c:1.5 src/sys/dev/usb/umodeswitch.c:1.6 --- src/sys/dev/usb/umodeswitch.c:1.5 Sat Feb 15 02:14:02 2020 +++ src/sys/dev/usb/umodeswitch.c Fri Aug 4 13:25:17 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: umodeswitch.c,v 1.5 2020/02/15 02:14:02 manu Exp $ */ +/* $NetBSD: umodeswitch.c,v 1.6 2023/08/04 13:25:17 manu Exp $ */ /*- * Copyright (c) 2009, 2017 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: umodeswitch.c,v 1.5 2020/02/15 02:14:02 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: umodeswitch.c,v 1.6 2023/08/04 13:25:17 manu Exp $"); #include #include @@ -440,6 +440,7 @@ umodeswitch_match(device_t parent, cfdat switch (uaa->uaa_product) { case USB_PRODUCT_DLINK_DWM157E_CD: case USB_PRODUCT_DLINK_DWM157_CD: + case USB_PRODUCT_DLINK_DWM222_CD: (void)u3g_bulk_ata_eject(uaa->uaa_device); (void)u3g_bulk_scsi_eject(uaa->uaa_device); return UMATCH_HIGHEST;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: manu Date: Fri Aug 4 13:25:18 UTC 2023 Modified Files: src/sys/dev/usb: umodeswitch.c Log Message: Add support for D-Link DWM-222 4G LTS USB adapter Oddly, the fake umass device does not detach after umodeswitch does its duty, but functionality is there, thanks to five u3g devices that attach. u3g devices 0, 3 and 4 does not seem to accept AT commands. u3g devices 1 and 2 are fine to be used as modems. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/umodeswitch.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/bootxx
On Thu, Jun 29, 2023 at 08:43:36PM -0400, Greg Troxel wrote: > > Primary bootstrap is now able to read a GPT inside RAIDframe. > did you also update documentation? We do not have any documentation specific to primary bootstrap. x86/boot(8) domuent the behavior with no detail about primary and secondary bootstrap distinct roles. The change makes primary bootstrap behavior in line with secondary bootstrap and with what is already documented in x86/boot(8). Hence there is no documentation update, we could consider it as a bug fix, since the previosu behavior did not match x86/boot(8) documentation. -- Emmanuel Dreyfus m...@netbsd.org
CVS commit: src/sys/arch/i386/stand/bootxx
Module Name:src Committed By: manu Date: Thu Jun 29 14:18:58 UTC 2023 Modified Files: src/sys/arch/i386/stand/bootxx: boot1.c Log Message: Primary bootstrap is now able to read a GPT inside RAIDframe. Previously, primary bootstrap was able to boot on RAID-1 RAIDframe set with the limitation that the FFS filesystem had to start at bloc 0 in the RAID. That allowed inner RAID partitionning with a disklabel, but not with a GPT. When booting on a RAID-1 RAIDframe, primary bootstrap now first try a filesystem at bloc 0 of the RAID as before. On failure, it tries to read a GPT and load secondary bootstrap from, by priority; 1) the first partition with the bootme attribute set 2) the first partition of type FFS, LFS, CCD or CGD 3) the first partition present in the GPT To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/bootxx/boot1.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/bootxx/boot1.c diff -u src/sys/arch/i386/stand/bootxx/boot1.c:1.21 src/sys/arch/i386/stand/bootxx/boot1.c:1.22 --- src/sys/arch/i386/stand/bootxx/boot1.c:1.21 Thu Jun 24 01:23:16 2021 +++ src/sys/arch/i386/stand/bootxx/boot1.c Thu Jun 29 14:18:58 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: boot1.c,v 1.21 2021/06/24 01:23:16 gutteridge Exp $ */ +/* $NetBSD: boot1.c,v 1.22 2023/06/29 14:18:58 manu Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -30,15 +30,17 @@ */ #include -__RCSID("$NetBSD: boot1.c,v 1.21 2021/06/24 01:23:16 gutteridge Exp $"); +__RCSID("$NetBSD: boot1.c,v 1.22 2023/06/29 14:18:58 manu Exp $"); #include #include #include #include +#include #include #include +#include #include /* For RF_PROTECTED_SECTORS */ #define XSTR(x) #x @@ -49,6 +51,9 @@ static daddr_t bios_sector; static struct biosdisk_ll d; const char *boot1(uint32_t, uint64_t *); +#ifndef NO_GPT +static daddr_t gpt_lookup(daddr_t); +#endif extern void putstr(const char *); extern struct disklabel ptn_disklabel; @@ -90,6 +95,17 @@ boot1(uint32_t biosdev, uint64_t *sector fd = ob(); if (fd != -1) goto done; + +#ifndef NO_GPT + /* + * Test for a GPT inside the RAID + */ + bios_sector += gpt_lookup(bios_sector); + fd = ob(); + if (fd != -1) + goto done; +#endif + /* * Nothing at the start of the MBR partition, fallback on * partition 'a' from the disklabel in this MBR partition. @@ -144,3 +160,146 @@ blkdevstrategy(void *devdata, int flag, return 0; } + +#ifndef NO_GPT +static int +is_unused(struct gpt_ent *ent) +{ + const struct uuid unused = GPT_ENT_TYPE_UNUSED; + + return (memcmp(ent->ent_type, , sizeof(unused)) == 0); +} + +static int +is_bootable(struct gpt_ent *ent) +{ + /* GPT_ENT_TYPE_NETBSD_RAID omitted as we are already in a RAID */ + const struct uuid bootable[] = { + GPT_ENT_TYPE_NETBSD_FFS, + GPT_ENT_TYPE_NETBSD_LFS, + GPT_ENT_TYPE_NETBSD_CCD, + GPT_ENT_TYPE_NETBSD_CGD, + }; + int i; + + for (i = 0; i < sizeof(bootable) / sizeof(*bootable); i++) { + if (memcmp(ent->ent_type, [i], + sizeof(struct uuid)) == 0) + return 1; + } + + return 0; +} + +static daddr_t +gpt_lookup(daddr_t sector) +{ + char buf[BIOSDISK_DEFAULT_SECSIZE]; + struct mbr_sector *pmbr; + const char gpt_hdr_sig[] = GPT_HDR_SIG; + struct gpt_hdr *hdr; + struct gpt_ent *ent; + uint32_t nents; + uint32_t entsz; + uint32_t entries_per_sector; + uint32_t sectors_per_entry; + uint64_t firstpart_lba = 0; + uint64_t bootable_lba = 0; + uint64_t bootme_lba = 0; + int i, j; + + /* + * Look for a PMBR + */ + if (readsects(, sector, 1, buf, 1) != 0) + return 0; + + pmbr = (struct mbr_sector *)buf; + + if (pmbr->mbr_magic != htole16(MBR_MAGIC)) + return 0; + + if (pmbr->mbr_parts[0].mbrp_type != MBR_PTYPE_PMBR) + return 0; + + sector++; /* skip PMBR */ + + /* + * Look for a GPT header + * Space is scarce, we do not check CRC. + */ + if (readsects(, sector, 1, buf, 1) != 0) + return 0; + + hdr = (struct gpt_hdr *)buf; + + if (memcmp(gpt_hdr_sig, hdr->hdr_sig, sizeof(hdr->hdr_sig)) != 0) + return 0; + + if (hdr->hdr_revision != htole32(GPT_HDR_REVISION)) + return 0; + + if (le32toh(hdr->hdr_size) > BIOSDISK_DEFAULT_SECSIZE) + return 0; + + nents = le32toh(hdr->hdr_entries); + entsz = le32toh(hdr->hdr_entsz); + + sector++; /* skip GPT header */ + + /* + * Read partition table + * + * According to UEFI specification section 5.3.2, entries + * are 128 * (2^n) bytes long. The most common scenario is + * 128 bytes (n = 0) where there are 4 entries per sector. + * If n > 2, then entries spans multiple sectors, but they + * remain sector-aligned. + */ + entries_per_sector = BIOSDISK_DEFAULT_SECSIZE / entsz; + if (entries_per_sector == 0) + entries_per_sector = 1; + + sectors_per_entry = entsz / BIOSDISK_DEFAULT_SECSIZE; + if (sectors_per_entry == 0) + sectors_per_entry = 1; + + for (i = 0; i < nents; i += entries_per_sector) { +
CVS commit: src/sys/arch/i386/stand/bootxx
Module Name:src Committed By: manu Date: Thu Jun 29 14:18:58 UTC 2023 Modified Files: src/sys/arch/i386/stand/bootxx: boot1.c Log Message: Primary bootstrap is now able to read a GPT inside RAIDframe. Previously, primary bootstrap was able to boot on RAID-1 RAIDframe set with the limitation that the FFS filesystem had to start at bloc 0 in the RAID. That allowed inner RAID partitionning with a disklabel, but not with a GPT. When booting on a RAID-1 RAIDframe, primary bootstrap now first try a filesystem at bloc 0 of the RAID as before. On failure, it tries to read a GPT and load secondary bootstrap from, by priority; 1) the first partition with the bootme attribute set 2) the first partition of type FFS, LFS, CCD or CGD 3) the first partition present in the GPT To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/bootxx/boot1.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/efiboot
Module Name:src Committed By: manu Date: Wed May 10 00:49:17 UTC 2023 Modified Files: src/sys/arch/i386/stand/efiboot: version Log Message: Raise the version for new feature (here reloc command) Suggested by Masanobu SAITOH To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/version 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/efiboot/version diff -u src/sys/arch/i386/stand/efiboot/version:1.2 src/sys/arch/i386/stand/efiboot/version:1.3 --- src/sys/arch/i386/stand/efiboot/version:1.2 Sat Aug 3 08:13:36 2019 +++ src/sys/arch/i386/stand/efiboot/version Wed May 10 00:49:17 2023 @@ -1,4 +1,4 @@ -$NetBSD: version,v 1.2 2019/08/03 08:13:36 nonaka Exp $ +$NetBSD: version,v 1.3 2023/05/10 00:49:17 manu Exp $ NOTE ANY CHANGES YOU MAKE TO THE EFI BOOTLOADER HERE. The format of this file is important - make sure the entries are appended on end, last item @@ -6,3 +6,4 @@ is taken as the current. 1.0: Initial version. 1.1: Add CD/DVD-ROM, serial, PXE boot and UEFI memory map compaction support. +1.2: Add reloc command
CVS commit: src/sys/arch/i386/stand/efiboot
Module Name:src Committed By: manu Date: Wed May 10 00:49:17 UTC 2023 Modified Files: src/sys/arch/i386/stand/efiboot: version Log Message: Raise the version for new feature (here reloc command) Suggested by Masanobu SAITOH To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/version Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man8/man8.x86
Module Name:src Committed By: manu Date: Mon May 8 00:40:50 UTC 2023 Modified Files: src/share/man/man8/man8.x86: boot.8 Log Message: Remove XXX todo marker left by mistake To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/share/man/man8/man8.x86/boot.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man8/man8.x86/boot.8 diff -u src/share/man/man8/man8.x86/boot.8:1.28 src/share/man/man8/man8.x86/boot.8:1.29 --- src/share/man/man8/man8.x86/boot.8:1.28 Fri May 5 00:34:40 2023 +++ src/share/man/man8/man8.x86/boot.8 Mon May 8 00:40:50 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: boot.8,v 1.28 2023/05/05 00:34:40 manu Exp $ +.\" $NetBSD: boot.8,v 1.29 2023/05/08 00:40:50 manu Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -701,7 +701,7 @@ and may impact system security. Pass an explicit root specification to the kernel. See BTINFO_ROOTDEVICE for details. .It Ic splash Ar file -[Only available for BIOS and UEFI boot] XXX document +[Only available for BIOS and UEFI boot] Load a graphical image from the specified .Ar file and request the kernel to use it as a splash screen.
CVS commit: src/share/man/man8/man8.x86
Module Name:src Committed By: manu Date: Mon May 8 00:40:50 UTC 2023 Modified Files: src/share/man/man8/man8.x86: boot.8 Log Message: Remove XXX todo marker left by mistake To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/share/man/man8/man8.x86/boot.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: manu Date: Fri May 5 00:34:41 UTC 2023 Modified Files: src/share/man/man4: options.4 src/share/man/man8/man8.x86: boot.8 src/sys/arch/amd64/amd64: locore.S src/sys/arch/amd64/conf: files.amd64 std.amd64 Log Message: Add a SELFRELOC kernel option for the sake of documentation clarity. Instead of telling that x86/boot(8) reloc command needs a kernel able to self relocate, we can tell it needs a kernel built with the SELFRELOC option. This keeps the reader from wondering what could make a kernel able to self relocate. To generate a diff of this commit: cvs rdiff -u -r1.523 -r1.524 src/share/man/man4/options.4 cvs rdiff -u -r1.27 -r1.28 src/share/man/man8/man8.x86/boot.8 cvs rdiff -u -r1.219 -r1.220 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.120 -r1.121 src/sys/arch/amd64/conf/files.amd64 cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/conf/std.amd64 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: manu Date: Fri May 5 00:34:41 UTC 2023 Modified Files: src/share/man/man4: options.4 src/share/man/man8/man8.x86: boot.8 src/sys/arch/amd64/amd64: locore.S src/sys/arch/amd64/conf: files.amd64 std.amd64 Log Message: Add a SELFRELOC kernel option for the sake of documentation clarity. Instead of telling that x86/boot(8) reloc command needs a kernel able to self relocate, we can tell it needs a kernel built with the SELFRELOC option. This keeps the reader from wondering what could make a kernel able to self relocate. To generate a diff of this commit: cvs rdiff -u -r1.523 -r1.524 src/share/man/man4/options.4 cvs rdiff -u -r1.27 -r1.28 src/share/man/man8/man8.x86/boot.8 cvs rdiff -u -r1.219 -r1.220 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.120 -r1.121 src/sys/arch/amd64/conf/files.amd64 cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/conf/std.amd64 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/options.4 diff -u src/share/man/man4/options.4:1.523 src/share/man/man4/options.4:1.524 --- src/share/man/man4/options.4:1.523 Sun Aug 28 14:29:05 2022 +++ src/share/man/man4/options.4 Fri May 5 00:34:41 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: options.4,v 1.523 2022/08/28 14:29:05 riastradh Exp $ +.\" $NetBSD: options.4,v 1.524 2023/05/05 00:34:41 manu Exp $ .\" .\" Copyright (c) 1996 .\" Perry E. Metzger. All rights reserved. @@ -1307,6 +1307,14 @@ See and .Xr vnconfig 8 for more information. +.It Cd options SELFRELOC +Make the kernel able to self relocate at bootstrap, so that it can +run whatever its load address is. +This is intented to be used withe the +.Ic reloc +boostrap command documented in +.Xr x86/boot 8 , +to workaround UEFI bugs, and is only available on amd64. .It Cd options SPLDEBUG Help the kernel programmer find bugs related to the interrupt priority level. Index: src/share/man/man8/man8.x86/boot.8 diff -u src/share/man/man8/man8.x86/boot.8:1.27 src/share/man/man8/man8.x86/boot.8:1.28 --- src/share/man/man8/man8.x86/boot.8:1.27 Mon Apr 24 13:55:45 2023 +++ src/share/man/man8/man8.x86/boot.8 Fri May 5 00:34:40 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: boot.8,v 1.27 2023/04/24 13:55:45 manu Exp $ +.\" $NetBSD: boot.8,v 1.28 2023/05/05 00:34:40 manu Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -655,8 +655,10 @@ Reboot the system. .It Ic reloc Op Va default No \(or Va none No \(or Va address [Only UEFI boot] Sets where the kernel is copied by bootstrap before it is started. Values other than default require a kernel -that can relocate itself at the right address, otherwise a crash -occurs at boot time. +built with the +.Cd SELFRELOC +option, so that can relocate itself at the right address, +otherwise a crash occurs at boot time. .Bl -tag -width default .It Va default Copy the kernel at ELF header load address, this is the historical Index: src/sys/arch/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.219 src/sys/arch/amd64/amd64/locore.S:1.220 --- src/sys/arch/amd64/amd64/locore.S:1.219 Thu Apr 20 00:42:23 2023 +++ src/sys/arch/amd64/amd64/locore.S Fri May 5 00:34:41 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.219 2023/04/20 00:42:23 manu Exp $ */ +/* $NetBSD: locore.S,v 1.220 2023/05/05 00:34:41 manu Exp $ */ /* * Copyright-o-rama! @@ -156,6 +156,7 @@ #include "opt_ddbparam.h" #include "opt_modular.h" #include "opt_realmem.h" +#include "opt_selfreloc.h" #include "opt_compat_netbsd.h" #include "opt_compat_netbsd32.h" @@ -456,6 +457,7 @@ ENTRY(start) #ifndef XENPV .code32 +#ifdef SELFRELOC call next next: pop %edi sub $(next - kernel_text), %edi @@ -463,6 +465,7 @@ next: pop %edi /* If not KERNBASE, reloc ourselves to KERNBASE */ cmpl $(KERNTEXTOFF_LO - KERNBASE_LO), %edi jne selfreloc_start +#endif /* SELFRELOC */ /* Warm boot */ movw $0x1234,0x472 @@ -1766,6 +1769,7 @@ LABEL(nomds_leave) NOMDS_LEAVE LABEL(nomds_leave_end) +#ifdef SELFRELOC /* * selfreloc(loadddr edi) * This is adapted from sys/arch/i386/i386/locore.S @@ -1900,3 +1904,4 @@ gdtr: gdtrr: .quad END(selfreloc_start) +#endif /* SELFRELOC */ Index: src/sys/arch/amd64/conf/files.amd64 diff -u src/sys/arch/amd64/conf/files.amd64:1.120 src/sys/arch/amd64/conf/files.amd64:1.121 --- src/sys/arch/amd64/conf/files.amd64:1.120 Wed Oct 21 13:31:51 2020 +++ src/sys/arch/amd64/conf/files.amd64 Fri May 5 00:34:41 2023 @@ -1,4 +1,4 @@ -# $NetBSD: files.amd64,v 1.120 2020/10/21 13:31:51 christos Exp $ +# $NetBSD: files.amd64,v 1.121 2023/05/05 00:34:41 manu Exp $ # # new style config file for amd64 architecture # @@ -20,6 +20,9 @@ defparam opt_physmem.h PHYSMEM_MAX_ADDR # Enable GCC spectre V2 mitigation options defflag opt_spectre.h SPECTRE_V2_GCC_MITIGATION +# Enable kernel self-relocation at
CVS commit: src/share/man/man8/man8.x86
Module Name:src Committed By: manu Date: Mon Apr 24 13:55:45 UTC 2023 Modified Files: src/share/man/man8/man8.x86: boot.8 dosboot.8 pxeboot.8 Log Message: Merge x86 boot options in x86/boot(8) and add undocumented UEFI options We were supposed to keep the option list in x86/boot(8), x86/dosoot(8) and x86/pxeboot(8) in sync, but it did not happen, hence it may work better with all the options in x86/boot(8). Also add the undocumented UEFI boot options. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/share/man/man8/man8.x86/boot.8 cvs rdiff -u -r1.3 -r1.4 src/share/man/man8/man8.x86/dosboot.8 cvs rdiff -u -r1.5 -r1.6 src/share/man/man8/man8.x86/pxeboot.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man8/man8.x86/boot.8 diff -u src/share/man/man8/man8.x86/boot.8:1.26 src/share/man/man8/man8.x86/boot.8:1.27 --- src/share/man/man8/man8.x86/boot.8:1.26 Tue Jun 22 03:39:21 2021 +++ src/share/man/man8/man8.x86/boot.8 Mon Apr 24 13:55:45 2023 @@ -1,4 +1,4 @@ -.\" $NetBSD: boot.8,v 1.26 2021/06/22 03:39:21 gutteridge Exp $ +.\" $NetBSD: boot.8,v 1.27 2023/04/24 13:55:45 manu Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -364,6 +364,8 @@ flag in Boot the system in silent mode. .El .It Ic consdev Ar dev\| Ns Oo Ns Ic \&, Ns Ar speed Oc +[Not available for +.Xr x86/dosboot 8 ] Immediately switch the console to the specified device .Ar dev and reprint the banner. @@ -397,16 +399,26 @@ Without an argument, print the current s .Ar device is of the form specified in .Ic boot . +.It Ic devpath +[Only available for UEFI boot] Dump UEFI device paths. +.It Ic efivar +[Only available for UEFI boot] Dump UEFI environment variables from NVRAM. .It Ic fs Ar file +[Only available for BIOS and UEFI boot] Load a file system image from the specified .Ar file , and request the kernel to use it as the root file system. The .Xr makefs 8 utility may be used to create suitable file system images. +.It Ic gop Op Va mode_index +[Only available for UEFI boot] Without argument, list the available +video modes. If an argument is given, select a video mode. .It Ic help Print an overview about commands and arguments. .It Ic load Ar module Op Ar arguments +[Not available for +.Xr x86/dosboot 8 ] Load the specified kernel .Ar module , and pass it the specified @@ -520,12 +532,17 @@ See .Xr pciback 4 . .El .It Ic ls Op Ar path +[Not available for +.Xr x86/pxeboot 8 ] Print a directory listing of .Ar path , containing inode number, filename, and file type. .Ar path can contain a device specification. +.It Ic memmap +[Only available for UEFI boot] Dump UEFI memory map. .It Ic menu +[Only available for BIOS and UEFI boot] Display the boot menu and initiate a countdown, similarly to what would have happened if interactive mode had not been entered. @@ -534,6 +551,8 @@ had not been entered. No \(or Li enabled \ No \(or Li disabled\^ \ Brc +[Not available for +.Xr x86/dosboot 8 ] The values .Ql enabled , .Ql on @@ -545,7 +564,18 @@ whereas .Ql disabled , .Ql off will turn off the feature. +.It Ic mode Va fstype +[Only available for +.Xr x86/dosboot 8 ] +Switch file system type; +.Va fstype +should be one of +.Ar dos +or +.Ar ufs . .It Ic multiboot Ar kernel Op Ar arguments +[Not available for +.Xr x86/dosboot 8 ] Boot the specified .Ar kernel , using the @@ -615,12 +645,30 @@ command. See the foreign operating system's documentation for the available .Ar arguments . .El +.It Ic pkboot +[Only available for BIOS and UEFI boot] Boot a kernel that has +the +.Cd KASLR +option set, for Kernel Address Space Layout Randomizaton. .It Ic quit Reboot the system. -.It Ic root Ar spec -Pass an explicit root specification to the kernel. -See BTINFO_ROOTDEVICE for details. +.It Ic reloc Op Va default No \(or Va none No \(or Va address +[Only UEFI boot] Sets where the kernel is copied by bootstrap +before it is started. Values other than default require a kernel +that can relocate itself at the right address, otherwise a crash +occurs at boot time. +.Bl -tag -width default +.It Va default +Copy the kernel at ELF header load address, this is the historical +behavior. +.It Va none +Leave the kernel where it was loaded and start it as is. +.It Va address +Copy the kernel at given +.Va address . +.El .It Ic rndseed Ar file +[Only available for BIOS and UEFI boot] Load the specified .Ar file and request the kernel to use it as a seed for the @@ -646,16 +694,12 @@ Using the same seed file on more then on or for more than one boot on the same host, will reduce the quality of random numbers and may impact system security. -.It Ic userconf Ar command -Pass command -.Ar command -to -.Xr userconf 4 -at boot time. -These commands are processed before the interactive
CVS commit: src/share/man/man8/man8.x86
Module Name:src Committed By: manu Date: Mon Apr 24 13:55:45 UTC 2023 Modified Files: src/share/man/man8/man8.x86: boot.8 dosboot.8 pxeboot.8 Log Message: Merge x86 boot options in x86/boot(8) and add undocumented UEFI options We were supposed to keep the option list in x86/boot(8), x86/dosoot(8) and x86/pxeboot(8) in sync, but it did not happen, hence it may work better with all the options in x86/boot(8). Also add the undocumented UEFI boot options. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/share/man/man8/man8.x86/boot.8 cvs rdiff -u -r1.3 -r1.4 src/share/man/man8/man8.x86/dosboot.8 cvs rdiff -u -r1.5 -r1.6 src/share/man/man8/man8.x86/pxeboot.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch
Module Name:src Committed By: manu Date: Thu Apr 20 00:42:24 UTC 2023 Modified Files: src/sys/arch/amd64/amd64: locore.S src/sys/arch/i386/stand/efiboot: boot.c efiboot.c efiboot.h src/sys/arch/i386/stand/efiboot/bootia32: efibootia32.c startprog32.S src/sys/arch/i386/stand/efiboot/bootx64: efibootx64.c startprog64.S src/sys/arch/i386/stand/lib: exec.c Log Message: Add reloc keyworkd to let EFI bootstrap load amd64 kernel at any address EFI bootstrap assumes it can copy the amd64 kernel to its ELF load address (that is KERNTEXTOFF - KERNBASE = 0x20), but it can clash with previous UEFI memory allocation, as described here: http://mail-index.netbsd.org/tech-kern/2023/04/07/msg028833.html This change adds a reloc keyword for controling where the EFI boostrap will copy the kernel image. Possible values are: default - the default and prior behavior, copy at 0x20. none - do not copy and use the kernel image where it was loaded. address - specify an explicit address where to copy the kernel. This comes with an amd64 kernel patch that makes it self-relocatable. It first discover where it was loaded in memory, and if this is different than the expected 0x20, hhe the kernel relocates itself and start over at the right address. To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/efiboot/boot.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/efiboot.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/efiboot/efiboot.h cvs rdiff -u -r1.5 -r1.6 \ src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c cvs rdiff -u -r1.2 -r1.3 \ src/sys/arch/i386/stand/efiboot/bootia32/startprog32.S cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c cvs rdiff -u -r1.3 -r1.4 \ src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S cvs rdiff -u -r1.78 -r1.79 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/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.218 src/sys/arch/amd64/amd64/locore.S:1.219 --- src/sys/arch/amd64/amd64/locore.S:1.218 Fri Mar 3 14:32:48 2023 +++ src/sys/arch/amd64/amd64/locore.S Thu Apr 20 00:42:23 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.218 2023/03/03 14:32:48 riastradh Exp $ */ +/* $NetBSD: locore.S,v 1.219 2023/04/20 00:42:23 manu Exp $ */ /* * Copyright-o-rama! @@ -456,6 +456,14 @@ ENTRY(start) #ifndef XENPV .code32 + call next +next: pop %edi + sub $(next - kernel_text), %edi + + /* If not KERNBASE, reloc ourselves to KERNBASE */ + cmpl $(KERNTEXTOFF_LO - KERNBASE_LO), %edi + jne selfreloc_start + /* Warm boot */ movw $0x1234,0x472 @@ -1757,3 +1765,138 @@ LABEL(mds_leave_end) LABEL(nomds_leave) NOMDS_LEAVE LABEL(nomds_leave_end) + +/* + * selfreloc(loadddr edi) + * This is adapted from sys/arch/i386/i386/locore.S + */ + .code32 +ENTRY(selfreloc_start) + movl %edi, %ebx /* loadaddr saved in ebx */ + movl %edi, %esi/* src */ + movl $_RELOC(kernel_text), %edi /* dest */ + movl 16(%esp),%ecx/* esym */ + subl $_RELOC(kernel_text), %ecx /* size */ + +#if defined(NO_OVERLAP) +movl%ecx, %eax +#else +movl%edi, %eax +subl%esi, %eax +cmpl%ecx, %eax /* overlapping? */ +movl%ecx, %eax +jb .Lbackwards +#endif +/* nope, copy forwards. */ +shrl$2, %ecx/* copy by words */ +rep +movsl +and $3, %eax/* any bytes left? */ +jnz .Ltrailing +jmp .Lcopy_done + +.Ltrailing: +cmp $2, %eax +jb 11f +movw(%esi), %ax +movw%ax, (%edi) +je .Lcopy_done +movb2(%esi), %al +movb%al, 2(%edi) +jmp .Lcopy_done +11: movb(%esi), %al +movb%al, (%edi) +jmp .Lcopy_done + +#if !defined(NO_OVERLAP) +.Lbackwards: +addl%ecx, %edi /* copy backwards. */ +addl%ecx, %esi +and $3, %eax/* any fractional bytes? */ +jnz .Lback_align +.Lback_aligned: +shrl$2, %ecx +subl$4, %esi +subl$4, %edi +std +rep +movsl +cld +jmp .Lcopy_done + +.Lback_align: +sub %eax, %esi +sub %eax, %edi +cmp $2, %eax +jb 11f +je 12f +movb2(%esi), %al +movb%al, 2(%edi) +12: movw(%esi), %ax +movw%ax, (%edi) +jmp .Lback_aligned +11: movb(%esi), %al +movb%al, (%edi) +jmp .Lback_aligned +#endif +/* End of copy kernel */ +.Lcopy_done: + cld /* LynxOS depends on it */ + + /* load current selfreloc_start
CVS commit: src/sys/arch
Module Name:src Committed By: manu Date: Thu Apr 20 00:42:24 UTC 2023 Modified Files: src/sys/arch/amd64/amd64: locore.S src/sys/arch/i386/stand/efiboot: boot.c efiboot.c efiboot.h src/sys/arch/i386/stand/efiboot/bootia32: efibootia32.c startprog32.S src/sys/arch/i386/stand/efiboot/bootx64: efibootx64.c startprog64.S src/sys/arch/i386/stand/lib: exec.c Log Message: Add reloc keyworkd to let EFI bootstrap load amd64 kernel at any address EFI bootstrap assumes it can copy the amd64 kernel to its ELF load address (that is KERNTEXTOFF - KERNBASE = 0x20), but it can clash with previous UEFI memory allocation, as described here: http://mail-index.netbsd.org/tech-kern/2023/04/07/msg028833.html This change adds a reloc keyword for controling where the EFI boostrap will copy the kernel image. Possible values are: default - the default and prior behavior, copy at 0x20. none - do not copy and use the kernel image where it was loaded. address - specify an explicit address where to copy the kernel. This comes with an amd64 kernel patch that makes it self-relocatable. It first discover where it was loaded in memory, and if this is different than the expected 0x20, hhe the kernel relocates itself and start over at the right address. To generate a diff of this commit: cvs rdiff -u -r1.218 -r1.219 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.21 -r1.22 src/sys/arch/i386/stand/efiboot/boot.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/efiboot.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/efiboot/efiboot.h cvs rdiff -u -r1.5 -r1.6 \ src/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c cvs rdiff -u -r1.2 -r1.3 \ src/sys/arch/i386/stand/efiboot/bootia32/startprog32.S cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/efiboot/bootx64/efibootx64.c cvs rdiff -u -r1.3 -r1.4 \ src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S cvs rdiff -u -r1.78 -r1.79 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/dev/usb
Module Name:src Committed By: manu Date: Mon Feb 13 14:05:26 UTC 2023 Modified Files: src/sys/dev/usb: u3g.c Log Message: Add support for ZTE MF112 and D-Link DWM222 3G USB modems To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/usb/u3g.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: manu Date: Mon Feb 13 14:05:26 UTC 2023 Modified Files: src/sys/dev/usb: u3g.c Log Message: Add support for ZTE MF112 and D-Link DWM222 3G USB modems To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/usb/u3g.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/dev/usb/u3g.c diff -u src/sys/dev/usb/u3g.c:1.43 src/sys/dev/usb/u3g.c:1.44 --- src/sys/dev/usb/u3g.c:1.43 Sat Aug 7 16:19:17 2021 +++ src/sys/dev/usb/u3g.c Mon Feb 13 14:05:26 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: u3g.c,v 1.43 2021/08/07 16:19:17 thorpej Exp $ */ +/* $NetBSD: u3g.c,v 1.44 2023/02/13 14:05:26 manu Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.43 2021/08/07 16:19:17 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.44 2023/02/13 14:05:26 manu Exp $"); #include #include @@ -252,6 +252,7 @@ static const struct usb_devno u3g_devs[] { USB_VENDOR_ZTE, USB_PRODUCT_ZTE_MF626 }, { USB_VENDOR_ZTE, USB_PRODUCT_ZTE_MF628 }, { USB_VENDOR_ZTE, USB_PRODUCT_ZTE_MF820D }, + { USB_VENDOR_ZTE, USB_PRODUCT_ZTE_MF112 }, /* 4G Systems */ { USB_VENDOR_LONGCHEER, USB_PRODUCT_LONGCHEER_XSSTICK_P14 }, @@ -260,6 +261,7 @@ static const struct usb_devno u3g_devs[] /* DLink */ { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157 }, { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157E }, + { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM222 }, }; /*
CVS commit: src/sys/external/bsd/drm2
Module Name:src Committed By: manu Date: Sat May 28 01:07:47 UTC 2022 Modified Files: src/sys/external/bsd/drm2/dist/drm/radeon: radeon_bios.c radeon_drv.h src/sys/external/bsd/drm2/include/linux: acpi.h Log Message: Let radeon DRM driver build on ports that lack ACPI To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 \ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/include/linux/acpi.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/external/bsd/drm2/dist/drm/radeon/radeon_bios.c diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.11 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.12 --- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.11 Mon Feb 28 17:15:29 2022 +++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c Sat May 28 01:07:47 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: radeon_bios.c,v 1.11 2022/02/28 17:15:29 riastradh Exp $ */ +/* $NetBSD: radeon_bios.c,v 1.12 2022/05/28 01:07:47 manu Exp $ */ /* * Copyright 2008 Advanced Micro Devices, Inc. @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: radeon_bios.c,v 1.11 2022/02/28 17:15:29 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: radeon_bios.c,v 1.12 2022/05/28 01:07:47 manu Exp $"); #include #include @@ -41,7 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: radeon_bios. #include "radeon.h" #include "radeon_reg.h" -#ifdef __NetBSD__ +#if defined(__NetBSD__) && NACPICA > 0 #include #define _COMPONENT ACPI_DISPLAY_COMPONENT ACPI_MODULE_NAME("radeon_acpi") Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h:1.3 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h:1.4 --- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h:1.3 Sat Dec 18 23:45:43 2021 +++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h Sat May 28 01:07:47 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: radeon_drv.h,v 1.3 2021/12/18 23:45:43 riastradh Exp $ */ +/* $NetBSD: radeon_drv.h,v 1.4 2022/05/28 01:07:47 manu Exp $ */ /* radeon_drv.h -- Private header for radeon driver -*- linux-c -*- * @@ -33,6 +33,15 @@ #ifndef __RADEON_DRV_H__ #define __RADEON_DRV_H__ +#if defined(__NetBSD__) +#ifdef _KERNEL_OPT +#include "acpica.h" +#endif /* _KERNEL_OPT */ +#if (NACPICA > 0) +#define CONFIG_ACPI +#endif /* NACPICA > 0 */ +#endif /* __NetBSD__ */ + #include #include #include Index: src/sys/external/bsd/drm2/include/linux/acpi.h diff -u src/sys/external/bsd/drm2/include/linux/acpi.h:1.9 src/sys/external/bsd/drm2/include/linux/acpi.h:1.10 --- src/sys/external/bsd/drm2/include/linux/acpi.h:1.9 Sun Feb 27 14:22:50 2022 +++ src/sys/external/bsd/drm2/include/linux/acpi.h Sat May 28 01:07:47 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi.h,v 1.9 2022/02/27 14:22:50 riastradh Exp $ */ +/* $NetBSD: acpi.h,v 1.10 2022/05/28 01:07:47 manu Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -38,7 +38,6 @@ #if NACPICA > 0 #include -#endif #include #include @@ -58,4 +57,5 @@ union acpi_object *acpi_evaluate_dsm_typ uint64_t, uint64_t, union acpi_object *, acpi_object_type); bool acpi_check_dsm(acpi_handle, const guid_t *, uint64_t, uint64_t); +#endif /* NACPICA > 0 */ #endif /* _LINUX_ACPI_H_ */
CVS commit: src/sys/external/bsd/drm2
Module Name:src Committed By: manu Date: Sat May 28 01:07:47 UTC 2022 Modified Files: src/sys/external/bsd/drm2/dist/drm/radeon: radeon_bios.c radeon_drv.h src/sys/external/bsd/drm2/include/linux: acpi.h Log Message: Let radeon DRM driver build on ports that lack ACPI To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 \ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c cvs rdiff -u -r1.3 -r1.4 \ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_drv.h cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/include/linux/acpi.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/man/man4
Module Name:src Committed By: manu Date: Sat May 28 00:53:41 UTC 2022 Modified Files: src/share/man/man4: wm.4 Log Message: Document hw.wmX.txex_workqueue sysctl To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/share/man/man4/wm.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/wm.4 diff -u src/share/man/man4/wm.4:1.42 src/share/man/man4/wm.4:1.43 --- src/share/man/man4/wm.4:1.42 Wed Feb 17 08:15:43 2021 +++ src/share/man/man4/wm.4 Sat May 28 00:53:41 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: wm.4,v 1.42 2021/02/17 08:15:43 knakahara Exp $ +.\" $NetBSD: wm.4,v 1.43 2022/05/28 00:53:41 manu Exp $ .\" .\" Copyright 2002, 2003 Wasabi Systems, Inc. .\" All rights reserved. @@ -184,6 +184,16 @@ utility configures the adapter to receiv .\" .Sh DIAGNOSTICS .\" XXX to be done. .Sh OPTIONS +The driver default behavior is to handle packets in interrupt context, +which reduces the CPU time available to user processes when under +heavy nerwork load. The +.Em hw.wmX.txrx_workqueue +.Xr sysctl 8 +alters this behavior so that packets are handled by a kernel thread, +which executes at a lower priority. This gives user processes more +opportunity to be executed, at the exepense of network throughput. +.Pp +The following options can be set at build time: .Bl -tag -width WM_RX_INTR_PROCESS_LIMIT_DEFAULT -offset 3n .It Dv WM_RX_PROCESS_LIMIT_DEFAULT The maximum number of received packets processed in each @@ -247,7 +257,8 @@ to .Xr mii 4 , .Xr netintro 4 , .Xr pci 4 , -.Xr ifconfig 8 +.Xr ifconfig 8 , +.Xr sysctl 8 .Sh HISTORY The .Nm
CVS commit: src/share/man/man4
Module Name:src Committed By: manu Date: Sat May 28 00:53:41 UTC 2022 Modified Files: src/share/man/man4: wm.4 Log Message: Document hw.wmX.txex_workqueue sysctl To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/share/man/man4/wm.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/adb
Module Name:src Committed By: manu Date: Sat May 14 01:16:55 UTC 2022 Modified Files: src/sys/dev/adb: adb_kbd.c adb_keymap.h adb_usb_map.c Log Message: Add ISO and JIS keyboard layouts for ADB to USB emulation The layout is configurable using sysctl machdep.adbkbdX.emulate_usb: 0 = no emulation 1 = ANSI 2 = ISO (new with this change) 3 = JIS (new with this change) Default value is detected using the ADB keyboard handler id. JIS default is disabled until it is tested. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/adb/adb_kbd.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/adb/adb_keymap.h cvs rdiff -u -r1.2 -r1.3 src/sys/dev/adb/adb_usb_map.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/dev/adb/adb_kbd.c diff -u src/sys/dev/adb/adb_kbd.c:1.32 src/sys/dev/adb/adb_kbd.c:1.33 --- src/sys/dev/adb/adb_kbd.c:1.32 Sat Aug 7 16:19:09 2021 +++ src/sys/dev/adb/adb_kbd.c Sat May 14 01:16:55 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: adb_kbd.c,v 1.32 2021/08/07 16:19:09 thorpej Exp $ */ +/* $NetBSD: adb_kbd.c,v 1.33 2022/05/14 01:16:55 manu Exp $ */ /* * Copyright (C) 1998 Colin Wood @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.32 2021/08/07 16:19:09 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.33 2022/05/14 01:16:55 manu Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -93,7 +93,7 @@ struct adbkbd_softc { #ifdef WSDISPLAY_COMPAT_RAWKBD int sc_rawkbd; #endif - bool sc_emul_usb; + int sc_emul_usb; bool sc_power_dbg; uint32_t sc_power; @@ -235,7 +235,7 @@ adbkbd_attach(device_t parent, device_t */ sc->sc_power = 0x; sc->sc_timestamp = 0; - sc->sc_emul_usb = FALSE; + sc->sc_emul_usb = ADB_EMUL_USB_NONE; #ifdef ADBKBD_POWER_DDB sc->sc_power_dbg = TRUE; #else @@ -386,8 +386,56 @@ adbkbd_attach(device_t parent, device_t sc->sc_wskbddev = config_found(self, , wskbddevprint, CFARGS(.iattr = "wskbddev")); #ifdef ADBKBD_EMUL_USB - sc->sc_emul_usb = TRUE; - wskbd_set_evtrans(sc->sc_wskbddev, adb_to_usb, 128); + /* Values from Linux's drivers/macintosh/adbhud.c */ +switch (sc->sc_adbdev->handler_id) { + case ADB_ISOKBD: /* FALLTHROUGH */ + case ADB_EXTISOKBD: /* FALLTHROUGH */ + case 0x07: /* FALLTHROUGH */ + case ADB_ISOKBDII: /* FALLTHROUGH */ + case ADB_PBISOKBD: /* FALLTHROUGH */ + case ADB_ADJISOKBD: /* FALLTHROUGH */ + case ADB_PBEXTISOKBD: /* FALLTHROUGH */ + case 0x19: /* FALLTHROUGH */ + case 0x1d: /* FALLTHROUGH */ + case 0xc1: /* FALLTHROUGH */ + case ADB_IBOOKKBD: /* FALLTHROUGH */ + case 0xc7: + sc->sc_emul_usb = ADB_EMUL_USB_ISO; + wskbd_set_evtrans(sc->sc_wskbddev, adb_to_usb_iso, 128); + break; +#ifdef notyet + case ADB_ADJJAPKBD: /* FALLTHROUGH */ + case ADB_PBEXTJAPKBD: /* FALLTHROUGH */ + case ADB_JPKBDII: /* FALLTHROUGH */ + case 0x17: /* FALLTHROUGH */ + case 0x1a: /* FALLTHROUGH */ + case ADB_PBJPKBD: /* FALLTHROUGH */ + case 0xc2: /* FALLTHROUGH */ + case 0xc5: /* FALLTHROUGH */ + case 0xc8: /* FALLTHROUGH */ + case 0xc9: + sc->sc_emul_usb = ADB_EMUL_USB_JIS; + wskbd_set_evtrans(sc->sc_wskbddev, adb_to_usb_jis, 128); + break; +#endif + case ADB_STDKBD: /* FALLTHROUGH */ + case ADB_EXTKBD: /* FALLTHROUGH */ + case 0x03: /* FALLTHROUGH */ + case 0x06: /* FALLTHROUGH */ + case ADB_KBDII: /* FALLTHROUGH */ + case ADB_PBKBD: /* FALLTHROUGH */ + case ADB_ADJKBD: /* FALLTHROUGH */ + case ADB_PBEXTKBD: /* FALLTHROUGH */ + case ADB_DESIGNKBD: /* FALLTHROUGH */ + case 0x1c: /* FALLTHROUGH */ + case 0xc0: /* FALLTHROUGH */ + case ADB_PBG3KBD: /* FALLTHROUGH */ + case 0xc6: /* FALLTHROUGH */ + default: /* default to ANSI for unknown values */ + sc->sc_emul_usb = ADB_EMUL_USB_ANSI; + wskbd_set_evtrans(sc->sc_wskbddev, adb_to_usb_ansi, 128); + break; + } #endif /* ADBKBD_EMUL_USB */ #if NWSMOUSE > 0 @@ -633,7 +681,7 @@ adbkbd_ioctl(void *v, u_long cmd, void * switch (cmd) { case WSKBDIO_GTYPE: - if (sc->sc_emul_usb) { + if (sc->sc_emul_usb != ADB_EMUL_USB_NONE) { *(int *)data = WSKBD_TYPE_USB; } else { *(int *)data = WSKBD_TYPE_ADB; @@ -798,7 +846,7 @@ adbkbd_sysctl_usb(SYSCTLFN_ARGS) struct sysctlnode node = *rnode; struct adbkbd_softc *sc=(struct adbkbd_softc *)node.sysctl_data; const int *np = newp; - bool reg; + int reg; DPRINTF("%s\n", __func__); reg = sc->sc_emul_usb; @@ -807,12 +855,26 @@ adbkbd_sysctl_usb(SYSCTLFN_ARGS) node.sysctl_data = if (sysctl_lookup(SYSCTLFN_CALL()) == 0) { - sc->sc_emul_usb = *(bool *)node.sysctl_data; - if (sc->sc_emul_usb) { -wskbd_set_evtrans(sc->sc_wskbddev, -adb_to_usb, 128); - } else { + sc->sc_emul_usb = *(int *)node.sysctl_data; + switch (sc->sc_emul_usb) { + case ADB_EMUL_USB_NONE: wskbd_set_evtrans(sc->sc_wskbddev, NULL, 0); +break; + case ADB_EMUL_USB_ANSI: +wskbd_set_evtrans(sc->sc_wskbddev, +adb_to_usb_ansi, 128); +
CVS commit: src/sys/dev/adb
Module Name:src Committed By: manu Date: Sat May 14 01:16:55 UTC 2022 Modified Files: src/sys/dev/adb: adb_kbd.c adb_keymap.h adb_usb_map.c Log Message: Add ISO and JIS keyboard layouts for ADB to USB emulation The layout is configurable using sysctl machdep.adbkbdX.emulate_usb: 0 = no emulation 1 = ANSI 2 = ISO (new with this change) 3 = JIS (new with this change) Default value is detected using the ADB keyboard handler id. JIS default is disabled until it is tested. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/adb/adb_kbd.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/adb/adb_keymap.h cvs rdiff -u -r1.2 -r1.3 src/sys/dev/adb/adb_usb_map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/sets/lists/man
Module Name:src Committed By: manu Date: Thu Mar 24 14:04:28 UTC 2022 Modified Files: src/distrib/sets/lists/man: mi Log Message: Add man page for Intel GPIO igpio.4 To generate a diff of this commit: cvs rdiff -u -r1.1735 -r1.1736 src/distrib/sets/lists/man/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/sets/lists/man
Module Name:src Committed By: manu Date: Thu Mar 24 14:04:28 UTC 2022 Modified Files: src/distrib/sets/lists/man: mi Log Message: Add man page for Intel GPIO igpio.4 To generate a diff of this commit: cvs rdiff -u -r1.1735 -r1.1736 src/distrib/sets/lists/man/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1735 src/distrib/sets/lists/man/mi:1.1736 --- src/distrib/sets/lists/man/mi:1.1735 Thu Feb 24 03:35:33 2022 +++ src/distrib/sets/lists/man/mi Thu Mar 24 14:04:28 2022 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1735 2022/02/24 03:35:33 mrg Exp $ +# $NetBSD: mi,v 1.1736 2022/03/24 14:04:28 manu Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -7621,6 +7621,7 @@ ./usr/share/man/man4/ifpci.4 man-obsolete obsolete ./usr/share/man/man4/igmafb.4 man-sys-man .man ./usr/share/man/man4/igphy.4 man-sys-man .man +./usr/share/man/man4/igpio.4 man-sys-man .man ./usr/share/man/man4/igsfb.4 man-sys-man .man ./usr/share/man/man4/iha.4 man-sys-man .man ./usr/share/man/man4/ihidev.4 man-sys-man .man
CVS commit: src/share/man/man4
Module Name:src Committed By: manu Date: Thu Mar 24 14:00:19 UTC 2022 Modified Files: src/share/man/man4: Makefile Added Files: src/share/man/man4: igpio.4 Log Message: Add documentatiion for Intel GPIO driver igpio(4) To generate a diff of this commit: cvs rdiff -u -r1.722 -r1.723 src/share/man/man4/Makefile cvs rdiff -u -r0 -r1.1 src/share/man/man4/igpio.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/Makefile diff -u src/share/man/man4/Makefile:1.722 src/share/man/man4/Makefile:1.723 --- src/share/man/man4/Makefile:1.722 Mon Jan 17 16:31:23 2022 +++ src/share/man/man4/Makefile Thu Mar 24 14:00:19 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.722 2022/01/17 16:31:23 thorpej Exp $ +# $NetBSD: Makefile,v 1.723 2022/03/24 14:00:19 manu Exp $ # @(#)Makefile 8.1 (Berkeley) 6/18/93 MAN= aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \ @@ -30,7 +30,7 @@ MAN= aac.4 ac97.4 acardide.4 aceride.4 a gpiosim.4 gre.4 gphyter.4 gsip.4 \ hdaudio.4 hifn.4 hme.4 hpacel.4 hpqlb.4 hptide.4 hvn.4 hythygtemp.4 \ iavf.4 ibmcd.4 ibmhawk.4 ichsmb.4 icmp.4 icp.4 icsphy.4 iee.4 \ - ieee80211.4 ifmedia.4 igmafb.4 igphy.4 igsfb.4 iha.4 ihidev.4 \ + ieee80211.4 ifmedia.4 igmafb.4 igphy.4 igpio.4 igsfb.4 iha.4 ihidev.4 \ ihphy.4 iic.4 ims.4 inet.4 ikphy.4 inphy.4 intersil7170.4 intro.4 \ ioasic.4 ioat.4 iop.4 iophy.4 iopsp.4 ip.4 ipgphy.4 ipmi.4 ipw.4 \ irmce.4 isp.4 ismt.4 isv.4 itesio.4 iteide.4 iwi.4 iwm.4 iwn.4 ixg.4 \ Added files: Index: src/share/man/man4/igpio.4 diff -u /dev/null src/share/man/man4/igpio.4:1.1 --- /dev/null Thu Mar 24 14:00:19 2022 +++ src/share/man/man4/igpio.4 Thu Mar 24 14:00:19 2022 @@ -0,0 +1,91 @@ +.\" $NetBSD: igpio.4,v 1.1 2022/03/24 14:00:19 manu Exp $ +.\" +.\" Copyright (c) 2022 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Emmanuel Dreyfus. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 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. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``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 FOUNDATION OR CONTRIBUTORS +.\" 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. +.\" +.Dd Mars 24, 2022 +.Dt IGPIO 4 +.Os +.Sh NAME +.Nm igpio +.Nd Intel GPIO Controller +.Sh SYNOPSIS +.Cd "igpio* at acpi?" +.Cd "gpio* at gpiobus?" +.Sh DESCRIPTION +.Nm +provides a +.Xr gpio 4 +interface for the following Intel chipsets: +.Bl -tag -width autoselect -compact +.It Alderlake +.It Baytrail +.It Cannonlake-H +.It Cannonlake-LP +.It Cedarfork +.It Denverton +.It Emmitsburg +.It Geminilake +.It Icelake +.It Jasperlake +.It Lakefield +.It Lewisburg +.It Lynxpoint +.It Sunrisepoint-H +.It Sunrisepoint-LP +.It Tigerlake-H +.It Tigerlake-LP +.El +Support for Broxton and Cherryview is not enabled yet. +.Pp +The driver supports +.Dv GPIO_PIN_INPUT , +.Dv GPIO_PIN_OUTPUT , +.Dv GPIO_PIN_INOUT , +.Dv GPIO_PIN_ININ , +.Dv GPIO_PIN_PULLUP , +.Dv GPIO_PIN_PULLDOWN , +and interrupt capabilies +.Dv GPIO_INTR_POS_EDGE , +.Dv GPIO_INTR_NEG_EDGE , +.Dv GPIO_INTR_DOUBLE_EDGE , +.Dv GPIO_INTR_HIGH_LEVEL , +.Dv GPIO_INTR_LOW_LEVEL . +.Sh SEE ALSO +.Xr gpio 4 +.Sh HISTORY +The +.Nm +driver first appeared in +.Nx 10.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver and man page was written by +.An Emmanuel Dreyfus +.Aq Mt m...@netbsd.org .
CVS commit: src/share/man/man4
Module Name:src Committed By: manu Date: Thu Mar 24 14:00:19 UTC 2022 Modified Files: src/share/man/man4: Makefile Added Files: src/share/man/man4: igpio.4 Log Message: Add documentatiion for Intel GPIO driver igpio(4) To generate a diff of this commit: cvs rdiff -u -r1.722 -r1.723 src/share/man/man4/Makefile cvs rdiff -u -r0 -r1.1 src/share/man/man4/igpio.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys
Module Name:src Committed By: manu Date: Thu Mar 24 02:24:25 UTC 2022 Modified Files: src/sys/arch/amd64/conf: GENERIC src/sys/conf: files src/sys/dev/acpi: files.acpi Added Files: src/sys/dev/acpi: igpio_acpi.c src/sys/dev/ic: igpio.c igpioreg.h igpiovar.h Log Message: Add initial support for Intel GPIO chips To generate a diff of this commit: cvs rdiff -u -r1.593 -r1.594 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.1295 -r1.1296 src/sys/conf/files cvs rdiff -u -r1.124 -r1.125 src/sys/dev/acpi/files.acpi cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/igpio_acpi.c cvs rdiff -u -r0 -r1.1 src/sys/dev/ic/igpio.c src/sys/dev/ic/igpioreg.h \ src/sys/dev/ic/igpiovar.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/amd64/conf/GENERIC diff -u src/sys/arch/amd64/conf/GENERIC:1.593 src/sys/arch/amd64/conf/GENERIC:1.594 --- src/sys/arch/amd64/conf/GENERIC:1.593 Sun Oct 31 00:31:48 2021 +++ src/sys/arch/amd64/conf/GENERIC Thu Mar 24 02:24:24 2022 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.593 2021/10/31 00:31:48 simonb Exp $ +# $NetBSD: GENERIC,v 1.594 2022/03/24 02:24:24 manu Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.593 $" +#ident "GENERIC-$Revision: 1.594 $" maxusers 64 # estimated number of users @@ -596,6 +596,9 @@ iic* at dwiic? #sdtemp* at iic? addr 0x1e #sdtemp* at iic? addr 0x1f +# Intel GPIO +igpio* at acpi? + # I2C HID devices ihidev* at iic? Index: src/sys/conf/files diff -u src/sys/conf/files:1.1295 src/sys/conf/files:1.1296 --- src/sys/conf/files:1.1295 Wed Feb 16 20:14:30 2022 +++ src/sys/conf/files Thu Mar 24 02:24:24 2022 @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1295 2022/02/16 20:14:30 riastradh Exp $ +# $NetBSD: files,v 1.1296 2022/03/24 02:24:24 manu Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20171118 @@ -1357,6 +1357,10 @@ file dev/ic/pl061.c plgpio device plmmc: sdmmcbus file dev/ic/pl181.c plmmc +# Intel GPIO +device igpio: gpiobus +file dev/ic/igpio.c igpio + # Myson MTD803 3-in-1 Fast Ethernet Controller device mtd: arp, ether, ifnet, mii file dev/ic/mtd803.c mtd Index: src/sys/dev/acpi/files.acpi diff -u src/sys/dev/acpi/files.acpi:1.124 src/sys/dev/acpi/files.acpi:1.125 --- src/sys/dev/acpi/files.acpi:1.124 Wed Feb 16 20:14:30 2022 +++ src/sys/dev/acpi/files.acpi Thu Mar 24 02:24:25 2022 @@ -1,4 +1,4 @@ -# $NetBSD: files.acpi,v 1.124 2022/02/16 20:14:30 riastradh Exp $ +# $NetBSD: files.acpi,v 1.125 2022/03/24 02:24:25 manu Exp $ defflag opt_acpi.h ACPIVERBOSE ACPI_DEBUG ACPI_ACTIVATE_DEV ACPI_DSDT_OVERRIDE ACPI_SCANPCI ACPI_BREAKPOINT @@ -300,6 +300,10 @@ file dev/acpi/genet_acpi.c genet_acpi attach eqos at acpinodebus with eqos_acpi file dev/acpi/eqos_acpi.c eqos_acpi +# Intel GPIO +attach igpio at acpinodebus with igpio_acpi +file dev/acpi/igpio_acpi.c igpio_acpi + # DesignWare Mobile Storage Host Controller attach dwcmmc at acpinodebus with dwcmmc_acpi file dev/acpi/dwcmmc_acpi.c dwcmmc_acpi Added files: Index: src/sys/dev/acpi/igpio_acpi.c diff -u /dev/null src/sys/dev/acpi/igpio_acpi.c:1.1 --- /dev/null Thu Mar 24 02:24:25 2022 +++ src/sys/dev/acpi/igpio_acpi.c Thu Mar 24 02:24:25 2022 @@ -0,0 +1,237 @@ +/* $NetBSD: igpio_acpi.c,v 1.1 2022/03/24 02:24:25 manu Exp $ */ + +/*- + * Copyright (c) 2021,2022 Emmanuel Dreyfus + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``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 FOUNDATION OR CONTRIBUTORS + * 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. + */
CVS commit: src/sys
Module Name:src Committed By: manu Date: Thu Mar 24 02:24:25 UTC 2022 Modified Files: src/sys/arch/amd64/conf: GENERIC src/sys/conf: files src/sys/dev/acpi: files.acpi Added Files: src/sys/dev/acpi: igpio_acpi.c src/sys/dev/ic: igpio.c igpioreg.h igpiovar.h Log Message: Add initial support for Intel GPIO chips To generate a diff of this commit: cvs rdiff -u -r1.593 -r1.594 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.1295 -r1.1296 src/sys/conf/files cvs rdiff -u -r1.124 -r1.125 src/sys/dev/acpi/files.acpi cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/igpio_acpi.c cvs rdiff -u -r0 -r1.1 src/sys/dev/ic/igpio.c src/sys/dev/ic/igpioreg.h \ src/sys/dev/ic/igpiovar.h 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/efiboot
On Mon, Dec 27, 2021 at 01:08:15PM +1100, Simon Burge wrote: > What crash did this fix? All the use of part_name by the > called functions should check if it is NULL before trying > to assign anything to *part_name. I do not recall the details now, but I had a crash because of this. Please revert my change, I will get back to it when I find some time. -- Emmanuel Dreyfus m...@netbsd.org
CVS commit: src/sys/arch/i386/stand/efiboot
Module Name:src Committed By: manu Date: Thu Nov 18 16:18:13 UTC 2021 Modified Files: src/sys/arch/i386/stand/efiboot: devopen.c Log Message: Fix crash because of NULL pointer reference To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/efiboot/devopen.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/efiboot/devopen.c diff -u src/sys/arch/i386/stand/efiboot/devopen.c:1.11 src/sys/arch/i386/stand/efiboot/devopen.c:1.12 --- src/sys/arch/i386/stand/efiboot/devopen.c:1.11 Sat Jan 18 19:25:58 2020 +++ src/sys/arch/i386/stand/efiboot/devopen.c Thu Nov 18 16:18:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: devopen.c,v 1.11 2020/01/18 19:25:58 nonaka Exp $ */ +/* $NetBSD: devopen.c,v 1.12 2021/11/18 16:18:13 manu Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -288,8 +288,9 @@ neterr: * biosdisk */ if (strcmp(devname, "esp") == 0) { + const char *part_name = NULL; bios2dev(boot_biosdev, boot_biossector, , , - , NULL); + , _name); if (efidisk_get_efi_system_partition(boot_biosdev, )) return ENXIO; }
CVS commit: src/sys/arch/i386/stand/efiboot
Module Name:src Committed By: manu Date: Thu Nov 18 16:18:13 UTC 2021 Modified Files: src/sys/arch/i386/stand/efiboot: devopen.c Log Message: Fix crash because of NULL pointer reference To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/efiboot/devopen.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/efiboot
Module Name:src Committed By: manu Date: Thu Nov 18 16:17:41 UTC 2021 Modified Files: src/sys/arch/i386/stand/efiboot: Makefile.efiboot Log Message: Do not pass BIOS geometry when booting using EFI Recent Mac return garbage data that will crash the code handling it, and EFI boot does not need it anyway. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/stand/efiboot/Makefile.efiboot 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/efiboot
Module Name:src Committed By: manu Date: Thu Nov 18 16:17:41 UTC 2021 Modified Files: src/sys/arch/i386/stand/efiboot: Makefile.efiboot Log Message: Do not pass BIOS geometry when booting using EFI Recent Mac return garbage data that will crash the code handling it, and EFI boot does not need it anyway. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/i386/stand/efiboot/Makefile.efiboot 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/efiboot/Makefile.efiboot diff -u src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.18 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.19 --- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.18 Sun Sep 6 07:20:29 2020 +++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot Thu Nov 18 16:17:40 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.efiboot,v 1.18 2020/09/06 07:20:29 mrg Exp $ +# $NetBSD: Makefile.efiboot,v 1.19 2021/11/18 16:17:40 manu Exp $ S= ${.CURDIR}/../../../../.. @@ -66,7 +66,8 @@ CPPFLAGS+= -DSUPPORT_BOOTP CPPFLAGS+= -DSUPPORT_DHCP CPPFLAGS+= -DSUPPORT_NFS CPPFLAGS+= -DSUPPORT_TFTP -CPPFLAGS+= -DPASS_BIOSGEOM +# Recent macs report garbage geometry +#CPPFLAGS+= -DPASS_BIOSGEOM CPPFLAGS+= -DBIOSDISK_DEFAULT_SECSIZE=2048 # for bootinfo_biosgeom.c CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
CVS commit: src/sys/arch/amd64/conf
Module Name:src Committed By: manu Date: Fri Sep 24 00:29:46 UTC 2021 Modified Files: src/sys/arch/amd64/conf: XEN3_DOM0 Log Message: Move XEN3_DOM0 as close as possible to GENERIC. Document why some options are disabled Set NO_PCI_MSI_MSIX to work around crashes reported in multiple PR To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/sys/arch/amd64/conf/XEN3_DOM0 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/amd64/conf/XEN3_DOM0 diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.193 src/sys/arch/amd64/conf/XEN3_DOM0:1.194 --- src/sys/arch/amd64/conf/XEN3_DOM0:1.193 Tue Jun 29 10:22:34 2021 +++ src/sys/arch/amd64/conf/XEN3_DOM0 Fri Sep 24 00:29:46 2021 @@ -1,4 +1,4 @@ -# $NetBSD: XEN3_DOM0,v 1.193 2021/06/29 10:22:34 nia Exp $ +# $NetBSD: XEN3_DOM0,v 1.194 2021/09/24 00:29:46 manu Exp $ # XEN3_DOM0 machine description file # @@ -14,7 +14,7 @@ include "arch/amd64/conf/std.xen" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "XEN3_DOM0-$Revision: 1.193 $" +#ident "XEN3_DOM0-$Revision: 1.194 $" maxusers 32 # estimated number of users @@ -86,14 +86,15 @@ options SYSVSEM # System V-like semaph options SYSVSHM # System V-like memory sharing options MODULAR # new style module(7) framework -#options MODULAR_DEFAULT_AUTOLOAD +options MODULAR_DEFAULT_AUTOLOAD options USERCONF # userconf(4) support #options PIPE_SOCKETPAIR # smaller, but slower pipe(2) options SYSCTL_INCLUDE_DESCR # Include sysctl descriptions in kernel # CPU features #acpicpu* at cpu? # ACPI CPU (including frequency scaling) -#coretemp* at cpu? # Intel on-die thermal sensor +# needs x86_cpu_idle_halt in cpu.c (!xenpv) +coretemp* at cpu? # Intel on-die thermal sensor est0 at cpu0 # Intel Enhanced SpeedStep (non-ACPI) #hyperv0 at cpu0 # Microsoft Hyper-V #odcm0 at cpu0 # On-demand clock modulation @@ -117,16 +118,17 @@ options DIAGNOSTIC # inexpensive kernel # makeoptions COPTS="-O2 -fno-omit-frame-pointer" options DDB # in-kernel debugger -options DDB_COMMANDONENTER="show registers" -options DDB_ONPANIC=1 # see also sysctl(7): `ddb.onpanic' +#options DDB_COMMANDONENTER="bt" # execute command when ddb is entered +#options DDB_ONPANIC=1 # see also sysctl(7): `ddb.onpanic' options DDB_HISTORY_SIZE=512 # enable history editing in DDB #options KGDB # remote debugger #options KGDB_DEVNAME="\"com\"",KGDB_DEVADDR=0x2f8,KGDB_DEVRATE=57600 -#makeoptions DEBUG="-g" # compile full symbol table +makeoptions DEBUG="-g" # compile full symbol table for CTF +options DDB_COMMANDONENTER="trace;show registers" #options SYSCALL_STATS # per syscall counts #options SYSCALL_TIMES # per syscall times #options SYSCALL_TIMES_HASCOUNTER # use 'broken' rdtsc (soekris) -#options KDTRACE_HOOKS # kernel DTrace hooks +options KDTRACE_HOOKS # kernel DTrace hooks # Kernel Undefined Behavior Sanitizer (kUBSan). #options KUBSAN # mandatory @@ -195,19 +197,19 @@ include "conf/filesystems.config" # ffs options QUOTA # legacy UFS quotas options QUOTA2 # new, in-filesystem UFS quotas -#options FFS_EI # FFS Endian Independent support +options FFS_EI # FFS Endian Independent support options WAPBL # File system journaling support # Note that UFS_DIRHASH is suspected of causing kernel memory corruption. # It is not recommended for general use. #options UFS_DIRHASH # UFS Large Directory Hashing - Experimental -#options UFS_ACL # UFS Access Control Lists +options UFS_ACL # UFS Access Control Lists #options FFS_NO_SNAPSHOT # No FFS snapshot support options UFS_EXTATTR # Extended attribute support for UFS1 # ext2fs #options EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and # immutable) behave as system flags. # other -#options DISKLABEL_EI # disklabel Endian Independent support +options DISKLABEL_EI # disklabel Endian Independent support options NFSSERVER # Network File System server # Networking options @@ -252,12 +254,6 @@ options SCSIVERBOSE # human readable SC #options HDAUDIOVERBOSE # verbose HDAUDIO driver messages options NFS_BOOT_DHCP,NFS_BOOT_BOOTPARAM -#options NFS_BOOT_BOOTSTATIC -#options NFS_BOOTSTATIC_MYIP="\"169.254.1.2\"" -#options NFS_BOOTSTATIC_GWIP="\"169.254.1.1\"" -#options NFS_BOOTSTATIC_MASK="\"255.255.255.0\"" -#options NFS_BOOTSTATIC_SERVADDR="\"169.254.1.1\"" -#options NFS_BOOTSTATIC_SERVER="\"server:/path/to/root\"" # # wscons options @@ -329,11 +325,7 @@ options MPBIOS_SCANPCI # MPBIOS config #options PCI_BUS_FIXUP # fixup PCI bus numbering #options PCI_ADDR_FIXUP # fixup PCI I/O addresses #options ACPI_ACTIVATE_DEV # If set, activate inactive devices -#options VGA_POST # in-kernel support for VGA POST - -#options ACPICA_PEDANTIC # force strict conformance to the Spec. -#options MPDEBUG # MPBIOS configures PCI roots -#options
CVS commit: src/sys/arch/amd64/conf
Module Name:src Committed By: manu Date: Fri Sep 24 00:29:46 UTC 2021 Modified Files: src/sys/arch/amd64/conf: XEN3_DOM0 Log Message: Move XEN3_DOM0 as close as possible to GENERIC. Document why some options are disabled Set NO_PCI_MSI_MSIX to work around crashes reported in multiple PR To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/sys/arch/amd64/conf/XEN3_DOM0 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/doc
Module Name:src Committed By: manu Date: Tue Jul 27 12:40:07 UTC 2021 Modified Files: src/doc: CHANGES Log Message: Tie the maximum file lock per unprivilegied uid to kern.maxfiles To generate a diff of this commit: cvs rdiff -u -r1.2815 -r1.2816 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2815 src/doc/CHANGES:1.2816 --- src/doc/CHANGES:1.2815 Fri Jul 9 17:07:29 2021 +++ src/doc/CHANGES Tue Jul 27 12:40:07 2021 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2815 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2816 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -387,3 +387,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0: acpi(4): Updated ACPICA to 20210604. [christos 20210706] hp300: Add support of multiple rd(4) disks on all punits for HPDisk. [tsutsui 20210709] + kernel: Tie the maximum file lock per unprivilegied uid to + kern.maxfiles [manu 20210727]
CVS commit: src/doc
Module Name:src Committed By: manu Date: Tue Jul 27 12:40:07 UTC 2021 Modified Files: src/doc: CHANGES Log Message: Tie the maximum file lock per unprivilegied uid to kern.maxfiles To generate a diff of this commit: cvs rdiff -u -r1.2815 -r1.2816 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src
Module Name:src Committed By: manu Date: Tue Jul 27 09:32:55 UTC 2021 Modified Files: src/lib/libc/sys: fcntl.2 flock.2 src/share/man/man7: sysctl.7 src/sys/kern: vfs_lockf.c Log Message: Tie the maximum file lock per unprivilegied uid to kern.maxfiles This makes the limit simple to raise at run time. While there, document that fcntl(2) and flock(2) may return ENOMEM when this limit is reached. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/lib/libc/sys/fcntl.2 cvs rdiff -u -r1.22 -r1.23 src/lib/libc/sys/flock.2 cvs rdiff -u -r1.152 -r1.153 src/share/man/man7/sysctl.7 cvs rdiff -u -r1.73 -r1.74 src/sys/kern/vfs_lockf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/sys/fcntl.2 diff -u src/lib/libc/sys/fcntl.2:1.45 src/lib/libc/sys/fcntl.2:1.46 --- src/lib/libc/sys/fcntl.2:1.45 Fri Sep 27 07:20:07 2019 +++ src/lib/libc/sys/fcntl.2 Tue Jul 27 09:32:55 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: fcntl.2,v 1.45 2019/09/27 07:20:07 wiz Exp $ +.\" $NetBSD: fcntl.2,v 1.46 2021/07/27 09:32:55 manu Exp $ .\" .\" Copyright (c) 1983, 1993 .\" The Regents of the University of California. All rights reserved. @@ -549,6 +549,17 @@ The argument is .Dv F_GETPATH and insufficient memory is available. +.Pp +The argument +.Fa cmd +is +.Dv F_GETLK , +.Dv F_SETLK , +or +.Dv F_SETLKW , +and the file lock limit for the current unprivilegied user +has been reached. It can be modifed using sysctl +.Li kern.maxfiles . .It Bq Er ERANGE The argument .Fa cmd Index: src/lib/libc/sys/flock.2 diff -u src/lib/libc/sys/flock.2:1.22 src/lib/libc/sys/flock.2:1.23 --- src/lib/libc/sys/flock.2:1.22 Sat Oct 15 21:35:50 2011 +++ src/lib/libc/sys/flock.2 Tue Jul 27 09:32:55 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: flock.2,v 1.22 2011/10/15 21:35:50 rmind Exp $ +.\" $NetBSD: flock.2,v 1.23 2021/07/27 09:32:55 manu Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -137,6 +137,10 @@ does not include exactly one of .Dv LOCK_SH , or .Dv LOCK_UN . +.It Bq Eq ENOMEM +The file lock limit for the current unprivilegied user +has been reached. It can be modifed using sysctl +.Li kern.maxfiles . .It Bq Er EOPNOTSUPP The argument .Fa fd Index: src/share/man/man7/sysctl.7 diff -u src/share/man/man7/sysctl.7:1.152 src/share/man/man7/sysctl.7:1.153 --- src/share/man/man7/sysctl.7:1.152 Tue Jul 13 16:56:43 2021 +++ src/share/man/man7/sysctl.7 Tue Jul 27 09:32:55 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: sysctl.7,v 1.152 2021/07/13 16:56:43 nia Exp $ +.\" $NetBSD: sysctl.7,v 1.153 2021/07/27 09:32:55 manu Exp $ .\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. @@ -756,6 +756,11 @@ Memory Mapped Files Option is available otherwise\ 0. .It Li kern.maxfiles ( Dv KERN_MAXFILES ) The maximum number of open files that may be open in the system. +This also controls the maximum file locks per unprivilegied user +enforced by +.Xr fnctl 2 +and +.Xr flock 2 . .It Li kern.maxpartitions ( Dv KERN_MAXPARTITIONS ) The maximum number of partitions allowed per disk. .It Li kern.maxlwp Index: src/sys/kern/vfs_lockf.c diff -u src/sys/kern/vfs_lockf.c:1.73 src/sys/kern/vfs_lockf.c:1.74 --- src/sys/kern/vfs_lockf.c:1.73 Mon Jan 31 08:25:32 2011 +++ src/sys/kern/vfs_lockf.c Tue Jul 27 09:32:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lockf.c,v 1.73 2011/01/31 08:25:32 dholland Exp $ */ +/* $NetBSD: vfs_lockf.c,v 1.74 2021/07/27 09:32:55 manu Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lockf.c,v 1.73 2011/01/31 08:25:32 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lockf.c,v 1.74 2021/07/27 09:32:55 manu Exp $"); #include #include @@ -123,7 +123,7 @@ int lockf_debug = 0; * so that the unlock can succeed. If the unlocking causes too many splits, * however, you're totally cutoff. */ -int maxlocksperuid = 1024; +#define MAXLOCKSPERUID (2 * maxfiles) #ifdef LOCKF_DEBUG /* @@ -200,7 +200,7 @@ lf_alloc(int allowfail) uip = uid_find(uid); lcnt = atomic_inc_ulong_nv(>ui_lockcnt); if (uid && allowfail && lcnt > - (allowfail == 1 ? maxlocksperuid : (maxlocksperuid * 2))) { + (allowfail == 1 ? MAXLOCKSPERUID : (MAXLOCKSPERUID * 2))) { atomic_dec_ulong(>ui_lockcnt); return NULL; }
CVS commit: src
Module Name:src Committed By: manu Date: Tue Jul 27 09:32:55 UTC 2021 Modified Files: src/lib/libc/sys: fcntl.2 flock.2 src/share/man/man7: sysctl.7 src/sys/kern: vfs_lockf.c Log Message: Tie the maximum file lock per unprivilegied uid to kern.maxfiles This makes the limit simple to raise at run time. While there, document that fcntl(2) and flock(2) may return ENOMEM when this limit is reached. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/lib/libc/sys/fcntl.2 cvs rdiff -u -r1.22 -r1.23 src/lib/libc/sys/flock.2 cvs rdiff -u -r1.152 -r1.153 src/share/man/man7/sysctl.7 cvs rdiff -u -r1.73 -r1.74 src/sys/kern/vfs_lockf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/mpl/dhcp/dist/common
Module Name:src Committed By: manu Date: Fri May 15 12:31:04 UTC 2020 Modified Files: src/external/mpl/dhcp/dist/common: bpf.c discover.c lpf.c packet.c raw.c socket.c Log Message: crunchgen fix Make sure local_port is not shared within a crunchgen binary. There is more to do to get full functionnality in crunchgen, but at least this change makes dhcpd listen on the right port again. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/mpl/dhcp/dist/common/bpf.c cvs rdiff -u -r1.2 -r1.3 src/external/mpl/dhcp/dist/common/discover.c \ src/external/mpl/dhcp/dist/common/lpf.c \ src/external/mpl/dhcp/dist/common/packet.c \ src/external/mpl/dhcp/dist/common/raw.c \ src/external/mpl/dhcp/dist/common/socket.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/mpl/dhcp/dist/common
Module Name:src Committed By: manu Date: Fri May 15 12:31:04 UTC 2020 Modified Files: src/external/mpl/dhcp/dist/common: bpf.c discover.c lpf.c packet.c raw.c socket.c Log Message: crunchgen fix Make sure local_port is not shared within a crunchgen binary. There is more to do to get full functionnality in crunchgen, but at least this change makes dhcpd listen on the right port again. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/mpl/dhcp/dist/common/bpf.c cvs rdiff -u -r1.2 -r1.3 src/external/mpl/dhcp/dist/common/discover.c \ src/external/mpl/dhcp/dist/common/lpf.c \ src/external/mpl/dhcp/dist/common/packet.c \ src/external/mpl/dhcp/dist/common/raw.c \ src/external/mpl/dhcp/dist/common/socket.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/mpl/dhcp/dist/common/bpf.c diff -u src/external/mpl/dhcp/dist/common/bpf.c:1.3 src/external/mpl/dhcp/dist/common/bpf.c:1.4 --- src/external/mpl/dhcp/dist/common/bpf.c:1.3 Fri Jun 1 00:42:49 2018 +++ src/external/mpl/dhcp/dist/common/bpf.c Fri May 15 12:31:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: bpf.c,v 1.3 2018/06/01 00:42:49 christos Exp $ */ +/* $NetBSD: bpf.c,v 1.4 2020/05/15 12:31:03 manu Exp $ */ /* bpf.c @@ -35,7 +35,7 @@ */ #include -__RCSID("$NetBSD: bpf.c,v 1.3 2018/06/01 00:42:49 christos Exp $"); +__RCSID("$NetBSD: bpf.c,v 1.4 2020/05/15 12:31:03 manu Exp $"); #include "dhcpd.h" #if defined (USE_BPF_SEND) || defined (USE_BPF_RECEIVE) \ @@ -366,7 +366,7 @@ void if_register_receive (info) dhcp_bpf_relay_filter [10].k = ntohs (relay_port); } #endif - p.bf_insns [8].k = ntohs (local_port); + p.bf_insns [8].k = ntohs (*libdhcp_callbacks.local_port); if (ioctl (info -> rfdesc, BIOCSETF, ) < 0) log_fatal ("Can't install packet filter program: %m"); Index: src/external/mpl/dhcp/dist/common/discover.c diff -u src/external/mpl/dhcp/dist/common/discover.c:1.2 src/external/mpl/dhcp/dist/common/discover.c:1.3 --- src/external/mpl/dhcp/dist/common/discover.c:1.2 Sat Apr 7 22:37:29 2018 +++ src/external/mpl/dhcp/dist/common/discover.c Fri May 15 12:31:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: discover.c,v 1.2 2018/04/07 22:37:29 christos Exp $ */ +/* $NetBSD: discover.c,v 1.3 2020/05/15 12:31:03 manu Exp $ */ /* discover.c @@ -29,7 +29,7 @@ */ #include -__RCSID("$NetBSD: discover.c,v 1.2 2018/04/07 22:37:29 christos Exp $"); +__RCSID("$NetBSD: discover.c,v 1.3 2020/05/15 12:31:03 manu Exp $"); #include "dhcpd.h" @@ -47,8 +47,6 @@ __RCSID("$NetBSD: discover.c,v 1.2 2018/ struct interface_info *interfaces, *dummy_interfaces, *fallback_interface; int interfaces_invalidated; int quiet_interface_discovery; -u_int16_t local_port; -u_int16_t remote_port; u_int16_t relay_port = 0; int dhcpv4_over_dhcpv6 = 0; int (*dhcp_interface_setup_hook) (struct interface_info *, struct iaddr *); Index: src/external/mpl/dhcp/dist/common/lpf.c diff -u src/external/mpl/dhcp/dist/common/lpf.c:1.2 src/external/mpl/dhcp/dist/common/lpf.c:1.3 --- src/external/mpl/dhcp/dist/common/lpf.c:1.2 Sat Apr 7 22:37:29 2018 +++ src/external/mpl/dhcp/dist/common/lpf.c Fri May 15 12:31:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lpf.c,v 1.2 2018/04/07 22:37:29 christos Exp $ */ +/* $NetBSD: lpf.c,v 1.3 2020/05/15 12:31:03 manu Exp $ */ /* lpf.c @@ -29,7 +29,7 @@ */ #include -__RCSID("$NetBSD: lpf.c,v 1.2 2018/04/07 22:37:29 christos Exp $"); +__RCSID("$NetBSD: lpf.c,v 1.3 2020/05/15 12:31:03 manu Exp $"); #include "dhcpd.h" #if defined (USE_LPF_SEND) || defined (USE_LPF_RECEIVE) @@ -278,7 +278,7 @@ static void lpf_gen_filter_setup (info) dhcp_bpf_relay_filter [10].k = ntohs (relay_port); } #endif - dhcp_bpf_filter [8].k = ntohs (local_port); + dhcp_bpf_filter [8].k = ntohs (*libdhcp_callbacks.local_port); if (setsockopt (info -> rfdesc, SOL_SOCKET, SO_ATTACH_FILTER, , sizeof p) < 0) { Index: src/external/mpl/dhcp/dist/common/packet.c diff -u src/external/mpl/dhcp/dist/common/packet.c:1.2 src/external/mpl/dhcp/dist/common/packet.c:1.3 --- src/external/mpl/dhcp/dist/common/packet.c:1.2 Sat Apr 7 22:37:29 2018 +++ src/external/mpl/dhcp/dist/common/packet.c Fri May 15 12:31:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: packet.c,v 1.2 2018/04/07 22:37:29 christos Exp $ */ +/* $NetBSD: packet.c,v 1.3 2020/05/15 12:31:03 manu Exp $ */ /* packet.c @@ -34,7 +34,7 @@ */ #include -__RCSID("$NetBSD: packet.c,v 1.2 2018/04/07 22:37:29 christos Exp $"); +__RCSID("$NetBSD: packet.c,v 1.3 2020/05/15 12:31:03 manu Exp $"); #include "dhcpd.h" @@ -308,10 +308,10 @@ decode_udp_ip_header(struct interface_in /* Is it to the port we're serving? */ #if defined(RELAY_PORT) - if ((udp.uh_dport != local_port) && + if ((udp.uh_dport != *libdhcp_callbacks.local_port) && ((relay_port == 0) || (udp.uh_dport != relay_port))) #else - if (udp.uh_dport != local_port) + if
CVS commit: src/sys/dev/usb
Module Name:src Committed By: manu Date: Sat Feb 15 02:14:02 UTC 2020 Modified Files: src/sys/dev/usb: u3g.c umodeswitch.c Log Message: Add support for D-Link DWM-157 3G USB modem To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/usb/u3g.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/umodeswitch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: manu Date: Sat Feb 15 02:14:02 UTC 2020 Modified Files: src/sys/dev/usb: u3g.c umodeswitch.c Log Message: Add support for D-Link DWM-157 3G USB modem To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/dev/usb/u3g.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/umodeswitch.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/dev/usb/u3g.c diff -u src/sys/dev/usb/u3g.c:1.39 src/sys/dev/usb/u3g.c:1.40 --- src/sys/dev/usb/u3g.c:1.39 Sat Feb 8 07:53:23 2020 +++ src/sys/dev/usb/u3g.c Sat Feb 15 02:14:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: u3g.c,v 1.39 2020/02/08 07:53:23 maxv Exp $ */ +/* $NetBSD: u3g.c,v 1.40 2020/02/15 02:14:02 manu Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.39 2020/02/08 07:53:23 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.40 2020/02/15 02:14:02 manu Exp $"); #include #include @@ -255,6 +255,10 @@ static const struct usb_devno u3g_devs[] /* 4G Systems */ { USB_VENDOR_LONGCHEER, USB_PRODUCT_LONGCHEER_XSSTICK_P14 }, { USB_VENDOR_LONGCHEER, USB_PRODUCT_LONGCHEER_XSSTICK_W14 }, + + /* DLink */ + { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157 }, + { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157E }, }; /* Index: src/sys/dev/usb/umodeswitch.c diff -u src/sys/dev/usb/umodeswitch.c:1.4 src/sys/dev/usb/umodeswitch.c:1.5 --- src/sys/dev/usb/umodeswitch.c:1.4 Tue Jul 24 08:15:57 2018 +++ src/sys/dev/usb/umodeswitch.c Sat Feb 15 02:14:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: umodeswitch.c,v 1.4 2018/07/24 08:15:57 msaitoh Exp $ */ +/* $NetBSD: umodeswitch.c,v 1.5 2020/02/15 02:14:02 manu Exp $ */ /*- * Copyright (c) 2009, 2017 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: umodeswitch.c,v 1.4 2018/07/24 08:15:57 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: umodeswitch.c,v 1.5 2020/02/15 02:14:02 manu Exp $"); #include #include @@ -436,6 +436,17 @@ umodeswitch_match(device_t parent, cfdat return u3g_4gsystems_reinit(uaa->uaa_device); break; + case USB_VENDOR_DLINK: + switch (uaa->uaa_product) { + case USB_PRODUCT_DLINK_DWM157E_CD: + case USB_PRODUCT_DLINK_DWM157_CD: + (void)u3g_bulk_ata_eject(uaa->uaa_device); + (void)u3g_bulk_scsi_eject(uaa->uaa_device); + return UMATCH_HIGHEST; + default: + break; + } + default: break; }
CVS commit: src/sys/dev/usb
Module Name:src Committed By: manu Date: Sat Feb 15 02:10:45 UTC 2020 Modified Files: src/sys/dev/usb: usbdevs.h usbdevs_data.h Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.765 -r1.766 src/sys/dev/usb/usbdevs.h \ src/sys/dev/usb/usbdevs_data.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/dev/usb/usbdevs.h diff -u src/sys/dev/usb/usbdevs.h:1.765 src/sys/dev/usb/usbdevs.h:1.766 --- src/sys/dev/usb/usbdevs.h:1.765 Fri Jan 3 12:35:57 2020 +++ src/sys/dev/usb/usbdevs.h Sat Feb 15 02:10:45 2020 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs.h,v 1.765 2020/01/03 12:35:57 jmcneill Exp $ */ +/* $NetBSD: usbdevs.h,v 1.766 2020/02/15 02:10:45 manu Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.775 2020/01/03 12:35:33 jmcneill Exp + * NetBSD: usbdevs,v 1.776 2020/02/15 02:08:54 manu Exp */ /*- @@ -1430,8 +1430,10 @@ #define USB_PRODUCT_DLINK_DSB650TX3 0x400b /* 10/100 ethernet adapter */ #define USB_PRODUCT_DLINK_DSB650TX2 0x4102 /* 10/100 ethernet adapter */ #define USB_PRODUCT_DLINK_DSB650 0xabc1 /* 10/100 ethernet adapter */ +#define USB_PRODUCT_DLINK_DWM157E_CD 0xa407 /* DWM-157 CD-ROM Mode */ #define USB_PRODUCT_DLINK_DWM157_CD 0xa707 /* DWM-157 CD-ROM Mode */ #define USB_PRODUCT_DLINK_DWM157 0x7d02 /* DWM-157 LTE */ +#define USB_PRODUCT_DLINK_DWM157E 0x7d0e /* DWM-157 LTE */ #define USB_PRODUCT_DLINK_DWM222_CD 0xab00 /* DWM-222 CD-ROM Mode */ #define USB_PRODUCT_DLINK_DWM222 0x7e35 /* DWM-222 LTE */ #define USB_PRODUCT_DLINK_DWR510_CD 0xa805 /* DWR-510 CD-ROM Mode */ Index: src/sys/dev/usb/usbdevs_data.h diff -u src/sys/dev/usb/usbdevs_data.h:1.765 src/sys/dev/usb/usbdevs_data.h:1.766 --- src/sys/dev/usb/usbdevs_data.h:1.765 Fri Jan 3 12:35:57 2020 +++ src/sys/dev/usb/usbdevs_data.h Sat Feb 15 02:10:45 2020 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs_data.h,v 1.765 2020/01/03 12:35:57 jmcneill Exp $ */ +/* $NetBSD: usbdevs_data.h,v 1.766 2020/02/15 02:10:45 manu Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.775 2020/01/03 12:35:33 jmcneill Exp + * NetBSD: usbdevs,v 1.776 2020/02/15 02:08:54 manu Exp */ /*- @@ -1795,10 +1795,14 @@ static const uint16_t usb_products[] = { 6665, 5138, 4927, 0, USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DSB650, 6665, 5138, 4927, 0, + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157E_CD, + 9328, 9336, 9343, 0, USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157_CD, 9328, 9336, 9343, 0, USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157, 9328, 9348, 0, + USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM157E, + 9328, 9348, 0, USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM222_CD, 9352, 9336, 9343, 0, USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWM222, @@ -6214,10 +6218,10 @@ static const char usb_words[] = { "." "B2\0" /* 1 refs @ 9309 */ "DWA-127\0" /* 1 refs @ 9312 */ "DWA-162\0" /* 1 refs @ 9320 */ - "DWM-157\0" /* 2 refs @ 9328 */ - "CD-ROM\0" /* 4 refs @ 9336 */ - "Mode\0" /* 3 refs @ 9343 */ - "LTE\0" /* 3 refs @ 9348 */ + "DWM-157\0" /* 4 refs @ 9328 */ + "CD-ROM\0" /* 5 refs @ 9336 */ + "Mode\0" /* 4 refs @ 9343 */ + "LTE\0" /* 4 refs @ 9348 */ "DWM-222\0" /* 2 refs @ 9352 */ "DWR-510\0" /* 2 refs @ 9360 */ "A1\0" /* 3 refs @ 9368 */
CVS commit: src/sys/dev/usb
Module Name:src Committed By: manu Date: Sat Feb 15 02:10:45 UTC 2020 Modified Files: src/sys/dev/usb: usbdevs.h usbdevs_data.h Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.765 -r1.766 src/sys/dev/usb/usbdevs.h \ src/sys/dev/usb/usbdevs_data.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: manu Date: Sat Feb 15 02:08:54 UTC 2020 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add UE version of D-Link DWM-157 To generate a diff of this commit: cvs rdiff -u -r1.775 -r1.776 src/sys/dev/usb/usbdevs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: manu Date: Sat Feb 15 02:08:54 UTC 2020 Modified Files: src/sys/dev/usb: usbdevs Log Message: Add UE version of D-Link DWM-157 To generate a diff of this commit: cvs rdiff -u -r1.775 -r1.776 src/sys/dev/usb/usbdevs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/usbdevs diff -u src/sys/dev/usb/usbdevs:1.775 src/sys/dev/usb/usbdevs:1.776 --- src/sys/dev/usb/usbdevs:1.775 Fri Jan 3 12:35:33 2020 +++ src/sys/dev/usb/usbdevs Sat Feb 15 02:08:54 2020 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.775 2020/01/03 12:35:33 jmcneill Exp $ +$NetBSD: usbdevs,v 1.776 2020/02/15 02:08:54 manu Exp $ /*- * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -1423,8 +1423,10 @@ product DLINK DSB650TX_PNA 0x4003 1/10/1 product DLINK DSB650TX3 0x400b 10/100 ethernet adapter product DLINK DSB650TX2 0x4102 10/100 ethernet adapter product DLINK DSB650 0xabc1 10/100 ethernet adapter +product DLINK DWM157E_CD 0xa407 DWM-157 CD-ROM Mode product DLINK DWM157_CD 0xa707 DWM-157 CD-ROM Mode product DLINK DWM157 0x7d02 DWM-157 LTE +product DLINK DWM157E 0x7d0e DWM-157 LTE product DLINK DWM222_CD 0xab00 DWM-222 CD-ROM Mode product DLINK DWM222 0x7e35 DWM-222 LTE product DLINK DWR510_CD 0xa805 DWR-510 CD-ROM Mode
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: manu Date: Thu Jan 30 01:49:44 UTC 2020 Modified Files: src/sys/arch/x86/x86: multiboot2.c Log Message: Insert memory map with its real size, not the maximum possible. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/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/x86/x86/multiboot2.c diff -u src/sys/arch/x86/x86/multiboot2.c:1.3 src/sys/arch/x86/x86/multiboot2.c:1.4 --- src/sys/arch/x86/x86/multiboot2.c:1.3 Tue Dec 10 02:06:07 2019 +++ src/sys/arch/x86/x86/multiboot2.c Thu Jan 30 01:49:44 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: multiboot2.c,v 1.3 2019/12/10 02:06:07 manu Exp $ */ +/* $NetBSD: multiboot2.c,v 1.4 2020/01/30 01:49:44 manu Exp $ */ /*- * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: multiboot2.c,v 1.3 2019/12/10 02:06:07 manu Exp $"); +__KERNEL_RCSID(0, "$NetBSD: multiboot2.c,v 1.4 2020/01/30 01:49:44 manu Exp $"); #include "opt_multiboot.h" @@ -565,7 +565,7 @@ mbi_mmap(struct multiboot_tag_mmap *mbt) } bootinfo_add((struct btinfo_common *)bim, BTINFO_MEMMAP, - sizeof(bimbuf)); + (char*)>entry[bim->num] - (char *)bim); return; }
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: manu Date: Thu Jan 30 01:49:44 UTC 2020 Modified Files: src/sys/arch/x86/x86: multiboot2.c Log Message: Insert memory map with its real size, not the maximum possible. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/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/x86/x86
Module Name:src Committed By: manu Date: Wed Jan 29 01:54:34 UTC 2020 Modified Files: src/sys/arch/x86/x86: x86_machdep.c Log Message: Fix startup crashes caused by wrong memory map handling init_x86_vm() takes the memory map from BIOS and EFI and selects regions suitable for memory allocation. This involves removing areas used by the kernel, but the logic missed some corner cases, which led to possible allocation in regions for which later memory access would cause a panic. The typical panic from this bug in GENERIC is at SVS startup: cpu_svs_init / uvm_pagealloc_strat / pagezero We fix the bug by adding logic for the missing cases of memory regions overlapping with the kernel. While there, add more #idef'ed debug output. To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 src/sys/arch/x86/x86/x86_machdep.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/x86/x86/x86_machdep.c diff -u src/sys/arch/x86/x86/x86_machdep.c:1.134 src/sys/arch/x86/x86/x86_machdep.c:1.135 --- src/sys/arch/x86/x86/x86_machdep.c:1.134 Sat Dec 28 00:38:08 2019 +++ src/sys/arch/x86/x86/x86_machdep.c Wed Jan 29 01:54:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: x86_machdep.c,v 1.134 2019/12/28 00:38:08 pgoyette Exp $ */ +/* $NetBSD: x86_machdep.c,v 1.135 2020/01/29 01:54:34 manu Exp $ */ /*- * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.134 2019/12/28 00:38:08 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.135 2020/01/29 01:54:34 manu Exp $"); #include "opt_modular.h" #include "opt_physmem.h" @@ -669,7 +669,7 @@ x86_parse_clusters(struct btinfo_memmap type = bim->entry[x].type; #ifdef DEBUG_MEMLOAD printf("MEMMAP: 0x%016" PRIx64 "-0x%016" PRIx64 - ", size=0x%016" PRIx64 ", type=%d(%s)\n", + "\n\tsize=0x%016" PRIx64 ", type=%d(%s)\n", addr, addr + size - 1, size, type, (type == BIM_Memory) ? "Memory" : (type == BIM_Reserved) ? "Reserved" : @@ -909,27 +909,95 @@ init_x86_vm(paddr_t pa_kend) seg_start1 = 0; seg_end1 = 0; +#ifdef DEBUG_MEMLOAD + printf("segment %" PRIx64 " - %" PRIx64 "\n", + seg_start, seg_end); +#endif + /* Skip memory before our available starting point. */ - if (seg_end <= lowmem_rsvd) + if (seg_end <= lowmem_rsvd) { +#ifdef DEBUG_MEMLOAD + printf("discard segment below starting point " + "%" PRIx64 " - %" PRIx64 "\n", seg_start, seg_end); +#endif continue; + } if (seg_start <= lowmem_rsvd && lowmem_rsvd < seg_end) { seg_start = lowmem_rsvd; - if (seg_start == seg_end) + if (seg_start == seg_end) { +#ifdef DEBUG_MEMLOAD +printf("discard segment below starting point " +"%" PRIx64 " - %" PRIx64 "\n", +seg_start, seg_end); + + +#endif continue; + } } /* * If this segment contains the kernel, split it in two, around * the kernel. + * [seg_start seg_end] + * [pa_kstart pa_kend] */ if (seg_start <= pa_kstart && pa_kend <= seg_end) { +#ifdef DEBUG_MEMLOAD + printf("split kernel overlapping to " + "%" PRIx64 " - %lx and %lx - %" PRIx64 "\n", + seg_start, pa_kstart, pa_kend, seg_end); +#endif seg_start1 = pa_kend; seg_end1 = seg_end; seg_end = pa_kstart; KASSERT(seg_end < seg_end1); } + /* + * Discard a segment inside the kernel + * [pa_kstart pa_kend] + * [seg_start seg_end] + */ + if (pa_kstart < seg_start && seg_end < pa_kend) { +#ifdef DEBUG_MEMLOAD + printf("discard complete kernel overlap " + "%" PRIx64 " - %" PRIx64 "\n", seg_start, seg_end); +#endif + continue; + } + + /* + * Discard leading hunk that overlaps the kernel + * [pa_kstart pa_kend] + *[seg_startseg_end] + */ + if (pa_kstart < seg_start && + seg_start < pa_kend && + pa_kend < seg_end) { +#ifdef DEBUG_MEMLOAD + printf("discard leading kernel overlap " + "%" PRIx64 " - %lx\n", seg_start, pa_kend); +#endif + seg_start = pa_kend; + } + + /* + * Discard trailing hunk that overlaps the kernel + * [pa_kstartpa_kend] + * [seg_start seg_end] + */ + if (seg_start < pa_kstart && + pa_kstart < seg_end && + seg_end < pa_kend) { +#ifdef DEBUG_MEMLOAD + printf("discard trailing kernel overlap " + "%lx - %" PRIx64 "\n", pa_kstart, seg_end); +#endif + seg_end = pa_kstart; + } + /* First hunk */ if (seg_start != seg_end) { x86_load_region(seg_start, seg_end);
CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: manu Date: Wed Jan 29 01:54:34 UTC 2020 Modified Files: src/sys/arch/x86/x86: x86_machdep.c Log Message: Fix startup crashes caused by wrong memory map handling init_x86_vm() takes the memory map from BIOS and EFI and selects regions suitable for memory allocation. This involves removing areas used by the kernel, but the logic missed some corner cases, which led to possible allocation in regions for which later memory access would cause a panic. The typical panic from this bug in GENERIC is at SVS startup: cpu_svs_init / uvm_pagealloc_strat / pagezero We fix the bug by adding logic for the missing cases of memory regions overlapping with the kernel. While there, add more #idef'ed debug output. To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 src/sys/arch/x86/x86/x86_machdep.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/amd64
Ryo ONODERA wrote: > However I need multiboot support for amd64. > I am waiting well-tested implementation. At this point the problems are more about code style and cleaning, as we have a fix for the boot bugs that has been reported. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
CVS commit: src/sys/arch/amd64
Module Name:src Committed By: manu Date: Thu Jan 9 00:42:24 UTC 2020 Modified Files: src/sys/arch/amd64/amd64: locore.S machdep.c src/sys/arch/amd64/conf: GENERIC files.amd64 kern.ldscript Log Message: Rollback multiboot2 for amd64, as requested by core To generate a diff of this commit: cvs rdiff -u -r1.197 -r1.198 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.344 -r1.345 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.553 -r1.554 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.114 -r1.115 src/sys/arch/amd64/conf/files.amd64 cvs rdiff -u -r1.30 -r1.31 src/sys/arch/amd64/conf/kern.ldscript 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/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.197 src/sys/arch/amd64/amd64/locore.S:1.198 --- src/sys/arch/amd64/amd64/locore.S:1.197 Wed Jan 8 20:59:18 2020 +++ src/sys/arch/amd64/amd64/locore.S Thu Jan 9 00:42:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.197 2020/01/08 20:59:18 skrll Exp $ */ +/* $NetBSD: locore.S,v 1.198 2020/01/09 00:42:24 manu Exp $ */ /* * Copyright-o-rama! @@ -158,7 +158,6 @@ #include "opt_compat_netbsd.h" #include "opt_compat_netbsd32.h" -#include "opt_multiboot.h" #include "opt_xen.h" #include "opt_svs.h" @@ -178,13 +177,6 @@ #include #include -#ifndef XENPV -#include -#endif - -#define CODE_SEGMENT 0x08 -#define DATA_SEGMENT 0x10 - #if NLAPIC > 0 #include #endif @@ -432,50 +424,6 @@ END(farjmp64) .space 512 tmpstk: -.section multiboot,"a" -#if defined(MULTIBOOT) - .align 8 - .globl Multiboot2_Header -_C_LABEL(Multiboot2_Header): - .int MULTIBOOT2_HEADER_MAGIC - .int MULTIBOOT2_ARCHITECTURE_I386 - .int Multiboot2_Header_end - Multiboot2_Header - .int -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_ARCHITECTURE_I386 \ - + (Multiboot2_Header_end - Multiboot2_Header)) - - .int 1 /* MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST */ - .int 12 /* sizeof(multiboot_header_tag_information_request) */ - /* + sizeof(uint32_t) * requests */ - .int 4 /* MULTIBOOT_TAG_TYPE_BASIC_MEMINFO */ - .align 8 - - .int 3 /* MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS */ - .int 16 /* sizeof(struct multiboot_tag_efi64) */ - .quad (multiboot2_entry - KERNBASE) - .align 8 - - .int 9 /* MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 */ - .int 16 /* sizeof(struct multiboot_tag_efi64) */ - .quad (multiboot2_entry - KERNBASE) - .align 8 - -#if notyet - /* - * Could be used to get an early console for debug, - * but this is broken. - */ - .int 7 /* MULTIBOOT_HEADER_TAG_EFI_BS */ - .int 8 /* sizeof(struct multiboot_tag) */ - .align 8 -#endif - - .int 0 /* MULTIBOOT_HEADER_TAG_END */ - .int 8 /* sizeof(struct multiboot_tag) */ - .align 8 - .globl Multiboot2_Header_end -_C_LABEL(Multiboot2_Header_end): -#endif /* MULTIBOOT */ - /* * Some hackage to deal with 64bit symbols in 32 bit mode. * This may not be needed if things are cleaned up a little. @@ -492,700 +440,6 @@ ENTRY(start) /* Warm boot */ movw $0x1234,0x472 -#if defined(MULTIBOOT) - jmp .Lnative_loader - - -multiboot2_entry: - .code64 - /* - * multiboot2 entry point. We are left here without - * stack and with no idea of where we were loaded in memory. - * The only inputs are - * %eax MULTIBOOT2_BOOTLOADER_MAGIC - * %ebx pointer to multiboot_info - * - * Here we will: - * - copy the kernel to 0x20 (KERNTEXTOFF - KERNBASE) - * as almost all the code in locore.S assume it is there. - * This is derived from - * src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S - * - copy multiboot_info, as done in multiboot_pre_reloc() from - * src/sys/arch/x86/x86/multiboot2.c - * Unfortunately we cannot call that function as there is - * no simple way to build it as 32 bit code in a 64 bit kernel. - * - Copy ELF symbols, also as in multiboot_pre_reloc() - */ - - cli - - /* - * Discover our load address and use it to get start address - */ - mov $_RELOC(tmpstk),%rsp - call next -next: pop %r8 - sub $(next - start), %r8 - - /* - * Save multiboot_info for later. We cannot use - * temporary stack for that since we are going to - * overwrite it. - */ - movl %ebx, (multiboot2_info_ptr - start)(%r8) - - /* - * Get relocated multiboot2_loader entry point in %r9 - */ - mov $(KERNTEXTOFF - KERNBASE), %r9 - add $(multiboot2_loader - kernel_text), %r9 - - /* Copy kernel */ - mov $(KERNTEXTOFF - KERNBASE), %rdi /* dest */ - mov %r8, %rsi - sub $(start - kernel_text), %rsi /* src */ - mov $(__kernel_end - kernel_text), %rcx /* size */ - mov %rcx, %r12 - movq %rdi, %r11 /* for misaligned check */ - -#if !defined(NO_OVERLAP) - movq %rdi, %r13 - subq %rsi, %r13 -#endif - - shrq $3, %rcx /* count for copy by words */ - jz 8f /* j if less than 8 bytes */ - - lea -8(%rdi, %r12), %r14 /* target address of last 8 */ - mov -8(%rsi, %r12), %r15 /* get last word */ -#if !defined(NO_OVERLAP) - cmpq %r12, %r13 /* overlapping? */ -
CVS commit: src/sys/arch/amd64
Module Name:src Committed By: manu Date: Thu Jan 9 00:42:24 UTC 2020 Modified Files: src/sys/arch/amd64/amd64: locore.S machdep.c src/sys/arch/amd64/conf: GENERIC files.amd64 kern.ldscript Log Message: Rollback multiboot2 for amd64, as requested by core To generate a diff of this commit: cvs rdiff -u -r1.197 -r1.198 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.344 -r1.345 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.553 -r1.554 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.114 -r1.115 src/sys/arch/amd64/conf/files.amd64 cvs rdiff -u -r1.30 -r1.31 src/sys/arch/amd64/conf/kern.ldscript 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/amd64
On Sun, Jan 05, 2020 at 02:43:43PM +0100, Maxime Villard wrote: > I have now requested to core@ that multiboot in amd64 be reverted entirely. So far I privilegied working on a fix to the boot problem that was reported, rather than spending time on a revert. This was not a futile effort, since at this point we have a fix that we agree on. My idea was to commit it and then to address the other points you raised, but if you cannot stand that, feel free to do the revert on your own. There is also this problem that seems worth spending time to me: http://mail-index.netbsd.org/tech-kern/2020/01/02/msg025911.html I hit this bug 100% reliabily with qemu/EFI, even with the multiboot stuff removed, and it seems to match what Masanobu Saitoh reported. I suspect the multiboot changes just undercovered it. -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/arch/amd64
On Sat, Jan 04, 2020 at 08:43:16AM +0100, Maxime Villard wrote: > +.section multiboot,"",@note > Why @note? It will be in the .text anyway. Also why no dot in the section > name? That's supposed to be the naming convention. The idea is that one day if ld gets more reasonable, it could go in non-loading note ection at the beginning of the binary, but if you prefer .text, let us go with that. On the section name, ELF specification says "Section names with a dot (.) prefix are reserved for the system" (TIS ELF specification version 1.2), section names without a dot are allowed, and we use plenty of them in our kernels (e.g.: link_set_* sections). Our naming convention is not obvious to me, nor what the specification means by "the system" here. My hunch would be to avoid using an abitratry name inside a reserved namespace, althought we already did it. If you have a strong opinion on it, I can stand a leading dot in the multiboot section name. > I don't know if you realize, but you landed a huge pile > of crap in the middle of the amd64 locore I have been working on this, but the priority was obviously the boot problem. Attached is my latest change set, including the locore cleanup you asked for. -- Emmanuel Dreyfus m...@netbsd.org Index: sys/arch/amd64/amd64/locore.S === RCS file: /cvsroot/src/sys/arch/amd64/amd64/locore.S,v retrieving revision 1.195 diff -U4 -r1.195 locore.S --- sys/arch/amd64/amd64/locore.S 15 Dec 2019 02:58:21 - 1.195 +++ sys/arch/amd64/amd64/locore.S 5 Jan 2020 00:41:18 - @@ -431,10 +431,10 @@ .size tmpstk, tmpstk - . .space 512 tmpstk: -.section multiboot,"a" #if defined(MULTIBOOT) +.section multiboot .align 8 .globl Multiboot2_Header _C_LABEL(Multiboot2_Header): .intMULTIBOOT2_HEADER_MAGIC @@ -473,9 +473,9 @@ .int8 /* sizeof(struct multiboot_tag) */ .align 8 .globl Multiboot2_Header_end _C_LABEL(Multiboot2_Header_end): -#endif /* MULTIBOOT */ +#endif /* MULTIBOOT */ /* * Some hackage to deal with 64bit symbols in 32 bit mode. * This may not be needed if things are cleaned up a little. @@ -544,109 +544,13 @@ mov $(KERNTEXTOFF - KERNBASE), %rdi /* dest */ mov %r8, %rsi sub $(start - kernel_text), %rsi/* src */ mov $(__kernel_end - kernel_text), %rcx /* size */ - mov %rcx, %r12 - movq%rdi, %r11 /* for misaligned check */ - -#if !defined(NO_OVERLAP) - movq%rdi, %r13 - subq%rsi, %r13 -#endif - - shrq$3, %rcx/* count for copy by words */ - jz 8f /* j if less than 8 bytes */ - - lea -8(%rdi, %r12), %r14/* target address of last 8 */ - mov -8(%rsi, %r12), %r15/* get last word */ -#if !defined(NO_OVERLAP) - cmpq%r12, %r13 /* overlapping? */ - jb 10f -#endif - -/* - * Non-overlaping, copy forwards. - * Newer Intel cpus (Nehalem) will do 16byte read/write transfers - * if %ecx is more than 76. - * AMD might do something similar some day. - */ - and $7, %r11/* destination misaligned ? */ - jnz 12f - rep - movsq - mov %r15, (%r14)/* write last word */ - jmp .Lcopy_done -/* - * Destination misaligned - * AMD say it is better to align the destination (not the source). - * This will also re-align copies if the source and dest are both - * misaligned by the same amount) - * (I think Nehalem will use its accelerated copy if the source - * and destination have the same alignment.) - */ -12: - lea -9(%r11, %r12), %rcx/* post re-alignment count */ - neg %r11/* now -1 .. -7 */ - mov (%rsi), %r12/* get first word */ - mov %rdi, %r13 /* target for first word */ - lea 8(%rsi, %r11), %rsi - lea 8(%rdi, %r11), %rdi - shr $3, %rcx - rep - movsq - mov %r12, (%r13)/* write first word */ - mov %r15, (%r14)/* write last word */ - jmp .Lcopy_done - -#if !defined(NO_OVERLAP) -/* Must copy backwards. - * Reverse copy is probably easy to code faster than 'rep movds' - * since that requires (IIRC) an extra clock every 3 iterations (AMD). - * However I don't suppose anything cares that much! - * The big cost is the std/cld pair - reputedly 50+ cycles on Netburst P4. - * The copy is aligned with the buffer start (more likely to - * be a multiple of 8 than the end). - */ -10: - lea -8(%rsi, %rcx, 8), %rsi - lea -8(%rdi, %rcx, 8), %rdi - std + /* Assume non overlap and aligned siz
Re: CVS commit: src/sys/arch/amd64
On Tue, Dec 31, 2019 at 09:32:05AM +0100, Maxime Villard wrote: > I think max-page-size=0x1000 is the right thing to do, but someone needs to > verify that the resulting binary is correct and that the resulting in-memory > layout is correct too. Attached is an updated patch with this approach. I tested at mine and it seems fine. I am especially interested by feedback from msaitoh@ who reported the crash at cpu attacch that I suspect to be the (probably unrelated) problem describred here: http://mail-index.netbsd.org/tech-kern/2020/01/02/msg025911.html -- Emmanuel Dreyfus m...@netbsd.org Index: sys/arch/amd64/amd64/locore.S === RCS file: /cvsroot/src/sys/arch/amd64/amd64/locore.S,v retrieving revision 1.195 diff -U4 -r1.195 locore.S --- sys/arch/amd64/amd64/locore.S 15 Dec 2019 02:58:21 - 1.195 +++ sys/arch/amd64/amd64/locore.S 4 Jan 2020 01:48:11 - @@ -431,10 +431,10 @@ .size tmpstk, tmpstk - . .space 512 tmpstk: -.section multiboot,"a" #if defined(MULTIBOOT) +.section multiboot,"",@note .align 8 .globl Multiboot2_Header _C_LABEL(Multiboot2_Header): .intMULTIBOOT2_HEADER_MAGIC Index: sys/arch/amd64/conf/GENERIC === RCS file: /cvsroot/src/sys/arch/amd64/conf/GENERIC,v retrieving revision 1.551 diff -U4 -r1.551 GENERIC --- sys/arch/amd64/conf/GENERIC 14 Dec 2019 07:45:20 - 1.551 +++ sys/arch/amd64/conf/GENERIC 4 Jan 2020 01:48:11 - @@ -25,9 +25,9 @@ #ident "GENERIC-$Revision: 1.551 $" maxusers 64 # estimated number of users -#options MULTIBOOT # Multiboot support (see multiboot(8)) +optionsMULTIBOOT # Multiboot support (see multiboot(8)) # delay between "rebooting ..." message and hardware reset, in milliseconds #options CPURESET_DELAY=2000 Index: sys/arch/amd64/conf/Makefile.amd64 === RCS file: /cvsroot/src/sys/arch/amd64/conf/Makefile.amd64,v retrieving revision 1.80 diff -U4 -r1.80 Makefile.amd64 --- sys/arch/amd64/conf/Makefile.amd64 14 Nov 2019 16:23:52 - 1.80 +++ sys/arch/amd64/conf/Makefile.amd64 4 Jan 2020 01:48:11 - @@ -90,12 +90,12 @@ ## (5) link settings ## TEXTADDR?= 0x8020 .if defined(KASLR) -EXTRA_LINKFLAGS= --split-by-file=0x10 -r -d +EXTRA_LINKFLAGS= --split-by-file=0x10 -z max-page-size=0x1000 -r -d KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript.kaslr .else -EXTRA_LINKFLAGS= -z max-page-size=0x20 +EXTRA_LINKFLAGS= -z max-page-size=0x1000 KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript .endif LINKFLAGS_NORMAL= -X Index: sys/arch/amd64/conf/kern.ldscript === RCS file: /cvsroot/src/sys/arch/amd64/conf/kern.ldscript,v retrieving revision 1.30 diff -U4 -r1.30 kern.ldscript --- sys/arch/amd64/conf/kern.ldscript 15 Dec 2019 02:56:40 - 1.30 +++ sys/arch/amd64/conf/kern.ldscript 4 Jan 2020 01:48:11 - @@ -12,20 +12,11 @@ ENTRY(_start) SECTIONS { - /* -* multiboot (file_offset) : AT (load_address) -* file_offset must be below 32k for multiboot 2 specification -* BIOS boot requires load_address above 0x20 -*/ - multiboot 0x1000 : AT (0x20) + .text : AT (ADDR(.text) & 0x0fff) { - . = ALIGN(8); KEEP(*(multiboot)); - } - .text : AT (0x20 + SIZEOF(multiboot)) - { . = ALIGN(__PAGE_SIZE); __text_user_start = . ; *(.text.user) . = ALIGN(__PAGE_SIZE);
Re: CVS commit: src/sys/arch/amd64
Masanobu SAITOH wrote: > I have a UEFI boot machine and it also doesn't boot well. > > - It hangs after attaching ioapic0, cpu0 or acpi0 (or something else). >The possibility is about 65% > - It sometimes panic in acpi_attach(), acpimcfg_probe or something else. >The possibility is about 10% > - It sometimes boot up. >The possibility is about 25% I suspect this is a second bug that was undercovered by the multiboot change. I get crashes like the one you report 100% reproductible with qemu UEFI boot. I described the thing here: http://mail-index.netbsd.org/tech-kern/2020/01/02/msg025911.html Could you check with ddb the physical address accessed? Here is the relevant excerpt in the message I posted: db{0}> x/i $rip netbsd:kmem_intr_alloc+0x64:movq%r12,0(%rax) db{0}> print $rax 92057868 db{0}> call vtophys(92057868) 108 If you can add a #define DEBUG_MEMMAP 1 at the beginning of src/sys/arch/x86/x86/efi.c and x86_machdep.c you will also have the memory map provided by UEFI. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
Re: CVS commit: src/sys/arch/amd64
On Sat, Dec 28, 2019 at 02:22:21AM +, Emmanuel Dreyfus wrote: > > Regardless of whether it is needed in this specific case, cutting the 2MBs > > of zero in the binary is wanted. Unfortunately last I looked at this (two > > years ago) there were some non-obvious consequences, and it needs to be > > carefully done. > > Any hints about the problems you encountered? Perhaps we can work it > around with an . = ALIGN(__LARGEE_PAGE_SIZE); before including .text.user ? No anwser here? It is difficult to address an unknown problem... -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/arch/amd64
On Fri, Dec 27, 2019 at 06:24:07PM +0100, Maxime Villard wrote: > Now that I'm looking at i386 I see you've indeed made the same nonsensical > changes there, with all the unnecessary garbage in the code. Here I assume you refer to the starting at efi_multiboot2_loader, since most of the other significant multiboot stuff has been there for 13 years. It is copied from bootloader's startprog.S. How do you suggest to improve it? -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/arch/amd64
On Fri, Dec 27, 2019 at 06:24:07PM +0100, Maxime Villard wrote: > .text : AT (ADDR(.text) & 0x0fff) > { > + *(.multiboot) > + > . = ALIGN(__PAGE_SIZE); > __text_user_start = . ; > ... > > This guarantees that the structure is at the beginning of text. That works. We can even make the multiboot section a note, for the sake on cleanliness. (see attached patch. MULTIBOOT is enabled for testing). > Regardless of whether it is needed in this specific case, cutting the 2MBs > of zero in the binary is wanted. Unfortunately last I looked at this (two > years ago) there were some non-obvious consequences, and it needs to be > carefully done. Any hints about the problems you encountered? Perhaps we can work it around with an . = ALIGN(__LARGEE_PAGE_SIZE); before including .text.user ? > Also, my previous remarks haven't been addressed entirely, and still stand. Sure, it's just next in the todo list. -- Emmanuel Dreyfus m...@netbsd.org ? sys/arch/amd64/compile/obj ? sys/arch/amd64/stand/prekern/obj Index: sys/arch/amd64/amd64/locore.S === RCS file: /cvsroot/src/sys/arch/amd64/amd64/locore.S,v retrieving revision 1.195 diff -U4 -r1.195 locore.S --- sys/arch/amd64/amd64/locore.S 15 Dec 2019 02:58:21 - 1.195 +++ sys/arch/amd64/amd64/locore.S 28 Dec 2019 01:41:03 - @@ -431,10 +431,10 @@ .size tmpstk, tmpstk - . .space 512 tmpstk: -.section multiboot,"a" #if defined(MULTIBOOT) +.section multiboot,"",@note .align 8 .globl Multiboot2_Header _C_LABEL(Multiboot2_Header): .intMULTIBOOT2_HEADER_MAGIC Index: sys/arch/amd64/conf/GENERIC === RCS file: /cvsroot/src/sys/arch/amd64/conf/GENERIC,v retrieving revision 1.551 diff -U4 -r1.551 GENERIC --- sys/arch/amd64/conf/GENERIC 14 Dec 2019 07:45:20 - 1.551 +++ sys/arch/amd64/conf/GENERIC 28 Dec 2019 01:41:03 - @@ -25,9 +25,9 @@ #ident "GENERIC-$Revision: 1.551 $" maxusers 64 # estimated number of users -#options MULTIBOOT # Multiboot support (see multiboot(8)) +optionsMULTIBOOT # Multiboot support (see multiboot(8)) # delay between "rebooting ..." message and hardware reset, in milliseconds #options CPURESET_DELAY=2000 Index: sys/arch/amd64/conf/Makefile.amd64 === RCS file: /cvsroot/src/sys/arch/amd64/conf/Makefile.amd64,v retrieving revision 1.80 diff -U4 -r1.80 Makefile.amd64 --- sys/arch/amd64/conf/Makefile.amd64 14 Nov 2019 16:23:52 - 1.80 +++ sys/arch/amd64/conf/Makefile.amd64 28 Dec 2019 01:41:03 - @@ -90,12 +90,12 @@ ## (5) link settings ## TEXTADDR?= 0x8020 .if defined(KASLR) -EXTRA_LINKFLAGS= --split-by-file=0x10 -r -d +EXTRA_LINKFLAGS= --split-by-file=0x10 -r -d -n KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript.kaslr .else -EXTRA_LINKFLAGS= -z max-page-size=0x20 +EXTRA_LINKFLAGS= -z max-page-size=0x20 -n KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript .endif LINKFLAGS_NORMAL= -X Index: sys/arch/amd64/conf/kern.ldscript === RCS file: /cvsroot/src/sys/arch/amd64/conf/kern.ldscript,v retrieving revision 1.30 diff -U4 -r1.30 kern.ldscript --- sys/arch/amd64/conf/kern.ldscript 15 Dec 2019 02:56:40 - 1.30 +++ sys/arch/amd64/conf/kern.ldscript 28 Dec 2019 01:41:03 - @@ -12,20 +12,11 @@ ENTRY(_start) SECTIONS { - /* -* multiboot (file_offset) : AT (load_address) -* file_offset must be below 32k for multiboot 2 specification -* BIOS boot requires load_address above 0x20 -*/ - multiboot 0x1000 : AT (0x20) + .text : AT (ADDR(.text) & 0x0fff) { - . = ALIGN(8); KEEP(*(multiboot)); - } - .text : AT (0x20 + SIZEOF(multiboot)) - { . = ALIGN(__PAGE_SIZE); __text_user_start = . ; *(.text.user) . = ALIGN(__PAGE_SIZE);
Re: CVS commit: src/sys/arch/amd64
On Fri, Dec 27, 2019 at 09:02:17AM +0100, Maxime Villard wrote: > Please stop with the nonsense... In this patch you are making the multiboot > header executable, and putting it in a section shared with userland under > SVS. Neither should be required; more than that, both are absolutely _not_ > wanted. What are the actual drawbacks? FWIW, this is in line with how it was done on i386: it is just stored at the beginning of .text. Xen does the same. Of course it seems more natural to store that in a note section this is not loaded, but after experimenting a lot, I am not sure it can be done, since ld really want to push notes at the end of the file. -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/arch/amd64
On Wed, Dec 25, 2019 at 05:05:11PM +0900, Masanobu SAITOH wrote: > >> After this change, amd64 kernel does not boot on my HP Spectre x360 > >> 13-inch ae019TU laptop with pure UEFI boot mode. > I have a UEFI boot machine and it also doesn't boot well. Please try the attached patch. It adds the -n flag to ld, which disable auto-alignment of sections in the file. I undestand alignement is highly desirable for userland programs that may be mapped from file, but useless for the kernel, which is just readen once by the bootloader. Without auto-alignement, the .text segment starts right after the ELF headers. This means the multiboot header can go in .text and stay below 32k (as required by the multiboot specification). There is no need for a multiboot section for that, and therefore no need to modify the linker script. A side effect is that the kernel file shrinks of 2 MB, because there is not an alignement hole between ELF headers and the .text section anymore. My patch also enable the MULTIBOOT option so that we can check nothing gets broken with it. You can also try with the option disabled, of course. -- Emmanuel Dreyfus m...@netbsd.org ? sys/arch/amd64/compile/obj ? sys/arch/amd64/stand/prekern/obj Index: sys/arch/amd64/amd64/locore.S === RCS file: /cvsroot/src/sys/arch/amd64/amd64/locore.S,v retrieving revision 1.195 diff -U4 -r1.195 locore.S --- sys/arch/amd64/amd64/locore.S 15 Dec 2019 02:58:21 - 1.195 +++ sys/arch/amd64/amd64/locore.S 26 Dec 2019 16:44:10 - @@ -431,51 +431,8 @@ .size tmpstk, tmpstk - . .space 512 tmpstk: -.section multiboot,"a" -#if defined(MULTIBOOT) - .align 8 - .globl Multiboot2_Header -_C_LABEL(Multiboot2_Header): - .intMULTIBOOT2_HEADER_MAGIC - .intMULTIBOOT2_ARCHITECTURE_I386 - .intMultiboot2_Header_end - Multiboot2_Header - .int-(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_ARCHITECTURE_I386 \ - + (Multiboot2_Header_end - Multiboot2_Header)) - - .int1 /* MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST */ - .int12 /* sizeof(multiboot_header_tag_information_request) */ - /* + sizeof(uint32_t) * requests */ - .int4 /* MULTIBOOT_TAG_TYPE_BASIC_MEMINFO */ - .align 8 - - .int3 /* MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS */ - .int16 /* sizeof(struct multiboot_tag_efi64) */ - .quad (multiboot2_entry - KERNBASE) - .align 8 - - .int9 /* MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 */ - .int16 /* sizeof(struct multiboot_tag_efi64) */ - .quad (multiboot2_entry - KERNBASE) - .align 8 - -#if notyet - /* -* Could be used to get an early console for debug, -* but this is broken. -*/ - .int7 /* MULTIBOOT_HEADER_TAG_EFI_BS */ - .int8 /* sizeof(struct multiboot_tag) */ - .align 8 -#endif - - .int0 /* MULTIBOOT_HEADER_TAG_END */ - .int8 /* sizeof(struct multiboot_tag) */ - .align 8 - .globl Multiboot2_Header_end -_C_LABEL(Multiboot2_Header_end): -#endif /* MULTIBOOT */ /* * Some hackage to deal with 64bit symbols in 32 bit mode. * This may not be needed if things are cleaned up a little. @@ -2179,8 +2136,50 @@ SYSCALL_ENTRY syscall,is_svs=0 TEXT_USER_BEGIN +#if defined(MULTIBOOT) + .align 8 + .globl Multiboot2_Header +_C_LABEL(Multiboot2_Header): + .intMULTIBOOT2_HEADER_MAGIC + .intMULTIBOOT2_ARCHITECTURE_I386 + .intMultiboot2_Header_end - Multiboot2_Header + .int-(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_ARCHITECTURE_I386 \ + + (Multiboot2_Header_end - Multiboot2_Header)) + + .int1 /* MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST */ + .int12 /* sizeof(multiboot_header_tag_information_request) */ + /* + sizeof(uint32_t) * requests */ + .int4 /* MULTIBOOT_TAG_TYPE_BASIC_MEMINFO */ + .align 8 + + .int3 /* MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS */ + .int16 /* sizeof(struct multiboot_tag_efi64) */ + .quad (multiboot2_entry - KERNBASE) + .align 8 + + .int9 /* MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 */ + .int16 /* sizeof(struct multiboot_tag_efi64) */ + .quad (multiboot2_entry - KERNBASE) + .align 8 + +#if notyet + /* +* Could be used to get an early console for debug, +* but this is broken. +*/ + .int7 /* MULTIBOOT_HEADER_TAG_EFI_BS */ + .int8 /* sizeof(struct multiboot_tag) */ + .align 8 +#endif + + .int0 /* MULTIBOOT_HEADER_TAG_END */ + .int8 /* sizeof(struct multiboot_tag) */ +
Re: CVS commit: src/sys/arch/amd64
On Wed, Dec 25, 2019 at 05:05:11PM +0900, Masanobu SAITOH wrote: > - It hangs after attaching ioapic0, cpu0 or acpi0 (or something else). >The possibility is about 65% What is the backtace? Does it goes through svs_init? -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/arch/amd64
On Wed, Dec 25, 2019 at 07:42:47PM +0900, Ryo ONODERA wrote: > The attached patch works for me. > However I have no idea about the meaning. It changes the multiboot section from DATA to CODE, which is odd but perfectly fine. I cannot understand how it can change the situation, though. Did it really fix the problem? Your next message about reverted kern.ldscript confuses me. -- Emmanuel Dreyfus m...@netbsd.org
Re: CVS commit: src/sys/arch/amd64
On Tue, Dec 24, 2019 at 05:50:00PM +0900, Ryo ONODERA wrote: > After this change, amd64 kernel does not boot on my HP Spectre x360 > 13-inch ae019TU laptop with pure UEFI boot mode. Hello Does the attached patch (crafted for port-amd64/54775) fix the problem? -- Emmanuel Dreyfus m...@netbsd.org Index: sys/arch/amd64/amd64/locore.S === RCS file: /cvsroot/src/sys/arch/amd64/amd64/locore.S,v retrieving revision 1.195 diff -U4 -r1.195 locore.S --- sys/arch/amd64/amd64/locore.S 15 Dec 2019 02:58:21 - 1.195 +++ sys/arch/amd64/amd64/locore.S 22 Dec 2019 02:23:11 - @@ -432,10 +432,10 @@ .space 512 tmpstk: .section multiboot,"a" -#if defined(MULTIBOOT) .align 8 +#if defined(MULTIBOOT) .globl Multiboot2_Header _C_LABEL(Multiboot2_Header): .intMULTIBOOT2_HEADER_MAGIC .intMULTIBOOT2_ARCHITECTURE_I386 @@ -473,8 +473,11 @@ .int8 /* sizeof(struct multiboot_tag) */ .align 8 .globl Multiboot2_Header_end _C_LABEL(Multiboot2_Header_end): +#else /* MULTIBOOT */ + .int0xdeadbeef /* have some non empty content */ + .align 8 #endif /* MULTIBOOT */ /* * Some hackage to deal with 64bit symbols in 32 bit mode.
CVS commit: src/sys/arch/i386/stand
Module Name:src Committed By: manu Date: Tue Dec 17 01:37:53 UTC 2019 Modified Files: src/sys/arch/i386/stand/efiboot: efidisk.c src/sys/arch/i386/stand/lib: biosdisk.c Log Message: Do not use NAME=label syntax when label are empty When booting sysinst from UEFI, it defaults to a GPT installation where partition have no labels. Bootstrap used the NAME=label partition anyway, with the result that both EFI and FFS root partition had the same name "NAME=" and could not be distinguished. The first matching partition for the name was used, and bootstrap looked for the kernel in the EFI partition. We fix that by not using NAME=label names for partition when label is empty. In that case we revert to old syntax such as hd0b To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/efidisk.c cvs rdiff -u -r1.53 -r1.54 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
Module Name:src Committed By: manu Date: Tue Dec 17 01:37:53 UTC 2019 Modified Files: src/sys/arch/i386/stand/efiboot: efidisk.c src/sys/arch/i386/stand/lib: biosdisk.c Log Message: Do not use NAME=label syntax when label are empty When booting sysinst from UEFI, it defaults to a GPT installation where partition have no labels. Bootstrap used the NAME=label partition anyway, with the result that both EFI and FFS root partition had the same name "NAME=" and could not be distinguished. The first matching partition for the name was used, and bootstrap looked for the kernel in the EFI partition. We fix that by not using NAME=label names for partition when label is empty. In that case we revert to old syntax such as hd0b To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/efidisk.c cvs rdiff -u -r1.53 -r1.54 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/efiboot/efidisk.c diff -u src/sys/arch/i386/stand/efiboot/efidisk.c:1.8 src/sys/arch/i386/stand/efiboot/efidisk.c:1.9 --- src/sys/arch/i386/stand/efiboot/efidisk.c:1.8 Sun Aug 18 02:18:24 2019 +++ src/sys/arch/i386/stand/efiboot/efidisk.c Tue Dec 17 01:37:52 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: efidisk.c,v 1.8 2019/08/18 02:18:24 manu Exp $ */ +/* $NetBSD: efidisk.c,v 1.9 2019/12/17 01:37:52 manu Exp $ */ /*- * Copyright (c) 2016 Kimihiro Nonaka @@ -253,7 +253,7 @@ efi_disk_show(void) printf(" "); first = false; } - if (part[i].part_name != NULL) + if (part[i].part_name && part[i].part_name[0]) printf(" NAME=%s(", part[i].part_name); else printf(" hd%d%c(", edi->dev & 0x7f, i + 'a'); @@ -308,7 +308,7 @@ efi_disk_show(void) printf(" "); first = 0; } - if (part[j].part_name != NULL) + if (part[j].part_name && part[j].part_name[0]) printf(" NAME=%s(", part[j].part_name); else printf(" raid%d%c(", Index: src/sys/arch/i386/stand/lib/biosdisk.c diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.53 src/sys/arch/i386/stand/lib/biosdisk.c:1.54 --- src/sys/arch/i386/stand/lib/biosdisk.c:1.53 Tue Dec 10 02:02:47 2019 +++ src/sys/arch/i386/stand/lib/biosdisk.c Tue Dec 17 01:37:53 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: biosdisk.c,v 1.53 2019/12/10 02:02:47 manu Exp $ */ +/* $NetBSD: biosdisk.c,v 1.54 2019/12/17 01:37:53 manu Exp $ */ /* * Copyright (c) 1996, 1998 @@ -908,7 +908,8 @@ biosdisk_probe(void) first = 0; } #ifndef NO_GPT - if (d->part[part].part_name != NULL) + if (d->part[part].part_name && + d->part[part].part_name[0]) printf(" NAME=%s(", d->part[part].part_name); else #endif @@ -987,7 +988,8 @@ next_disk: first = 0; } #ifndef NO_GPT - if (d->part[part].part_name != NULL) + if (d->part[part].part_name && + d->part[part].part_name[0]) printf(" NAME=%s(", d->part[part].part_name); else #endif @@ -1095,7 +1097,9 @@ biosdisk_findpartition(int biosdev, dadd *partition = boot_part; #ifndef NO_GPT - if (part_name && d->part[boot_part].part_name) { + if (part_name && + d->part[boot_part].part_name && + d->part[boot_part].part_name[0]) { strlcpy(namebuf, d->part[boot_part].part_name, BIOSDISK_PART_NAME_LEN); *part_name = namebuf;
CVS commit: src/sys/arch/amd64/amd64
Module Name:src Committed By: manu Date: Sun Dec 15 02:58:22 UTC 2019 Modified Files: src/sys/arch/amd64/amd64: locore.S Log Message: Fix typo that caused two instructions to be commented out Oddly, that did not break booting. To generate a diff of this commit: cvs rdiff -u -r1.194 -r1.195 src/sys/arch/amd64/amd64/locore.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/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.194 src/sys/arch/amd64/amd64/locore.S:1.195 --- src/sys/arch/amd64/amd64/locore.S:1.194 Sun Dec 15 02:56:40 2019 +++ src/sys/arch/amd64/amd64/locore.S Sun Dec 15 02:58:21 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.194 2019/12/15 02:56:40 manu Exp $ */ +/* $NetBSD: locore.S,v 1.195 2019/12/15 02:58:21 manu Exp $ */ /* * Copyright-o-rama! @@ -544,7 +544,7 @@ next: pop %r8 mov $(KERNTEXTOFF - KERNBASE), %rdi /* dest */ mov %r8, %rsi sub $(start - kernel_text), %rsi /* src */ - mov $(__kernel_end - kernel_text), %rcx /* size *. + mov $(__kernel_end - kernel_text), %rcx /* size */ mov %rcx, %r12 movq %rdi, %r11 /* for misaligned check */
CVS commit: src/sys/arch/amd64/amd64
Module Name:src Committed By: manu Date: Sun Dec 15 02:58:22 UTC 2019 Modified Files: src/sys/arch/amd64/amd64: locore.S Log Message: Fix typo that caused two instructions to be commented out Oddly, that did not break booting. To generate a diff of this commit: cvs rdiff -u -r1.194 -r1.195 src/sys/arch/amd64/amd64/locore.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/amd64
Module Name:src Committed By: manu Date: Sun Dec 15 02:56:40 UTC 2019 Modified Files: src/sys/arch/amd64/amd64: locore.S src/sys/arch/amd64/conf: kern.ldscript Log Message: Restore multiboot 2 header in amd64 kernel The header must appear below 32k offset in the kernel file, but we have to make sure it does not load at low addresses, otherwise we break BIOS boot. .text section used to load at 0x20, we just load multiboot section there, and have .text loaded just after. To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/conf/kern.ldscript Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/amd64
Module Name:src Committed By: manu Date: Sun Dec 15 02:56:40 UTC 2019 Modified Files: src/sys/arch/amd64/amd64: locore.S src/sys/arch/amd64/conf: kern.ldscript Log Message: Restore multiboot 2 header in amd64 kernel The header must appear below 32k offset in the kernel file, but we have to make sure it does not load at low addresses, otherwise we break BIOS boot. .text section used to load at 0x20, we just load multiboot section there, and have .text loaded just after. To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/conf/kern.ldscript 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/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.193 src/sys/arch/amd64/amd64/locore.S:1.194 --- src/sys/arch/amd64/amd64/locore.S:1.193 Tue Dec 10 02:06:07 2019 +++ src/sys/arch/amd64/amd64/locore.S Sun Dec 15 02:56:40 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.193 2019/12/10 02:06:07 manu Exp $ */ +/* $NetBSD: locore.S,v 1.194 2019/12/15 02:56:40 manu Exp $ */ /* * Copyright-o-rama! @@ -432,7 +432,7 @@ END(farjmp64) .space 512 tmpstk: -.section multiboot,"ax",@progbits +.section multiboot,"a" #if defined(MULTIBOOT) .align 8 .globl Multiboot2_Header Index: src/sys/arch/amd64/conf/kern.ldscript diff -u src/sys/arch/amd64/conf/kern.ldscript:1.29 src/sys/arch/amd64/conf/kern.ldscript:1.30 --- src/sys/arch/amd64/conf/kern.ldscript:1.29 Wed Dec 11 02:31:44 2019 +++ src/sys/arch/amd64/conf/kern.ldscript Sun Dec 15 02:56:40 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern.ldscript,v 1.29 2019/12/11 02:31:44 manu Exp $ */ +/* $NetBSD: kern.ldscript,v 1.30 2019/12/15 02:56:40 manu Exp $ */ #include "assym.h" @@ -13,7 +13,17 @@ __LARGE_PAGE_SIZE = 0x20 ; ENTRY(_start) SECTIONS { - .text : AT (ADDR(.text) & 0x0fff) + /* + * multiboot (file_offset) : AT (load_address) + * file_offset must be below 32k for multiboot 2 specification + * BIOS boot requires load_address above 0x20 + */ + multiboot 0x1000 : AT (0x20) + { + . = ALIGN(8); + KEEP(*(multiboot)); + } + .text : AT (0x20 + SIZEOF(multiboot)) { . = ALIGN(__PAGE_SIZE); __text_user_start = . ;
Re: CVS commit: src/sys/arch (multiboot2 support)
Paul Goyette wrote: > This commit seems to have broken amd64 booting! When booting into > a qemu environment (as set up by misc/py-anita), it just hangs while > printing the "progress numbers with the spinny cursor". Others on > irc/icb have indicated an immediate crash. I rolled back the change to sys/arch/amd64/conf/kern.ldscript, this should fix BIOS boot. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
CVS commit: src/sys/arch/amd64/conf
Module Name:src Committed By: manu Date: Wed Dec 11 02:31:45 UTC 2019 Modified Files: src/sys/arch/amd64/conf: kern.ldscript Log Message: Rollback kernel link scrpt change for multiboot The multiboot section breaks BIOS boot. Rolling back the link script removes the section, which breaks multiboot but should restore BIOS boot. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amd64/conf/kern.ldscript 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/amd64/conf/kern.ldscript diff -u src/sys/arch/amd64/conf/kern.ldscript:1.28 src/sys/arch/amd64/conf/kern.ldscript:1.29 --- src/sys/arch/amd64/conf/kern.ldscript:1.28 Tue Dec 10 02:06:07 2019 +++ src/sys/arch/amd64/conf/kern.ldscript Wed Dec 11 02:31:44 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern.ldscript,v 1.28 2019/12/10 02:06:07 manu Exp $ */ +/* $NetBSD: kern.ldscript,v 1.29 2019/12/11 02:31:44 manu Exp $ */ #include "assym.h" @@ -13,13 +13,9 @@ __LARGE_PAGE_SIZE = 0x20 ; ENTRY(_start) SECTIONS { - multiboot 0x4000 : - { - KEEP(*(multiboot)); - } .text : AT (ADDR(.text) & 0x0fff) { - . = ALIGN(__LARGE_PAGE_SIZE); + . = ALIGN(__PAGE_SIZE); __text_user_start = . ; *(.text.user) . = ALIGN(__PAGE_SIZE);
CVS commit: src/sys/arch/amd64/conf
Module Name:src Committed By: manu Date: Wed Dec 11 02:31:45 UTC 2019 Modified Files: src/sys/arch/amd64/conf: kern.ldscript Log Message: Rollback kernel link scrpt change for multiboot The multiboot section breaks BIOS boot. Rolling back the link script removes the section, which breaks multiboot but should restore BIOS boot. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amd64/conf/kern.ldscript 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 (multiboot2 support)
Paul Goyette wrote: > This commit seems to have broken amd64 booting! When booting into > a qemu environment (as set up by misc/py-anita), it just hangs while > printing the "progress numbers with the spinny cursor". Others on > irc/icb have indicated an immediate crash. > > Seems like non-efi booting is borked. This is caused by sys/arch/amd64/conf/kern.ldscript 1.27-1.28 I will fix that within a few hours. -- Emmanuel Dreyfus http://hcpnet.free.fr/pubz m...@netbsd.org
CVS commit: src/sys/arch
Module Name:src Committed By: manu Date: Tue Dec 10 02:06:07 UTC 2019 Modified Files: src/sys/arch/amd64/amd64: locore.S machdep.c src/sys/arch/amd64/conf: GENERIC files.amd64 kern.ldscript src/sys/arch/x86/x86: efi.c multiboot2.c Log Message: Add multiboot 2 support to amd64 kernel To generate a diff of this commit: cvs rdiff -u -r1.192 -r1.193 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.342 -r1.343 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.548 -r1.549 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.113 -r1.114 src/sys/arch/amd64/conf/files.amd64 cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amd64/conf/kern.ldscript cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/x86/efi.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/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
Module Name:src Committed By: manu Date: Tue Dec 10 02:06:07 UTC 2019 Modified Files: src/sys/arch/amd64/amd64: locore.S machdep.c src/sys/arch/amd64/conf: GENERIC files.amd64 kern.ldscript src/sys/arch/x86/x86: efi.c multiboot2.c Log Message: Add multiboot 2 support to amd64 kernel To generate a diff of this commit: cvs rdiff -u -r1.192 -r1.193 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.342 -r1.343 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.548 -r1.549 src/sys/arch/amd64/conf/GENERIC cvs rdiff -u -r1.113 -r1.114 src/sys/arch/amd64/conf/files.amd64 cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amd64/conf/kern.ldscript cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/x86/efi.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/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/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.192 src/sys/arch/amd64/amd64/locore.S:1.193 --- src/sys/arch/amd64/amd64/locore.S:1.192 Fri Nov 22 23:36:25 2019 +++ src/sys/arch/amd64/amd64/locore.S Tue Dec 10 02:06:07 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.192 2019/11/22 23:36:25 ad Exp $ */ +/* $NetBSD: locore.S,v 1.193 2019/12/10 02:06:07 manu Exp $ */ /* * Copyright-o-rama! @@ -158,6 +158,7 @@ #include "opt_compat_netbsd.h" #include "opt_compat_netbsd32.h" +#include "opt_multiboot.h" #include "opt_xen.h" #include "opt_svs.h" @@ -177,6 +178,13 @@ #include #include +#ifndef XENPV +#include +#endif + +#define CODE_SEGMENT 0x08 +#define DATA_SEGMENT 0x10 + #if NLAPIC > 0 #include #endif @@ -424,6 +432,50 @@ END(farjmp64) .space 512 tmpstk: +.section multiboot,"ax",@progbits +#if defined(MULTIBOOT) + .align 8 + .globl Multiboot2_Header +_C_LABEL(Multiboot2_Header): + .int MULTIBOOT2_HEADER_MAGIC + .int MULTIBOOT2_ARCHITECTURE_I386 + .int Multiboot2_Header_end - Multiboot2_Header + .int -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_ARCHITECTURE_I386 \ + + (Multiboot2_Header_end - Multiboot2_Header)) + + .int 1 /* MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST */ + .int 12 /* sizeof(multiboot_header_tag_information_request) */ + /* + sizeof(uint32_t) * requests */ + .int 4 /* MULTIBOOT_TAG_TYPE_BASIC_MEMINFO */ + .align 8 + + .int 3 /* MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS */ + .int 16 /* sizeof(struct multiboot_tag_efi64) */ + .quad (multiboot2_entry - KERNBASE) + .align 8 + + .int 9 /* MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 */ + .int 16 /* sizeof(struct multiboot_tag_efi64) */ + .quad (multiboot2_entry - KERNBASE) + .align 8 + +#if notyet + /* + * Could be used to get an early console for debug, + * but this is broken. + */ + .int 7 /* MULTIBOOT_HEADER_TAG_EFI_BS */ + .int 8 /* sizeof(struct multiboot_tag) */ + .align 8 +#endif + + .int 0 /* MULTIBOOT_HEADER_TAG_END */ + .int 8 /* sizeof(struct multiboot_tag) */ + .align 8 + .globl Multiboot2_Header_end +_C_LABEL(Multiboot2_Header_end): +#endif /* MULTIBOOT */ + /* * Some hackage to deal with 64bit symbols in 32 bit mode. * This may not be needed if things are cleaned up a little. @@ -440,6 +492,700 @@ ENTRY(start) /* Warm boot */ movw $0x1234,0x472 +#if defined(MULTIBOOT) + jmp .Lnative_loader + + +multiboot2_entry: + .code64 + /* + * multiboot2 entry point. We are left here without + * stack and with no idea of where we were loaded in memory. + * The only inputs are + * %eax MULTIBOOT2_BOOTLOADER_MAGIC + * %ebx pointer to multiboot_info + * + * Here we will: + * - copy the kernel to 0x20 (KERNTEXTOFF - KERNBASE) + * as almost all the code in locore.S assume it is there. + * This is derived from + * src/sys/arch/i386/stand/efiboot/bootx64/startprog64.S + * - copy multiboot_info, as done in multiboot_pre_reloc() from + * src/sys/arch/x86/x86/multiboot2.c + * Unfortunately we cannot call that function as there is + * no simple way to build it as 32 bit code in a 64 bit kernel. + * - Copy ELF symbols, also as in multiboot_pre_reloc() + */ + + cli + + /* + * Discover our load address and use it to get start address + */ + mov $_RELOC(tmpstk),%rsp + call next +next: pop %r8 + sub $(next - start), %r8 + + /* + * Save multiboot_info for later. We cannot use + * temporary stack for that since we are going to + * overwrite it. + */ + movl %ebx, (multiboot2_info_ptr - start)(%r8) + + /* + * Get relocated multiboot2_loader entry point in %r9 + */ + mov $(KERNTEXTOFF - KERNBASE), %r9 + add $(multiboot2_loader - kernel_text), %r9 + + /* Copy kernel */ + mov $(KERNTEXTOFF - KERNBASE), %rdi /* dest */ + mov %r8, %rsi + sub $(start - kernel_text), %rsi /* src */ + mov $(__kernel_end - kernel_text), %rcx /* size *. + mov %rcx, %r12 + movq %rdi, %r11 /* for misaligned check */ + +#if !defined(NO_OVERLAP) + movq %rdi, %r13 + subq %rsi, %r13 +#endif + + shrq $3, %rcx /* count for copy by words */ + jz 8f /* j if less than 8 bytes */ + + lea
CVS commit: src/sys/arch/i386/stand
Module Name:src Committed By: manu Date: Tue Dec 10 02:02:48 UTC 2019 Modified Files: src/sys/arch/i386/stand/boot: devopen.c src/sys/arch/i386/stand/efiboot: devopen.c src/sys/arch/i386/stand/lib: biosdisk.c Log Message: In-RAID partitions with no name can be candidate for booting The code to select boot partition in RAID assumed thet had a name, which is true when there is a GPT inside the RAID, but not when there is a disklabel inside the RAID. This caused a regression from behavior of NetBSD 8.1. We fix this by allowing nameless partition to be boot candidates. This fixes misc/54748 While there, let raid device be used in the boot specification, like raid0a:/netbsd. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/boot/devopen.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/devopen.c cvs rdiff -u -r1.52 -r1.53 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/boot/devopen.c diff -u src/sys/arch/i386/stand/boot/devopen.c:1.9 src/sys/arch/i386/stand/boot/devopen.c:1.10 --- src/sys/arch/i386/stand/boot/devopen.c:1.9 Sun Aug 18 02:18:24 2019 +++ src/sys/arch/i386/stand/boot/devopen.c Tue Dec 10 02:02:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: devopen.c,v 1.9 2019/08/18 02:18:24 manu Exp $ */ +/* $NetBSD: devopen.c,v 1.10 2019/12/10 02:02:47 manu Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -156,7 +156,7 @@ devopen(struct open_file *f, const char if (strstr(devname, "raid") == devname) { f->f_dev = [0]; /* must be biosdisk */ - return biosdisk_open_name(f, devname); + return biosdisk_open_name(f, fname); } #endif Index: src/sys/arch/i386/stand/efiboot/devopen.c diff -u src/sys/arch/i386/stand/efiboot/devopen.c:1.8 src/sys/arch/i386/stand/efiboot/devopen.c:1.9 --- src/sys/arch/i386/stand/efiboot/devopen.c:1.8 Thu Sep 26 12:21:03 2019 +++ src/sys/arch/i386/stand/efiboot/devopen.c Tue Dec 10 02:02:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: devopen.c,v 1.8 2019/09/26 12:21:03 nonaka Exp $ */ +/* $NetBSD: devopen.c,v 1.9 2019/12/10 02:02:47 manu Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -151,6 +151,7 @@ int devopen(struct open_file *f, const char *fname, char **file) { char *fsname, *devname; + const char *xname = NULL; int unit, partition; int biosdev; int i, error; @@ -172,8 +173,12 @@ devopen(struct open_file *f, const char nfsys = nfsys_disk; /* Search by GPT label or raidframe name */ - if ((strstr(devname, "NAME=") == devname) || - (strstr(devname, "raid") == devname)) { + if (strstr(devname, "NAME=") == devname) + xname = devname; + if (strstr(devname, "raid") == devname) + xname = fname; + + if (xname != NULL) { f->f_dev = [0]; /* must be biosdisk */ if (!kernel_loaded) { @@ -181,7 +186,7 @@ devopen(struct open_file *f, const char BI_ADD(, BTINFO_BOOTPATH, sizeof(bibp)); } - error = biosdisk_open_name(f, devname); + error = biosdisk_open_name(f, xname); return error; } Index: src/sys/arch/i386/stand/lib/biosdisk.c diff -u src/sys/arch/i386/stand/lib/biosdisk.c:1.52 src/sys/arch/i386/stand/lib/biosdisk.c:1.53 --- src/sys/arch/i386/stand/lib/biosdisk.c:1.52 Fri Sep 13 02:19:46 2019 +++ src/sys/arch/i386/stand/lib/biosdisk.c Tue Dec 10 02:02:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: biosdisk.c,v 1.52 2019/09/13 02:19:46 manu Exp $ */ +/* $NetBSD: biosdisk.c,v 1.53 2019/12/10 02:02:47 manu Exp $ */ /* * Copyright (c) 1996, 1998 @@ -1401,9 +1401,9 @@ next_disk: continue; if (d->part[part].fstype == FS_UNUSED) continue; - if (d->part[part].part_name == NULL) -continue; - if (strcmp(d->part[part].part_name, name) == 0) { + + if (d->part[part].part_name != NULL && + strcmp(d->part[part].part_name, name) == 0) { *biosdev = raidframe[i].biosdev; *offset = raidframe[i].offset + RF_PROTECTED_SECTORS
CVS commit: src/sys/arch/i386/stand
Module Name:src Committed By: manu Date: Tue Dec 10 02:02:48 UTC 2019 Modified Files: src/sys/arch/i386/stand/boot: devopen.c src/sys/arch/i386/stand/efiboot: devopen.c src/sys/arch/i386/stand/lib: biosdisk.c Log Message: In-RAID partitions with no name can be candidate for booting The code to select boot partition in RAID assumed thet had a name, which is true when there is a GPT inside the RAID, but not when there is a disklabel inside the RAID. This caused a regression from behavior of NetBSD 8.1. We fix this by allowing nameless partition to be boot candidates. This fixes misc/54748 While there, let raid device be used in the boot specification, like raid0a:/netbsd. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/boot/devopen.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/devopen.c cvs rdiff -u -r1.52 -r1.53 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
Module Name:src Committed By: manu Date: Fri Oct 18 01:38:28 UTC 2019 Modified Files: src/sys/arch/i386/conf: files.i386 src/sys/arch/i386/i386: locore.S machdep.c multiboot.c src/sys/arch/i386/include: multiboot.h Added Files: src/sys/arch/x86/x86: multiboot2.c Log Message: Multiboot2 kernel support for i386 That implementation works either with BIOS or UEFI bootstrap This requires the following kernel changes: Add UEFI boot services and I/O method protoypes src/sys/arch/x86/include/efi.h 1.8 - 1.9 Fix EFI system table mapping in virtual space src/sys/arch/x86/x86/efi.c 1.19 - 1.20 Make sure no bioscall is issued when booting off UEFI system src/sys/arch/i386/i386/machdep.c 1.821 - 1.822 src/sys/arch/i386/pci/piixpcib.c 1.22 - 1.23 And the following bootstrap changes: 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.47 Fix kernel symbols for multiboot2 src/sys/arch/i386/stand/lib/exec_multiboot2.c 1.2 - 1.3 To generate a diff of this commit: cvs rdiff -u -r1.400 -r1.401 src/sys/arch/i386/conf/files.i386 cvs rdiff -u -r1.172 -r1.173 src/sys/arch/i386/i386/locore.S cvs rdiff -u -r1.822 -r1.823 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/i386/multiboot.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/include/multiboot.h cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/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
Module Name:src Committed By: manu Date: Fri Oct 18 01:38:28 UTC 2019 Modified Files: src/sys/arch/i386/conf: files.i386 src/sys/arch/i386/i386: locore.S machdep.c multiboot.c src/sys/arch/i386/include: multiboot.h Added Files: src/sys/arch/x86/x86: multiboot2.c Log Message: Multiboot2 kernel support for i386 That implementation works either with BIOS or UEFI bootstrap This requires the following kernel changes: Add UEFI boot services and I/O method protoypes src/sys/arch/x86/include/efi.h 1.8 - 1.9 Fix EFI system table mapping in virtual space src/sys/arch/x86/x86/efi.c 1.19 - 1.20 Make sure no bioscall is issued when booting off UEFI system src/sys/arch/i386/i386/machdep.c 1.821 - 1.822 src/sys/arch/i386/pci/piixpcib.c 1.22 - 1.23 And the following bootstrap changes: 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.47 Fix kernel symbols for multiboot2 src/sys/arch/i386/stand/lib/exec_multiboot2.c 1.2 - 1.3 To generate a diff of this commit: cvs rdiff -u -r1.400 -r1.401 src/sys/arch/i386/conf/files.i386 cvs rdiff -u -r1.172 -r1.173 src/sys/arch/i386/i386/locore.S cvs rdiff -u -r1.822 -r1.823 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/i386/multiboot.c cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/include/multiboot.h cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/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/conf/files.i386 diff -u src/sys/arch/i386/conf/files.i386:1.400 src/sys/arch/i386/conf/files.i386:1.401 --- src/sys/arch/i386/conf/files.i386:1.400 Fri Feb 15 08:54:01 2019 +++ src/sys/arch/i386/conf/files.i386 Fri Oct 18 01:38:28 2019 @@ -1,4 +1,4 @@ -# $NetBSD: files.i386,v 1.400 2019/02/15 08:54:01 nonaka Exp $ +# $NetBSD: files.i386,v 1.401 2019/10/18 01:38:28 manu Exp $ # # new style config file for i386 architecture # @@ -51,6 +51,7 @@ defparam opt_beep.h BEEP_ONHALT_PERIOD defflag opt_multiboot.h MULTIBOOT obsolete defparam MULTIBOOT_SYMTAB_SPACE file arch/i386/i386/multiboot.c multiboot +file arch/x86/x86/multiboot2.c multiboot file arch/i386/i386/autoconf.c file arch/i386/i386/aout_machdep.c exec_aout Index: src/sys/arch/i386/i386/locore.S diff -u src/sys/arch/i386/i386/locore.S:1.172 src/sys/arch/i386/i386/locore.S:1.173 --- src/sys/arch/i386/i386/locore.S:1.172 Sat Oct 12 06:31:03 2019 +++ src/sys/arch/i386/i386/locore.S Fri Oct 18 01:38:28 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.172 2019/10/12 06:31:03 maxv Exp $ */ +/* $NetBSD: locore.S,v 1.173 2019/10/18 01:38:28 manu Exp $ */ /* * Copyright-o-rama! @@ -128,7 +128,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.172 2019/10/12 06:31:03 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.173 2019/10/18 01:38:28 manu Exp $"); #include "opt_copy_symtab.h" #include "opt_ddb.h" @@ -346,12 +346,52 @@ _C_LABEL(Multiboot_Header): .long MULTIBOOT_HEADER_FLAGS .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) + .align 8 + .globl Multiboot2_Header +_C_LABEL(Multiboot2_Header): + .long MULTIBOOT2_HEADER_MAGIC + .long MULTIBOOT2_ARCHITECTURE_I386 + .long Multiboot2_Header_end - Multiboot2_Header + .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_ARCHITECTURE_I386 \ + + (Multiboot2_Header_end - Multiboot2_Header)) + + .long 1 /* MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST */ + .long 12 /* sizeof(multiboot_header_tag_information_request) */ + /* + sizeof(uint32_t) * requests */ + .long 4 /* MULTIBOOT_TAG_TYPE_BASIC_MEMINFO */ + .long 0 /* pad for 8 bytes alignment */ + + .long 8 /* MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI32 */ + .long 12 /* sizeof(struct multiboot_tag_efi32) */ + .long efi_multiboot2_loader - KERNBASE + .long 0 /* pad for 8 bytes alignment */ + +#if notyet + /* + * Could be used to get an early console for debug, + * but this is broken. + */ + .long 7 /* MULTIBOOT_HEADER_TAG_EFI_BS */ + .long 8 /* sizeof(struct multiboot_tag) */ +#endif + + .long 0 /* MULTIBOOT_HEADER_TAG_END */ + .long 8 /* sizeof(struct multiboot_tag) */ + .globl Multiboot2_Header_end +_C_LABEL(Multiboot2_Header_end): + 1: /* Check if we are being executed by a Multiboot-compliant boot * loader. */ cmpl $MULTIBOOT_INFO_MAGIC,%eax - jne 1f + je multiboot1_loader + + cmpl $MULTIBOOT2_BOOTLOADER_MAGIC,%eax + je multiboot2_loader + jmp 1f + +multiboot1_loader: /* * Indeed, a multiboot-compliant boot loader executed us. We switch * to the temporary stack, and copy the received Multiboot information @@ -361,10 +401,187 @@ _C_LABEL(Multiboot_Header): */ movl $_RELOC(tmpstk),%esp pushl %ebx /* Address of Multiboot information */ - call _C_LABEL(multiboot_pre_reloc) + call _C_LABEL(multiboot1_pre_reloc) addl $4,%esp jmp 2f + +efi_multiboot2_loader: + /* + * EFI32 multiboot2 entry
CVS commit: src/sys/arch/i386/stand/lib
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
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/i386
Module Name:src Committed By: manu Date: Fri Oct 18 01:19:00 UTC 2019 Modified Files: src/sys/arch/i386/i386: multiboot.c Log Message: Fix multiboot1 kernel symbol load ELF_Shdr's sh_type field is a value, not a flag field To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/i386/i386/multiboot.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/i386/multiboot.c diff -u src/sys/arch/i386/i386/multiboot.c:1.24 src/sys/arch/i386/i386/multiboot.c:1.25 --- src/sys/arch/i386/i386/multiboot.c:1.24 Thu Nov 8 06:23:48 2018 +++ src/sys/arch/i386/i386/multiboot.c Fri Oct 18 01:19:00 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: multiboot.c,v 1.24 2018/11/08 06:23:48 msaitoh Exp $ */ +/* $NetBSD: multiboot.c,v 1.25 2019/10/18 01:19:00 manu Exp $ */ /*- * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: multiboot.c,v 1.24 2018/11/08 06:23:48 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: multiboot.c,v 1.25 2019/10/18 01:19:00 manu Exp $"); #include "opt_multiboot.h" @@ -302,14 +302,14 @@ copy_syms(struct multiboot_info *mi) shdrp = &((Elf32_Shdr *)mi->mi_elfshdr_addr)[i]; - if ((shdrp->sh_type & SHT_SYMTAB) && + if ((shdrp->sh_type == SHT_SYMTAB) && shdrp->sh_link != SHN_UNDEF) { Elf32_Shdr *shdrp2; shdrp2 = &((Elf32_Shdr *)mi->mi_elfshdr_addr) [shdrp->sh_link]; - if (shdrp2->sh_type & SHT_STRTAB) { + if (shdrp2->sh_type == SHT_STRTAB) { symtabp = shdrp; strtabp = shdrp2; }
CVS commit: src/sys/arch/i386/i386
Module Name:src Committed By: manu Date: Fri Oct 18 01:19:00 UTC 2019 Modified Files: src/sys/arch/i386/i386: multiboot.c Log Message: Fix multiboot1 kernel symbol load ELF_Shdr's sh_type field is a value, not a flag field To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/i386/i386/multiboot.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
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
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
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
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
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
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
Module Name:src Committed By: manu Date: Fri Oct 18 01:00:25 UTC 2019 Modified Files: src/sys/arch/i386/i386: machdep.c src/sys/arch/i386/pci: piixpcib.c Log Message: Make sure no bioscall is issued when booting off UEFI system To generate a diff of this commit: cvs rdiff -u -r1.821 -r1.822 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/pci/piixpcib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.