From a4f11372d5ec16405c3947a49e9200b89358d82d Mon Sep 17 00:00:00 2001 From: miod Date: Thu, 23 Feb 2023 19:48:21 +0000 Subject: [PATCH] Remove dangerous user-settable "addr" variable from MI boot loader, and only compile tty-related code (stty command, tty variable) on platforms where it makes sense for the boot loader to control it, rather than the PROM/firmware/whatever. --- sys/arch/amd64/stand/Makefile.inc | 4 +-- sys/arch/amd64/stand/boot/boot.8 | 6 ++--- sys/arch/amd64/stand/efi32/exec_i386.c | 4 +-- sys/arch/amd64/stand/efi64/exec_i386.c | 4 +-- sys/arch/amd64/stand/efiboot/exec_i386.c | 4 +-- sys/arch/amd64/stand/libsa/libsa.h | 4 +-- sys/arch/arm64/stand/efiboot/libsa.h | 4 +-- sys/arch/armv7/stand/efiboot/Makefile | 4 +-- sys/arch/armv7/stand/efiboot/libsa.h | 4 +-- sys/arch/hppa/stand/boot/Makefile | 5 ++-- sys/arch/hppa/stand/boot/boot.8 | 31 ++---------------------- sys/arch/hppa/stand/cdboot/cdboot.c | 7 +++--- sys/arch/hppa/stand/libsa/libsa.h | 4 +-- sys/arch/i386/stand/Makefile.inc | 4 +-- sys/arch/i386/stand/boot/boot.8 | 6 ++--- sys/arch/i386/stand/libsa/libsa.h | 4 +-- sys/arch/landisk/stand/boot/boot.8 | 27 ++------------------- sys/arch/landisk/stand/boot/devs.c | 21 +--------------- sys/arch/landisk/stand/boot/libsa.h | 6 +---- sys/arch/loongson/stand/boot/libsa.h | 4 +-- sys/arch/loongson/stand/boot/machdep.c | 25 +------------------ sys/arch/luna88k/stand/boot/boot.8 | 6 ++--- sys/arch/luna88k/stand/boot/init_main.c | 26 +------------------- sys/arch/luna88k/stand/boot/libsa.h | 4 +-- sys/arch/macppc/stand/boot.8 | 30 ++--------------------- sys/arch/macppc/stand/libsa.h | 4 +-- sys/arch/macppc/stand/main.c | 23 +----------------- sys/arch/macppc/stand/ofdev.h | 4 +-- sys/arch/riscv64/stand/efiboot/Makefile | 4 +-- sys/arch/riscv64/stand/efiboot/libsa.h | 4 +-- sys/stand/boot/boot.c | 5 ++-- sys/stand/boot/cmd.c | 8 +++++- sys/stand/boot/cmd.h | 3 +-- sys/stand/boot/vars.c | 20 ++++++--------- 34 files changed, 64 insertions(+), 259 deletions(-) diff --git a/sys/arch/amd64/stand/Makefile.inc b/sys/arch/amd64/stand/Makefile.inc index e3590aff50c..d423cae6555 100644 --- a/sys/arch/amd64/stand/Makefile.inc +++ b/sys/arch/amd64/stand/Makefile.inc @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile.inc,v 1.20 2022/12/30 06:50:27 jca Exp $ +# $OpenBSD: Makefile.inc,v 1.21 2023/02/23 19:48:21 miod Exp $ CFLAGS=${DEBUG} ${COPTS} -Oz -Wall -Werror -CFLAGS+= -ffreestanding -fno-stack-protector -DMDRANDOM +CFLAGS+= -ffreestanding -fno-stack-protector -DMDRANDOM -DBOOT_STTY CPPFLAGS+=-I${S} -I${SADIR}/libsa -I. -I${.CURDIR} SACFLAGS=-D_STANDALONE DEBUGFLAGS= diff --git a/sys/arch/amd64/stand/boot/boot.8 b/sys/arch/amd64/stand/boot/boot.8 index b5fdf75ac23..6b3eee8ffcb 100644 --- a/sys/arch/amd64/stand/boot/boot.8 +++ b/sys/arch/amd64/stand/boot/boot.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: boot.8,v 1.33 2022/08/17 18:50:11 kn Exp $ +.\" $OpenBSD: boot.8,v 1.34 2023/02/23 19:48:21 miod Exp $ .\" .\" Copyright (c) 1997-2001 Michael Shalayeff .\" All rights reserved. @@ -25,7 +25,7 @@ .\" THE POSSIBILITY OF SUCH DAMAGE. .\" .\" -.Dd $Mdocdate: August 17 2022 $ +.Dd $Mdocdate: February 23 2023 $ .Dt BOOT 8 amd64 .Os .Sh NAME @@ -320,8 +320,6 @@ are both specified, sets that variable to the given value. Variables include: .Pp .Bl -tag -compact -width db_console -.It Ic addr -Address at which to load the kernel. .It Ic db_console Boolean (0 or 1) to permit entry into the kernel debugger before the .Em ddb.console diff --git a/sys/arch/amd64/stand/efi32/exec_i386.c b/sys/arch/amd64/stand/efi32/exec_i386.c index 8349d97fefb..5e09c28e3ce 100644 --- a/sys/arch/amd64/stand/efi32/exec_i386.c +++ b/sys/arch/amd64/stand/efi32/exec_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_i386.c,v 1.3 2021/10/24 17:49:19 deraadt Exp $ */ +/* $OpenBSD: exec_i386.c,v 1.4 2023/02/23 19:48:21 miod Exp $ */ /* * Copyright (c) 1997-1998 Michael Shalayeff @@ -83,7 +83,7 @@ run_loadfile(uint64_t *marks, int howto) if ((av = alloc(ac)) == NULL) panic("alloc for bootarg"); efi_makebootargs(); - delta = DEFAULT_KERNEL_ADDRESS - efi_loadaddr; + delta = -efi_loadaddr; if (sa_cleanup != NULL) (*sa_cleanup)(); diff --git a/sys/arch/amd64/stand/efi64/exec_i386.c b/sys/arch/amd64/stand/efi64/exec_i386.c index 48e460cb040..03b67c90d38 100644 --- a/sys/arch/amd64/stand/efi64/exec_i386.c +++ b/sys/arch/amd64/stand/efi64/exec_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_i386.c,v 1.3 2021/10/24 17:49:19 deraadt Exp $ */ +/* $OpenBSD: exec_i386.c,v 1.4 2023/02/23 19:48:21 miod Exp $ */ /* * Copyright (c) 1997-1998 Michael Shalayeff @@ -83,7 +83,7 @@ run_loadfile(uint64_t *marks, int howto) if ((av = alloc(ac)) == NULL) panic("alloc for bootarg"); efi_makebootargs(); - delta = DEFAULT_KERNEL_ADDRESS - efi_loadaddr; + delta = -efi_loadaddr; if (sa_cleanup != NULL) (*sa_cleanup)(); diff --git a/sys/arch/amd64/stand/efiboot/exec_i386.c b/sys/arch/amd64/stand/efiboot/exec_i386.c index d6957c638b9..e5b410472c1 100644 --- a/sys/arch/amd64/stand/efiboot/exec_i386.c +++ b/sys/arch/amd64/stand/efiboot/exec_i386.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_i386.c,v 1.9 2022/07/11 19:45:02 kettenis Exp $ */ +/* $OpenBSD: exec_i386.c,v 1.10 2023/02/23 19:48:21 miod Exp $ */ /* * Copyright (c) 1997-1998 Michael Shalayeff @@ -87,7 +87,7 @@ run_loadfile(uint64_t *marks, int howto) panic("alloc for bootarg"); efi_makebootargs(); efi_setconsdev(); - delta = DEFAULT_KERNEL_ADDRESS - efi_loadaddr; + delta = -efi_loadaddr; if (sa_cleanup != NULL) (*sa_cleanup)(); diff --git a/sys/arch/amd64/stand/libsa/libsa.h b/sys/arch/amd64/stand/libsa/libsa.h index fc65c6f8ccd..86e670229d7 100644 --- a/sys/arch/amd64/stand/libsa/libsa.h +++ b/sys/arch/amd64/stand/libsa/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.7 2012/10/30 14:06:29 jsing Exp $ */ +/* $OpenBSD: libsa.h,v 1.8 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -29,8 +29,6 @@ #include #include -#define DEFAULT_KERNEL_ADDRESS 0 - struct i386_boot_probes { char *name; void (**probes)(void); diff --git a/sys/arch/arm64/stand/efiboot/libsa.h b/sys/arch/arm64/stand/efiboot/libsa.h index 08bd403f085..263132cf78e 100644 --- a/sys/arch/arm64/stand/efiboot/libsa.h +++ b/sys/arch/arm64/stand/efiboot/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.2 2017/08/07 19:34:53 kettenis Exp $ */ +/* $OpenBSD: libsa.h,v 1.3 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -18,8 +18,6 @@ #include -#define DEFAULT_KERNEL_ADDRESS 0 - #ifdef DEBUG #define DPRINTF(x) printf x; #else diff --git a/sys/arch/armv7/stand/efiboot/Makefile b/sys/arch/armv7/stand/efiboot/Makefile index 0fe490f04a7..f769148f6ae 100644 --- a/sys/arch/armv7/stand/efiboot/Makefile +++ b/sys/arch/armv7/stand/efiboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.18 2022/12/30 06:44:35 jca Exp $ +# $OpenBSD: Makefile,v 1.19 2023/02/23 19:48:22 miod Exp $ NOMAN= # @@ -44,7 +44,7 @@ SRCS+= adler32.c crc32.c inflate.c inftrees.c CPPFLAGS+= -nostdinc CPPFLAGS+= -I${S} -I. -I${.CURDIR} CPPFLAGS+= -I${EFIDIR}/include -I${EFIDIR}/include/arm -CPPFLAGS+= -D_STANDALONE +CPPFLAGS+= -D_STANDALONE -DBOOT_STTY CPPFLAGS+= -DSMALL -DSLOW -DNOBYFOUR -D__INTERNAL_LIBSA_CREAD CPPFLAGS+= -DNEEDS_HEAP_H COPTS+= -ffreestanding -fno-stack-protector diff --git a/sys/arch/armv7/stand/efiboot/libsa.h b/sys/arch/armv7/stand/efiboot/libsa.h index 1f0c7b0ec2b..01eaa1ac013 100644 --- a/sys/arch/armv7/stand/efiboot/libsa.h +++ b/sys/arch/armv7/stand/efiboot/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.3 2017/08/07 19:34:53 kettenis Exp $ */ +/* $OpenBSD: libsa.h,v 1.4 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -18,8 +18,6 @@ #include -#define DEFAULT_KERNEL_ADDRESS 0 - #ifdef DEBUG #define DPRINTF(x) printf x; #else diff --git a/sys/arch/hppa/stand/boot/Makefile b/sys/arch/hppa/stand/boot/Makefile index c1c36f10135..20623093b84 100644 --- a/sys/arch/hppa/stand/boot/Makefile +++ b/sys/arch/hppa/stand/boot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.29 2019/11/28 00:17:11 bluhm Exp $ +# $OpenBSD: Makefile,v 1.30 2023/02/23 19:48:22 miod Exp $ MAN= boot.8 MANSUBDIR=hppa @@ -58,7 +58,8 @@ NOPROG= .include -CPPFLAGS+=${DEBUGFLAGS} -DRELOC=${LOADADDR} -DHEAP_LIMIT=${HEAP_LIMIT} +CPPFLAGS+=${DEBUGFLAGS} -DRELOC=${LOADADDR} -DHEAP_LIMIT=${HEAP_LIMIT} \ + -DBOOT_STTY CFLAGS+=$(SACFLAGS) CFLAGS+=-fno-pie AFLAGS+=-fno-pie diff --git a/sys/arch/hppa/stand/boot/boot.8 b/sys/arch/hppa/stand/boot/boot.8 index 522e266da04..117f7b6ccbe 100644 --- a/sys/arch/hppa/stand/boot/boot.8 +++ b/sys/arch/hppa/stand/boot/boot.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: boot.8,v 1.26 2019/12/23 12:44:34 bluhm Exp $ +.\" $OpenBSD: boot.8,v 1.27 2023/02/23 19:48:22 miod Exp $ .\" .\" Copyright (c) 2002 Miodrag Vallat .\" Copyright (c) 1997-2002 Michael Shalayeff @@ -26,7 +26,7 @@ .\" THE POSSIBILITY OF SUCH DAMAGE. .\" .\" -.Dd $Mdocdate: December 23 2019 $ +.Dd $Mdocdate: February 23 2023 $ .Dt BOOT 8 hppa .Os .Sh NAME @@ -230,8 +230,6 @@ are both specified, sets that variable to the given value. Variables include: .Pp .Bl -tag -compact -width db_console -.It Ic addr -Address at which to load the kernel. .It Ic db_console Boolean (0 or 1) to permit entry into the kernel debugger before the .Em ddb.console @@ -251,31 +249,6 @@ File name containing the kernel image. .It Ic timeout Number of seconds boot will wait for human intervention before booting the default kernel image. -.\" .It Nm tty -.\" Active console device name (i.e., -.\" .Li ttya , -.\" .Li ttyb , -.\" .Li ite0) . -.El -.\" .It stty Op Ar device Op Ar speed -.\" Displays or sets the -.\" .Ar speed -.\" for a console -.\" .Ar device . -.\" If changing the baudrate for the currently active console, -.\" .Nm -.\" offers you five seconds of grace time before committing the change -.\" to allow you to change your terminal's speed to match. -.\" If changing speed -.\" .Em not -.\" for the active console, the baudrate is set for the -.\" .Em next -.\" time you switch to a serial console. -.\" The baudrate value is not used for the -.\" .Li ite0 -.\" console. -.\" .Pp -.\" The default baudrate is 9600bps. .It Ic time Displays system time and date. .El diff --git a/sys/arch/hppa/stand/cdboot/cdboot.c b/sys/arch/hppa/stand/cdboot/cdboot.c index 35730f1aad8..8c394cbb89b 100644 --- a/sys/arch/hppa/stand/cdboot/cdboot.c +++ b/sys/arch/hppa/stand/cdboot/cdboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cdboot.c,v 1.15 2019/10/29 02:55:51 deraadt Exp $ */ +/* $OpenBSD: cdboot.c,v 1.16 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 2003 Michael Shalayeff @@ -84,10 +84,9 @@ boot(dev_t dev) rc4_keysetup(&randomctx, rnddata, sizeof rnddata); rc4_skip(&randomctx, 1536); - marks[MARK_START] = (u_long)DEFAULT_KERNEL_ADDRESS; + marks[MARK_START] = 0; if (!loadfile(path, marks, LOAD_KERNEL)) { - marks[MARK_END] = ALIGN(marks[MARK_END] - - (u_long)DEFAULT_KERNEL_ADDRESS); + marks[MARK_END] = ALIGN(marks[MARK_END]); fcacheall(); __asm("mtctl %r0, %cr17"); diff --git a/sys/arch/hppa/stand/libsa/libsa.h b/sys/arch/hppa/stand/libsa/libsa.h index 030fc991972..4e2b9697ea8 100644 --- a/sys/arch/hppa/stand/libsa/libsa.h +++ b/sys/arch/hppa/stand/libsa/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.16 2020/12/09 18:10:18 krw Exp $ */ +/* $OpenBSD: libsa.h,v 1.17 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -31,8 +31,6 @@ #define EXEC_ELF #define EXEC_SOM -#define DEFAULT_KERNEL_ADDRESS 0 - extern dev_t bootdev; void pdc_init(void); diff --git a/sys/arch/i386/stand/Makefile.inc b/sys/arch/i386/stand/Makefile.inc index df73ce17abf..d9898462e50 100644 --- a/sys/arch/i386/stand/Makefile.inc +++ b/sys/arch/i386/stand/Makefile.inc @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile.inc,v 1.53 2022/12/30 06:50:27 jca Exp $ +# $OpenBSD: Makefile.inc,v 1.54 2023/02/23 19:48:22 miod Exp $ CFLAGS=${DEBUG} ${COPTS} -Oz -Wall -Werror -CFLAGS+= -ffreestanding -fno-stack-protector -DMDRANDOM +CFLAGS+= -ffreestanding -fno-stack-protector -DMDRANDOM -DBOOT_STTY CPPFLAGS+=-I${S} -I${SADIR}/libsa -I. -I${.CURDIR} SACFLAGS=-D_STANDALONE DEBUGFLAGS= diff --git a/sys/arch/i386/stand/boot/boot.8 b/sys/arch/i386/stand/boot/boot.8 index 6a15b898f93..6d15b9d589a 100644 --- a/sys/arch/i386/stand/boot/boot.8 +++ b/sys/arch/i386/stand/boot/boot.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: boot.8,v 1.67 2019/12/23 12:44:34 bluhm Exp $ +.\" $OpenBSD: boot.8,v 1.68 2023/02/23 19:48:22 miod Exp $ .\" .\" Copyright (c) 1997-2001 Michael Shalayeff .\" All rights reserved. @@ -25,7 +25,7 @@ .\" THE POSSIBILITY OF SUCH DAMAGE. .\" .\" -.Dd $Mdocdate: December 23 2019 $ +.Dd $Mdocdate: February 23 2023 $ .Dt BOOT 8 i386 .Os .Sh NAME @@ -302,8 +302,6 @@ are both specified, sets that variable to the given value. Variables include: .Pp .Bl -tag -compact -width db_console -.It Ic addr -Address at which to load the kernel. .It Ic db_console Boolean (0 or 1) to permit entry into the kernel debugger before the .Em ddb.console diff --git a/sys/arch/i386/stand/libsa/libsa.h b/sys/arch/i386/stand/libsa/libsa.h index e989aedadf9..19b67fc7973 100644 --- a/sys/arch/i386/stand/libsa/libsa.h +++ b/sys/arch/i386/stand/libsa/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.46 2020/06/14 16:00:11 deraadt Exp $ */ +/* $OpenBSD: libsa.h,v 1.47 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 1996-1999 Michael Shalayeff @@ -31,8 +31,6 @@ #define EXEC_ELF -#define DEFAULT_KERNEL_ADDRESS 0 - struct i386_boot_probes { char *name; void (**probes)(void); diff --git a/sys/arch/landisk/stand/boot/boot.8 b/sys/arch/landisk/stand/boot/boot.8 index 30db74bd1e4..4e06cfa84d4 100644 --- a/sys/arch/landisk/stand/boot/boot.8 +++ b/sys/arch/landisk/stand/boot/boot.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: boot.8,v 1.12 2019/12/23 12:44:34 bluhm Exp $ +.\" $OpenBSD: boot.8,v 1.13 2023/02/23 19:48:22 miod Exp $ .\" .\" Copyright (c) 1997-2001 Michael Shalayeff .\" All rights reserved. @@ -25,7 +25,7 @@ .\" THE POSSIBILITY OF SUCH DAMAGE. .\" .\" -.Dd $Mdocdate: December 23 2019 $ +.Dd $Mdocdate: February 23 2023 $ .Dt BOOT 8 landisk .Os .Sh NAME @@ -189,8 +189,6 @@ are both specified, sets that variable to the given value. Variables include: .Pp .Bl -tag -compact -width db_console -.It Ic addr -Address at which to load the kernel. .It Ic db_console Boolean (0 or 1) to permit entry into the kernel debugger before the .Em ddb.console @@ -211,27 +209,6 @@ File name containing the kernel image. .It Ic timeout Number of seconds boot will wait for human intervention before booting the default kernel image. -.\" .It Nm tty -.\" Active console device name (e.g., -.\" .Li scif0 ) . -.El -.\" XXX although implemented, better leave it undocumented for now -- miod -.\" .It stty Op Ar device Op Ar speed -.\" Displays or sets the -.\" .Ar speed -.\" for a console -.\" .Ar device . -.\" If changing the baudrate for the currently active console, -.\" .Nm -.\" offers you five seconds of grace time before committing the change -.\" to allow you to change your terminal's speed to match. -.\" If changing speed -.\" .Em not -.\" for the active console, the baudrate is set for the -.\" .Em next -.\" time you switch to a serial console. -.\" .Pp -.\" The default baudrate is 9600bps. .It Ic time Displays system time and date. .El diff --git a/sys/arch/landisk/stand/boot/devs.c b/sys/arch/landisk/stand/boot/devs.c index 4af103a56bb..71ae13d68c7 100644 --- a/sys/arch/landisk/stand/boot/devs.c +++ b/sys/arch/landisk/stand/boot/devs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devs.c,v 1.12 2020/12/09 18:10:19 krw Exp $ */ +/* $OpenBSD: devs.c,v 1.13 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 2006 Michael Shalayeff @@ -51,25 +51,6 @@ devboot(dev_t bootdev, char *p) p[2] = '\0'; } -char * -ttyname(int fd) -{ - return "scif"; -} - -dev_t -ttydev(char *name) -{ - return NODEV; -} - -int -cnspeed(dev_t dev, int sp) -{ - scif_init(sp); - return sp; -} - void run_loadfile(uint64_t *marks, int howto) { diff --git a/sys/arch/landisk/stand/boot/libsa.h b/sys/arch/landisk/stand/boot/libsa.h index e356858acf1..fefddf6ec44 100644 --- a/sys/arch/landisk/stand/boot/libsa.h +++ b/sys/arch/landisk/stand/boot/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.9 2022/08/24 17:35:15 miod Exp $ */ +/* $OpenBSD: libsa.h,v 1.10 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 2006 Michael Shalayeff @@ -19,10 +19,6 @@ #include -#define EXEC_ELF - -#define DEFAULT_KERNEL_ADDRESS 0 - #define PCLOCK 33333333 int readsects(int dev, uint32_t lba, void *buf, size_t size); diff --git a/sys/arch/loongson/stand/boot/libsa.h b/sys/arch/loongson/stand/boot/libsa.h index d375daffc54..21a2dff87f0 100644 --- a/sys/arch/loongson/stand/boot/libsa.h +++ b/sys/arch/loongson/stand/boot/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.7 2020/12/09 18:10:19 krw Exp $ */ +/* $OpenBSD: libsa.h,v 1.8 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 2010 Miodrag Vallat. @@ -18,8 +18,6 @@ #include -#define DEFAULT_KERNEL_ADDRESS 0 - /* where the initrd is loaded */ #define INITRD_BASE PHYS_TO_CKSEG0(0x04000000) diff --git a/sys/arch/loongson/stand/boot/machdep.c b/sys/arch/loongson/stand/boot/machdep.c index 47956a8a136..5de4d3ff2b6 100644 --- a/sys/arch/loongson/stand/boot/machdep.c +++ b/sys/arch/loongson/stand/boot/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.8 2014/07/13 09:26:08 jasper Exp $ */ +/* $OpenBSD: machdep.c,v 1.9 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 2010 Miodrag Vallat. @@ -54,29 +54,6 @@ int boot_rd; extern int bootprompt; -/* - * Console - */ - -int -cnspeed(dev_t dev, int sp) -{ - return CONSPEED; -} - -char * -ttyname(int fd) -{ - return "pmon console"; -} - -dev_t -ttydev(char *name) -{ - /* we do not support any other console than pmon */ - return NODEV; -} - /* * Configuration and device path aerobics */ diff --git a/sys/arch/luna88k/stand/boot/boot.8 b/sys/arch/luna88k/stand/boot/boot.8 index 19d6874850f..b5c056a5930 100644 --- a/sys/arch/luna88k/stand/boot/boot.8 +++ b/sys/arch/luna88k/stand/boot/boot.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: boot.8,v 1.1 2023/01/12 19:37:53 miod Exp $ +.\" $OpenBSD: boot.8,v 1.2 2023/02/23 19:48:22 miod Exp $ .\" .\" Copyright (c) 1997-2001 Michael Shalayeff .\" All rights reserved. @@ -25,7 +25,7 @@ .\" THE POSSIBILITY OF SUCH DAMAGE. .\" .\" -.Dd $Mdocdate: January 12 2023 $ +.Dd $Mdocdate: February 23 2023 $ .Dt BOOT 8 luna88k .Os .Sh NAME @@ -191,8 +191,6 @@ are both specified, sets that variable to the given value. Variables include: .Pp .Bl -tag -compact -width db_console -.It Ic addr -Address at which to load the kernel. .It Ic debug Debug flag if .Nm diff --git a/sys/arch/luna88k/stand/boot/init_main.c b/sys/arch/luna88k/stand/boot/init_main.c index fbe39498161..ab4b22c85f9 100644 --- a/sys/arch/luna88k/stand/boot/init_main.c +++ b/sys/arch/luna88k/stand/boot/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.11 2023/01/27 13:58:17 aoyama Exp $ */ +/* $OpenBSD: init_main.c,v 1.12 2023/02/23 19:48:22 miod Exp $ */ /* $NetBSD: init_main.c,v 1.6 2013/03/05 15:34:53 tsutsui Exp $ */ /* @@ -269,30 +269,6 @@ _rtt(void) /* NOTREACHED */ } - -/* - * "machine tty" command to select a different console is not supported, - * console device selection is performed using the DIP switches. - */ - -int -cnspeed(dev_t dev, int sp) -{ - return 9600; -} - -char * -ttyname(int fd) -{ - return "console"; -} - -dev_t -ttydev(char *name) -{ - return NODEV; -} - /* * Return the default boot device. */ diff --git a/sys/arch/luna88k/stand/boot/libsa.h b/sys/arch/luna88k/stand/boot/libsa.h index 55d12787244..9a3de988f1b 100644 --- a/sys/arch/luna88k/stand/boot/libsa.h +++ b/sys/arch/luna88k/stand/boot/libsa.h @@ -1,11 +1,9 @@ -/* $OpenBSD: libsa.h,v 1.1 2023/01/10 17:10:57 miod Exp $ */ +/* $OpenBSD: libsa.h,v 1.2 2023/02/23 19:48:22 miod Exp $ */ /* public domain */ #include -#define DEFAULT_KERNEL_ADDRESS 0 - void devboot(dev_t, char *); void machdep(void); void run_loadfile(uint64_t *, int); diff --git a/sys/arch/macppc/stand/boot.8 b/sys/arch/macppc/stand/boot.8 index 153a904bb00..5f385f6cf40 100644 --- a/sys/arch/macppc/stand/boot.8 +++ b/sys/arch/macppc/stand/boot.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: boot.8,v 1.5 2022/09/05 10:03:50 kn Exp $ +.\" $OpenBSD: boot.8,v 1.6 2023/02/23 19:48:22 miod Exp $ .\" .\" Copyright (c) 1997-2001 Michael Shalayeff .\" All rights reserved. @@ -25,7 +25,7 @@ .\" THE POSSIBILITY OF SUCH DAMAGE. .\" .\" -.Dd $Mdocdate: September 5 2022 $ +.Dd $Mdocdate: February 23 2023 $ .Dt BOOT 8 macppc .Os .Sh NAME @@ -194,8 +194,6 @@ are both specified, sets that variable to the given value. Variables include: .Pp .Bl -tag -compact -width boothow -.It Ic addr -Address at which to load the kernel. .It Ic debug Debug flag if .Nm @@ -213,30 +211,6 @@ File name containing the kernel image. .It Ic timeout Number of seconds boot will wait for human intervention before booting the default kernel image. -.\" .It Nm tty -.\" Active console device name (e.g., -.\" .Li com0 ) . -.\" Currently, only the first serial port -.\" .Pq Li com0 -.\" is supported for console on macppc. -.El -.\" XXX ignored, so don't document it. -.\" .It stty Op Ar device Op Ar speed -.\" Displays or sets the -.\" .Ar speed -.\" for a console -.\" .Ar device . -.\" If changing the baudrate for the currently active console, -.\" .Nm -.\" offers you five seconds of grace time before committing the change -.\" to allow you to change your terminal's speed to match. -.\" If changing speed -.\" .Em not -.\" for the active console, the baudrate is set for the -.\" .Em next -.\" time you switch to a serial console. -.\" .Pp -.\" The default baudrate is 9600bps. .It Ic time Displays system time and date. .El diff --git a/sys/arch/macppc/stand/libsa.h b/sys/arch/macppc/stand/libsa.h index 31726c6704b..a4678fa4586 100644 --- a/sys/arch/macppc/stand/libsa.h +++ b/sys/arch/macppc/stand/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.3 2022/10/21 21:26:49 gkoehler Exp $ */ +/* $OpenBSD: libsa.h,v 1.4 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 2006 Mark Kettenis @@ -18,8 +18,6 @@ #include -#define DEFAULT_KERNEL_ADDRESS 0 - void freeall(void); void syncicache(void *, size_t); diff --git a/sys/arch/macppc/stand/main.c b/sys/arch/macppc/stand/main.c index 2927c3c8a65..b46ecfb66cf 100644 --- a/sys/arch/macppc/stand/main.c +++ b/sys/arch/macppc/stand/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.12 2020/10/03 06:22:20 gkoehler Exp $ */ +/* $OpenBSD: main.c,v 1.13 2023/02/23 19:48:22 miod Exp $ */ /* $NetBSD: boot.c,v 1.1 1997/04/16 20:29:17 thorpej Exp $ */ /* @@ -216,24 +216,3 @@ run_loadfile(uint64_t *marks, int howto) _rtt(); } - -int -cnspeed(dev_t dev, int sp) -{ - return CONSPEED; -} - -char ttyname_buf[8]; - -char * -ttyname(int fd) -{ - snprintf(ttyname_buf, sizeof ttyname_buf, "ofc0"); - return ttyname_buf; -} - -dev_t -ttydev(char *name) -{ - return makedev(0,0); -} diff --git a/sys/arch/macppc/stand/ofdev.h b/sys/arch/macppc/stand/ofdev.h index f0604093a09..1de406cc2dc 100644 --- a/sys/arch/macppc/stand/ofdev.h +++ b/sys/arch/macppc/stand/ofdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ofdev.h,v 1.2 2019/09/02 23:40:29 kettenis Exp $ */ +/* $OpenBSD: ofdev.h,v 1.3 2023/02/23 19:48:22 miod Exp $ */ /* $NetBSD: ofdev.h,v 1.1 1997/04/16 20:29:22 thorpej Exp $ */ /* @@ -46,8 +46,6 @@ struct of_dev { #define OFDEV_NET 1 #define OFDEV_DISK 2 -#define DEFAULT_KERNEL "/bsd" - extern char opened_name[]; int net_open(struct of_dev *); diff --git a/sys/arch/riscv64/stand/efiboot/Makefile b/sys/arch/riscv64/stand/efiboot/Makefile index 7d53b14cbd8..412de038b45 100644 --- a/sys/arch/riscv64/stand/efiboot/Makefile +++ b/sys/arch/riscv64/stand/efiboot/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.4 2023/01/04 13:01:47 deraadt Exp $ +# $OpenBSD: Makefile,v 1.5 2023/02/23 19:48:22 miod Exp $ NOMAN= # @@ -46,7 +46,7 @@ SRCS+= adler32.c crc32.c inflate.c inftrees.c CPPFLAGS+= -nostdinc CPPFLAGS+= -I${S} -I. -I${.CURDIR} CPPFLAGS+= -I${EFIDIR}/include -I${EFIDIR}/include/riscv64 -CPPFLAGS+= -D_STANDALONE +CPPFLAGS+= -D_STANDALONE -DBOOT_STTY CPPFLAGS+= -DSMALL -DSLOW -DNOBYFOUR -D__INTERNAL_LIBSA_CREAD CPPFLAGS+= -DNEEDS_HEAP_H -DFWRANDOM CPPFLAGS+= -march=rv64gc --target=riscv64 -mno-relax diff --git a/sys/arch/riscv64/stand/efiboot/libsa.h b/sys/arch/riscv64/stand/efiboot/libsa.h index aed844e501a..65108b549e7 100644 --- a/sys/arch/riscv64/stand/efiboot/libsa.h +++ b/sys/arch/riscv64/stand/efiboot/libsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: libsa.h,v 1.1 2021/04/28 19:01:00 drahn Exp $ */ +/* $OpenBSD: libsa.h,v 1.2 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -18,8 +18,6 @@ #include -#define DEFAULT_KERNEL_ADDRESS 0 - #ifdef DEBUG #define DPRINTF(x) printf x; #else diff --git a/sys/stand/boot/boot.c b/sys/stand/boot/boot.c index 5525723090b..e090a0d0180 100644 --- a/sys/stand/boot/boot.c +++ b/sys/stand/boot/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.56 2021/10/26 16:29:49 deraadt Exp $ */ +/* $OpenBSD: boot.c,v 1.57 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 2003 Dale Rahn @@ -75,7 +75,6 @@ boot(dev_t bootdev) strlcpy(cmd.image, kernelfile, sizeof(cmd.image)); cmd.boothowto = 0; cmd.conf = "/etc/boot.conf"; - cmd.addr = (void *)DEFAULT_KERNEL_ADDRESS; cmd.timeout = boottimeout; if (upgrade()) { @@ -125,7 +124,7 @@ boot(dev_t bootdev) bootprompt = 1; /* allow reselect should we fail */ printf("booting %s: ", cmd.path); - marks[MARK_START] = (u_long)cmd.addr; + marks[MARK_START] = 0; if ((fd = loadfile(cmd.path, marks, LOAD_ALL)) != -1) { /* Prevent re-upgrade: chmod a-x bsd.upgrade */ diff --git a/sys/stand/boot/cmd.c b/sys/stand/boot/cmd.c index c11c7e9f204..00e9e46bda4 100644 --- a/sys/stand/boot/cmd.c +++ b/sys/stand/boot/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.69 2022/06/27 20:22:26 miod Exp $ */ +/* $OpenBSD: cmd.c,v 1.70 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 1997-1999 Michael Shalayeff @@ -43,7 +43,9 @@ static int Xhexdump(void); static int Xls(void); static int Xnop(void); static int Xreboot(void); +#ifdef BOOT_STTY static int Xstty(void); +#endif static int Xtime(void); #ifdef MACHINE_CMD static int Xmachine(void); @@ -70,7 +72,9 @@ const struct cmd_table cmd_table[] = { #endif {"reboot", CMDT_CMD, Xreboot}, {"set", CMDT_SET, Xset}, +#ifdef BOOT_STTY {"stty", CMDT_CMD, Xstty}, +#endif {"time", CMDT_CMD, Xtime}, {NULL, 0}, }; @@ -389,6 +393,7 @@ Xecho(void) return 0; } +#ifdef BOOT_STTY static int Xstty(void) { @@ -417,6 +422,7 @@ Xstty(void) } return 0; } +#endif static int Xtime(void) diff --git a/sys/stand/boot/cmd.h b/sys/stand/boot/cmd.h index 494d0bce6f3..5045f052b8b 100644 --- a/sys/stand/boot/cmd.h +++ b/sys/stand/boot/cmd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.h,v 1.18 2019/05/10 12:49:58 claudio Exp $ */ +/* $OpenBSD: cmd.h,v 1.19 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -45,7 +45,6 @@ struct cmd_state { char image[MAXPATHLEN - 16]; /* image */ int boothowto; /* howto */ char *conf; /* /etc/boot.conf normally */ - void *addr; /* load here */ int timeout; char path[MAXPATHLEN]; /* buffer for pathname compose */ diff --git a/sys/stand/boot/vars.c b/sys/stand/boot/vars.c index 861920ef6a7..6093179c760 100644 --- a/sys/stand/boot/vars.c +++ b/sys/stand/boot/vars.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vars.c,v 1.15 2014/07/11 12:33:12 jasper Exp $ */ +/* $OpenBSD: vars.c,v 1.16 2023/02/23 19:48:22 miod Exp $ */ /* * Copyright (c) 1998-2000 Michael Shalayeff @@ -37,7 +37,6 @@ extern char prog_ident[]; extern int debug; int db_console = -1; -static int Xaddr(void); static int Xdevice(void); #ifdef DEBUG static int Xdebug(void); @@ -45,19 +44,22 @@ static int Xdebug(void); static int Xdb_console(void); static int Ximage(void); static int Xhowto(void); +#ifdef BOOT_STTY static int Xtty(void); +#endif static int Xtimeout(void); int Xset(void); int Xenv(void); const struct cmd_table cmd_set[] = { - {"addr", CMDT_VAR, Xaddr}, {"howto", CMDT_VAR, Xhowto}, #ifdef DEBUG {"debug", CMDT_VAR, Xdebug}, #endif {"device", CMDT_VAR, Xdevice}, +#ifdef BOOT_STTY {"tty", CMDT_VAR, Xtty}, +#endif {"image", CMDT_VAR, Ximage}, {"timeout",CMDT_VAR, Xtimeout}, {"db_console", CMDT_VAR, Xdb_console}, @@ -149,16 +151,7 @@ Ximage(void) return 0; } -static int -Xaddr(void) -{ - if (cmd.argc != 2) - printf("%p\n", cmd.addr); - else - cmd.addr = (void *)strtol(cmd.argv[1], NULL, 0); - return 0; -} - +#ifdef BOOT_STTY static int Xtty(void) { @@ -181,6 +174,7 @@ Xtty(void) } return 0; } +#endif static int Xhowto(void) -- 2.20.1