Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
Re: minor sparc64 bootblocks cleanup
To:
Miod Vallat <miod@online.fr>
Cc:
tech@openbsd.org
Date:
Fri, 14 Nov 2025 13:19:39 +0100

Download raw body.

Thread
> Date: Fri, 14 Nov 2025 09:12:05 +0000
> From: Miod Vallat <miod@online.fr>
> 
> The following diff:
> - simplifies an internal interface by removing unused arguments
> - removes commented-out code
> - only flushes the cache for program headers marked executable, thus
>   being faster at loading the non-code parts of the kernel.

ok kettenis@

> Index: Locore.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/sparc64/stand/ofwboot/Locore.c,v
> diff -u -p -r1.18 Locore.c
> --- Locore.c	1 Jun 2023 17:24:56 -0000	1.18
> +++ Locore.c	14 Nov 2025 09:01:32 -0000
> @@ -304,7 +304,7 @@ OF_milliseconds(void)
>  }
>  
>  void
> -OF_chain(void *virt, u_int size, void (*entry)(), void *arg, u_int len)
> +OF_chain(void (*entry)(), void *arg, u_int len)
>  {
>  	extern int64_t romp;
>  
> Index: boot.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/sparc64/stand/ofwboot/boot.c,v
> diff -u -p -r1.44 boot.c
> --- boot.c	26 Mar 2024 14:46:48 -0000	1.44
> +++ boot.c	14 Nov 2025 09:01:32 -0000
> @@ -201,13 +201,12 @@ chain(u_int64_t pentry, char *args, void
>  	l = sizeof(newargs);
>  
>  #ifdef DEBUG
> -	printf("chain: calling OF_chain(%x, %x, %x, %x, %x)\n",
> -	    (void *)RELOC, end - (char *)RELOC, entry, args, l);
> +	printf("chain: calling OF_chain(%p, %p, %x)\n",
> +	    entry, args, l);
>  #endif
>  	/* if -D is set then pause in the PROM. */
>  	if (debug > 1) OF_enter();
> -	OF_chain((void *)RELOC, ((end - (char *)RELOC)+PAGE_SIZE)%PAGE_SIZE,
> -	    entry, args, l);
> +	OF_chain(entry, args, l);
>  	panic("chain");
>  }
>  
> Index: elf64_exec.c
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/sparc64/stand/ofwboot/elf64_exec.c,v
> diff -u -p -r1.18 elf64_exec.c
> --- elf64_exec.c	9 Nov 2023 14:26:34 -0000	1.18
> +++ elf64_exec.c	14 Nov 2025 09:01:32 -0000
> @@ -170,7 +170,8 @@ elf64_exec(int fd, Elf_Ehdr *elf, u_int6
>  			printf("read segment: %s\n", strerror(errno));
>  			return (1);
>  		}
> -		syncicache((void *)(long)phdr.p_vaddr, phdr.p_filesz);
> +		if (phdr.p_flags & PF_X)
> +			syncicache((void *)(long)phdr.p_vaddr, phdr.p_filesz);
>  
>  		/* Zero BSS. */
>  		if (phdr.p_filesz < phdr.p_memsz) {
> Index: openfirm.h
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/sparc64/stand/ofwboot/openfirm.h,v
> diff -u -p -r1.7 openfirm.h
> --- openfirm.h	26 Jun 2018 19:43:27 -0000	1.7
> +++ openfirm.h	14 Nov 2025 09:01:32 -0000
> @@ -54,7 +54,7 @@ int OF_seek(u_int handle, u_int64_t pos)
>  void *OF_claim(void *virt, u_int size, u_int align);
>  void OF_release(void *virt, u_int size);
>  int OF_milliseconds(void);
> -void OF_chain(void *addr, u_int size, void (*entry)(), void *parm, u_int parmlen);
> +void OF_chain(void (*entry)(), void *parm, u_int parmlen);
>  int OF_peer(int);
>  int OF_child(int);
>  int OF_parent(int);
> Index: srt0.s
> ===================================================================
> RCS file: /OpenBSD/src/sys/arch/sparc64/stand/ofwboot/srt0.s,v
> diff -u -p -r1.7 srt0.s
> --- srt0.s	8 Dec 2022 01:25:45 -0000	1.7
> +++ srt0.s	14 Nov 2025 09:01:32 -0000
> @@ -189,12 +189,3 @@ openfirmware:
>  	mov	%l7, %g7
>  	ret
>  	 restore	%o0, %g0, %o0
> -
> -#if 0
> -	.data
> -	.align 8
> -bootstack:	
> -#define STACK_SIZE	0x14000
> -	.skip	STACK_SIZE
> -ebootstack:			! end (top) of boot stack
> -#endif
> 
>