svn commit: r361661 - in head/sys: arm/arm arm/include arm64/arm64 riscv/riscv

Mitchell Horne mhorne at FreeBSD.org
Sun May 31 14:43:05 UTC 2020


Author: mhorne
Date: Sun May 31 14:43:04 2020
New Revision: 361661
URL: https://svnweb.freebsd.org/changeset/base/361661

Log:
  Remove remnant of arm's ELF trampoline
  
  The trampoline code used for loading gzipped a.out kernels on arm was
  removed in r350436. A portion of this code allowed for DDB to find the
  symbol tables when booting without loader(8), and some of this was
  untouched in the removal. Remove it now.
  
  Differential Revision:	https://reviews.freebsd.org/D24950

Modified:
  head/sys/arm/arm/machdep_boot.c
  head/sys/arm/include/elf.h
  head/sys/arm64/arm64/machdep_boot.c
  head/sys/riscv/riscv/machdep.c

Modified: head/sys/arm/arm/machdep_boot.c
==============================================================================
--- head/sys/arm/arm/machdep_boot.c	Sun May 31 05:02:15 2020	(r361660)
+++ head/sys/arm/arm/machdep_boot.c	Sun May 31 14:43:04 2020	(r361661)
@@ -352,13 +352,12 @@ vm_offset_t
 fake_preload_metadata(struct arm_boot_params *abp __unused, void *dtb_ptr,
     size_t dtb_size)
 {
-#ifdef DDB
-	vm_offset_t zstart = 0, zend = 0;
-#endif
 	vm_offset_t lastaddr;
 	int i = 0;
 	static uint32_t fake_preload[35];
 
+	lastaddr = (vm_offset_t)&end;
+
 	fake_preload[i++] = MODINFO_NAME;
 	fake_preload[i++] = strlen("kernel") + 1;
 	strcpy((char*)&fake_preload[i++], "kernel");
@@ -373,21 +372,6 @@ fake_preload_metadata(struct arm_boot_params *abp __un
 	fake_preload[i++] = MODINFO_SIZE;
 	fake_preload[i++] = sizeof(uint32_t);
 	fake_preload[i++] = (uint32_t)&end - KERNVIRTADDR;
-#ifdef DDB
-	if (*(uint32_t *)KERNVIRTADDR == MAGIC_TRAMP_NUMBER) {
-		fake_preload[i++] = MODINFO_METADATA|MODINFOMD_SSYM;
-		fake_preload[i++] = sizeof(vm_offset_t);
-		fake_preload[i++] = *(uint32_t *)(KERNVIRTADDR + 4);
-		fake_preload[i++] = MODINFO_METADATA|MODINFOMD_ESYM;
-		fake_preload[i++] = sizeof(vm_offset_t);
-		fake_preload[i++] = *(uint32_t *)(KERNVIRTADDR + 8);
-		lastaddr = *(uint32_t *)(KERNVIRTADDR + 8);
-		zend = lastaddr;
-		zstart = *(uint32_t *)(KERNVIRTADDR + 4);
-		db_fetch_ksymtab(zstart, zend);
-	} else
-#endif
-		lastaddr = (vm_offset_t)&end;
 	if (dtb_ptr != NULL) {
 		/* Copy DTB to KVA space and insert it into module chain. */
 		lastaddr = roundup(lastaddr, sizeof(int));

Modified: head/sys/arm/include/elf.h
==============================================================================
--- head/sys/arm/include/elf.h	Sun May 31 05:02:15 2020	(r361660)
+++ head/sys/arm/include/elf.h	Sun May 31 14:43:04 2020	(r361661)
@@ -78,12 +78,6 @@ __ElfType(Auxinfo);
 #define	EF_ARM_EABI_VERSION_UNKNOWN 0
 #define	EF_ARM_EABI_FREEBSD_MIN 4
 
-/*
- * Magic number for the elf trampoline, chosen wisely to be an immediate
- * value.
- */
-#define	MAGIC_TRAMP_NUMBER	0x5c000003
-
 #define	ET_DYN_LOAD_ADDR	0x500000
 
 /* Flags passed in AT_HWCAP. */

Modified: head/sys/arm64/arm64/machdep_boot.c
==============================================================================
--- head/sys/arm64/arm64/machdep_boot.c	Sun May 31 05:02:15 2020	(r361660)
+++ head/sys/arm64/arm64/machdep_boot.c	Sun May 31 14:43:04 2020	(r361661)
@@ -84,14 +84,12 @@ static char linux_command_line[LBABI_MAX_COMMAND_LINE 
 static vm_offset_t
 fake_preload_metadata(void *dtb_ptr, size_t dtb_size)
 {
-#ifdef DDB
-	vm_offset_t zstart = 0, zend = 0;
-#endif
 	vm_offset_t lastaddr;
 	static char fake_preload[256];
 	caddr_t preload_ptr;
 	size_t size;
 
+	lastaddr = (vm_offset_t)&end;
 	preload_ptr = (caddr_t)&fake_preload[0];
 	size = 0;
 
@@ -108,25 +106,7 @@ fake_preload_metadata(void *dtb_ptr, size_t dtb_size)
 	PRELOAD_PUSH_VALUE(uint32_t, MODINFO_SIZE);
 	PRELOAD_PUSH_VALUE(uint32_t, sizeof(size_t));
 	PRELOAD_PUSH_VALUE(uint64_t, (size_t)(&end - VM_MIN_KERNEL_ADDRESS));
-#ifdef DDB
-	if (*(uint64_t *)VM_MIN_KERNEL_ADDRESS == MAGIC_TRAMP_NUMBER) {
-		PRELOAD_PUSH_VALUE(uint32_t, MODINFO_METADATA|MODINFOMD_SSYM);
-		PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t));
-		PRELOAD_PUSH_VALUE(uint64_t,
-		    *(uint64_t *)(VM_MIN_KERNEL_ADDRESS + 4));
 
-		PRELOAD_PUSH_VALUE(uint32_t, MODINFO_METADATA | MODINFOMD_ESYM);
-		PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t));
-		PRELOAD_PUSH_VALUE(uint64_t,
-		    *(uint64_t *)(VM_MIN_KERNEL_ADDRESS + 8));
-
-		lastaddr = *(uint64_t *)(VM_MIN_KERNEL_ADDRESS + 8);
-		zend = lastaddr;
-		zstart = *(uint64_t *)(VM_MIN_KERNEL_ADDRESS + 4);
-		db_fetch_ksymtab(zstart, zend);
-	} else
-#endif
-		lastaddr = (vm_offset_t)&end;
 	if (dtb_ptr != NULL) {
 		/* Copy DTB to KVA space and insert it into module chain. */
 		lastaddr = roundup(lastaddr, sizeof(int));

Modified: head/sys/riscv/riscv/machdep.c
==============================================================================
--- head/sys/riscv/riscv/machdep.c	Sun May 31 05:02:15 2020	(r361660)
+++ head/sys/riscv/riscv/machdep.c	Sun May 31 14:43:04 2020	(r361661)
@@ -729,9 +729,6 @@ vm_offset_t
 fake_preload_metadata(struct riscv_bootparams *rvbp)
 {
 	static uint32_t fake_preload[35];
-#ifdef DDB
-	vm_offset_t zstart = 0, zend = 0;
-#endif
 	vm_offset_t lastaddr;
 	size_t fake_size, dtb_size;
 
@@ -750,6 +747,7 @@ fake_preload_metadata(struct riscv_bootparams *rvbp)
 } while (0)
 
 	fake_size = 0;
+	lastaddr = (vm_offset_t)&end;
 
 	PRELOAD_PUSH_VALUE(uint32_t, MODINFO_NAME);
 	PRELOAD_PUSH_STRING("kernel");
@@ -763,24 +761,6 @@ fake_preload_metadata(struct riscv_bootparams *rvbp)
 	PRELOAD_PUSH_VALUE(uint32_t, MODINFO_SIZE);
 	PRELOAD_PUSH_VALUE(uint32_t, sizeof(size_t));
 	PRELOAD_PUSH_VALUE(uint64_t, (size_t)((vm_offset_t)&end - KERNBASE));
-#ifdef DDB
-#if 0
-	/* RISCVTODO */
-	if (*(uint32_t *)KERNVIRTADDR == MAGIC_TRAMP_NUMBER) {
-		fake_preload[i++] = MODINFO_METADATA|MODINFOMD_SSYM;
-		fake_preload[i++] = sizeof(vm_offset_t);
-		fake_preload[i++] = *(uint32_t *)(KERNVIRTADDR + 4);
-		fake_preload[i++] = MODINFO_METADATA|MODINFOMD_ESYM;
-		fake_preload[i++] = sizeof(vm_offset_t);
-		fake_preload[i++] = *(uint32_t *)(KERNVIRTADDR + 8);
-		lastaddr = *(uint32_t *)(KERNVIRTADDR + 8);
-		zend = lastaddr;
-		zstart = *(uint32_t *)(KERNVIRTADDR + 4);
-		db_fetch_ksymtab(zstart, zend);
-	} else
-#endif
-#endif
-		lastaddr = (vm_offset_t)&end;
 
 	/* Copy the DTB to KVA space. */
 	lastaddr = roundup(lastaddr, sizeof(int));


More information about the svn-src-all mailing list