ok drahn@
On Mon, May 28, 2018 at 11:07:29AM +0200, Mark Kettenis wrote:
> machine_reg.h is completely unused
> swi.h is referenced from libc's SYS.h but nothing from that file is used
> bootconfig.h has some junk that isn't really used
>
> The MAX_BOOT_STRING define in bootconfig.h doesn't really serve a
> purpose anymore. Simply use a fixed-size buffer and strlcpy the
> results into it using sizeof.
>
> ok?
>
> Index: sys/arch/arm64/include/bootconfig.h
> ===================================================================
> RCS file: /cvs/src/sys/arch/arm64/include/bootconfig.h,v
> retrieving revision 1.2
> diff -u -p -r1.2 bootconfig.h
> --- sys/arch/arm64/include/bootconfig.h 18 Dec 2016 14:40:25 -0000
> 1.2
> +++ sys/arch/arm64/include/bootconfig.h 28 May 2018 09:03:07 -0000
> @@ -32,9 +32,6 @@
> #ifndef _MACHINE_BOOTCONFIG_H_
> #define _MACHINE_BOOTCONFIG_H_
>
> -#define MAX_BOOT_STRING 255
> -extern char bootstring[MAX_BOOT_STRING];
> -
> struct arm64_bootparams {
> vaddr_t modulep;
> vaddr_t kern_l1pt; /* L1 page table for the kernel */
> @@ -45,14 +42,8 @@ struct arm64_bootparams {
> void *arg2; // passed to kernel in R2
> };
>
> -extern paddr_t physmap[];
> -extern u_int physmap_idx;
> -
> -
> void initarm(struct arm64_bootparams *);
>
> extern char *boot_file;
>
> #endif /* _MACHINE_BOOTCONFIG_H_ */
> -
> -/* End of bootconfig.h */
> Index: sys/arch/arm64/include/machine_reg.h
> ===================================================================
> RCS file: sys/arch/arm64/include/machine_reg.h
> diff -N sys/arch/arm64/include/machine_reg.h
> --- sys/arch/arm64/include/machine_reg.h 30 Apr 2017 13:04:49 -0000
> 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,57 +0,0 @@
> -/* $OpenBSD: machine_reg.h,v 1.2 2017/04/30 13:04:49 mpi Exp $ */
> -
> -/*
> - * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved.
> - * Written by Hiroyuki Bessho for Genetec Corporation.
> - *
> - * 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.
> - * 3. The name of Genetec Corporation may not be used to endorse or
> - * promote products derived from this software without specific prior
> - * written permission.
> - *
> - * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``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 GENETEC CORPORATION
> - * 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.
> - */
> -
> -
> -#ifndef _MACHINE_REG_H
> -#define _MACHINE_REG_H
> -
> -/*
> - * Logical mapping for onboard/integrated peripherals
> - */
> -#define MACHINE_IO_AREA_VBASE 0xfd000000
> -#define MACHINE_GPIO_VBASE 0xfd000000
> -#define MACHINE_CLKMAN_VBASE 0xfd100000
> -#define MACHINE_INTCTL_VBASE 0xfd200000
> -#define MACHINE_AGPIO_VBASE 0xfd300000
> -#define MACHINE_VBASE_FREE 0xfd400000
> -/* FFUART and/or BTUART are mapped to this area when
> - used for console */
> -
> -#define ioreg_read(a) (*(volatile unsigned *)(a))
> -#define ioreg_write(a,v) (*(volatile unsigned *)(a)=(v))
> -
> -#define ioreg16_read(a) (*(volatile uint16_t *)(a))
> -#define ioreg16_write(a,v) (*(volatile uint16_t *)(a)=(v))
> -
> -#define ioreg8_read(a) (*(volatile uint8_t *)(a))
> -#define ioreg8_write(a,v) (*(volatile uint8_t *)(a)=(v))
> -
> -#endif /* _MACHINE_REG_H */
> Index: sys/arch/arm64/include/swi.h
> ===================================================================
> RCS file: sys/arch/arm64/include/swi.h
> diff -N sys/arch/arm64/include/swi.h
> --- sys/arch/arm64/include/swi.h 17 Dec 2016 23:38:33 -0000 1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,23 +0,0 @@
> -/* $OpenBSD: swi.h,v 1.1 2016/12/17 23:38:33 patrick Exp $ */
> -/* $NetBSD: swi.h,v 1.1 2002/01/13 15:03:06 bjh21 Exp $ */
> -
> -/*
> - * This file is in the Public Domain.
> - * Ben Harris, 2002.
> - */
> -
> -#ifndef _MACHINE_SWI_H_
> -#define _MACHINE_SWI_H_
> -
> -#define SWI_OS_MASK 0xf00000
> -#define SWI_OS_RISCOS 0x000000
> -#define SWI_OS_RISCIX 0x800000
> -#define SWI_OS_LINUX 0x900000
> -#define SWI_OS_NETBSD 0xa00000
> -#define SWI_OS_ARM 0xf00000
> -
> -#define SWI_IMB 0xf00000
> -#define SWI_IMBrange 0xf00001
> -
> -#endif
> -
> Index: sys/arch/arm64/arm64/machdep.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/arm64/arm64/machdep.c,v
> retrieving revision 1.33
> diff -u -p -r1.33 machdep.c
> --- sys/arch/arm64/arm64/machdep.c 15 May 2018 11:12:35 -0000 1.33
> +++ sys/arch/arm64/arm64/machdep.c 28 May 2018 09:03:07 -0000
> @@ -1136,13 +1136,13 @@ remap_efi_runtime(EFI_PHYSICAL_ADDRESS s
> }
>
> int comcnspeed = B115200;
> -char bootargs[MAX_BOOT_STRING];
> +char bootargs[256];
>
> void
> collect_kernel_args(char *args)
> {
> /* Make a local copy of the bootargs */
> - strncpy(bootargs, args, MAX_BOOT_STRING - sizeof(int));
> + strlcpy(bootargs, args, sizeof(bootargs));
> }
>
> void
> Index: lib/libc/arch/aarch64/SYS.h
> ===================================================================
> RCS file: /cvs/src/lib/libc/arch/aarch64/SYS.h,v
> retrieving revision 1.1
> diff -u -p -r1.1 SYS.h
> --- lib/libc/arch/aarch64/SYS.h 11 Jan 2017 18:09:24 -0000 1.1
> +++ lib/libc/arch/aarch64/SYS.h 28 May 2018 09:03:07 -0000
> @@ -37,7 +37,6 @@
>
> #include "DEFS.h"
> #include <sys/syscall.h>
> -#include <arm64/swi.h>
>
> #define SYSENTRY(x) \
> .weak _C_LABEL(x); \
>
Dale Rahn dr...@dalerahn.com