Date: Thu, 03 Apr 2008 01:49:38 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: arm@freebsd.org Subject: Tiny cleanup Message-ID: <20080403.014938.709397886.imp@bsdimp.com>
next in thread | raw e-mail | index | archive | help
I've moved all the fake_preload[] initialization to one function, and changed all the machdep's in the tree to use it. All the copies were the same, as far as I could tell. Well, there were a few minor differences that I think were either the results of code drift, or were different ways to lexically spell KERNVIRTADDR. Please review this patch and let me know what you think. Comments? Warner Index: arm/machdep.c =================================================================== RCS file: /home/ncvs/src/sys/arm/arm/machdep.c,v retrieving revision 1.29 diff -u -r1.29 machdep.c --- arm/machdep.c 16 Mar 2008 10:58:02 -0000 1.29 +++ arm/machdep.c 3 Apr 2008 07:48:17 -0000 @@ -43,6 +43,8 @@ */ #include "opt_compat.h" +#include "opt_ddb.h" + #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/arm/arm/machdep.c,v 1.29 2008/03/16 10:58:02 rwatson Exp $"); @@ -101,6 +103,11 @@ int _min_memcpy_size = 0; int _min_bzero_size = 0; +extern int *end; +#ifdef DDB +extern vm_offset_t ksym_start, ksym_end; +#endif + void sendsig(catcher, ksi, mask) sig_t catcher; @@ -631,3 +638,53 @@ pcb->un_32.pcb32_lr = tf->tf_usr_lr; pcb->un_32.pcb32_sp = tf->tf_usr_sp; } + +/* + * Fake up a boot descriptor table + */ +vm_offset_t +fake_preload_metadata(void) +{ +#ifdef DDB + vm_offset_t zstart = 0, zend = 0; +#endif + vm_offset_t lastaddr; + int i = 0; + static uint32_t fake_preload[35]; + + fake_preload[i++] = MODINFO_NAME; + fake_preload[i++] = strlen("elf kernel") + 1; + strcpy((char*)&fake_preload[i++], "elf kernel"); + i += 2; + fake_preload[i++] = MODINFO_TYPE; + fake_preload[i++] = strlen("elf kernel") + 1; + strcpy((char*)&fake_preload[i++], "elf kernel"); + i += 2; + fake_preload[i++] = MODINFO_ADDR; + fake_preload[i++] = sizeof(vm_offset_t); + fake_preload[i++] = KERNVIRTADDR; + 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); + ksym_start = zstart; + ksym_end = zend; + } else +#endif + lastaddr = (vm_offset_t)&end; + fake_preload[i++] = 0; + fake_preload[i] = 0; + preload_metadata = (void *)fake_preload; + + return (lastaddr); +} Index: at91/kb920x_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/arm/at91/kb920x_machdep.c,v retrieving revision 1.29 diff -u -r1.29 kb920x_machdep.c --- at91/kb920x_machdep.c 3 Apr 2008 06:07:45 -0000 1.29 +++ at91/kb920x_machdep.c 3 Apr 2008 07:48:18 -0000 @@ -44,7 +44,6 @@ */ #include "opt_msgbuf.h" -#include "opt_ddb.h" #include "opt_at91.h" #include <sys/cdefs.h> @@ -187,12 +186,6 @@ } }; -#define SDRAM_START 0xa0000000 - -#ifdef DDB -extern vm_offset_t ksym_start, ksym_end; -#endif - static long ramsize(void) { @@ -257,58 +250,15 @@ initarm(void *arg, void *arg2) { struct pv_addr kernel_l1pt; - int loop; + int loop, i; u_int l1pagetable; vm_offset_t freemempos; vm_offset_t afterkern; - int i; - uint32_t fake_preload[35]; uint32_t memsize; vm_offset_t lastaddr; -#ifdef DDB - vm_offset_t zstart = 0, zend = 0; -#endif - - i = 0; set_cpufuncs(); - - fake_preload[i++] = MODINFO_NAME; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; - fake_preload[i++] = MODINFO_TYPE; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; - fake_preload[i++] = MODINFO_ADDR; - fake_preload[i++] = sizeof(vm_offset_t); - fake_preload[i++] = KERNVIRTADDR; - 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); - ksym_start = zstart; - ksym_end = zend; - } else -#endif - lastaddr = (vm_offset_t)&end; - - fake_preload[i++] = 0; - fake_preload[i] = 0; - preload_metadata = (void *)fake_preload; - - + lastaddr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); @@ -367,7 +317,7 @@ pmap_link_l2pt(l1pagetable, KERNBASE + i * 0x100000, &kernel_pt_table[KERNEL_PT_KERN + i]); pmap_map_chunk(l1pagetable, KERNBASE, PHYSADDR, - (((uint32_t)(lastaddr) - KERNBASE) + PAGE_SIZE) & ~(PAGE_SIZE - 1), + (((uint32_t)lastaddr - KERNBASE) + PAGE_SIZE) & ~(PAGE_SIZE - 1), VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); afterkern = round_page((lastaddr + L1_S_SIZE) & ~(L1_S_SIZE - 1)); Index: include/machdep.h =================================================================== RCS file: /home/ncvs/src/sys/arm/include/machdep.h,v retrieving revision 1.2 diff -u -r1.2 machdep.h --- include/machdep.h 26 Feb 2005 18:59:01 -0000 1.2 +++ include/machdep.h 3 Apr 2008 07:48:18 -0000 @@ -5,11 +5,11 @@ #define _MACHDEP_BOOT_MACHDEP_H_ /* misc prototypes used by the many arm machdeps */ -void halt (void); -void data_abort_handler (trapframe_t *); -void prefetch_abort_handler (trapframe_t *); -void undefinedinstruction_bounce (trapframe_t *); - void arm_lock_cache_line(vm_offset_t); +vm_offset_t fake_preload_metadata(void); +void halt(void); +void data_abort_handler(trapframe_t *); +void prefetch_abort_handler(trapframe_t *); +void undefinedinstruction_bounce(trapframe_t *); #endif /* !_MACHINE_MACHDEP_H_ */ Index: sa11x0/assabet_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/arm/sa11x0/assabet_machdep.c,v retrieving revision 1.22 diff -u -r1.22 assabet_machdep.c --- sa11x0/assabet_machdep.c 5 Nov 2007 11:36:10 -0000 1.22 +++ sa11x0/assabet_machdep.c 3 Apr 2008 07:48:18 -0000 @@ -217,58 +217,25 @@ u_int l1pagetable; vm_offset_t freemempos; vm_offset_t lastalloced; + vm_offset_t lastaddr; vm_size_t pt_size; - int i = 0; - uint32_t fake_preload[35]; uint32_t memsize = 32 * 1024 * 1024; sa1110_uart_vaddr = SACOM1_VBASE; boothowto = RB_VERBOSE | RB_SINGLE; cninit(); set_cpufuncs(); - fake_preload[i++] = MODINFO_NAME; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; - fake_preload[i++] = MODINFO_TYPE; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; - fake_preload[i++] = MODINFO_ADDR; - fake_preload[i++] = sizeof(vm_offset_t); - fake_preload[i++] = KERNBASE; - fake_preload[i++] = MODINFO_SIZE; - fake_preload[i++] = sizeof(uint32_t); - fake_preload[i++] = (uint32_t)&end - KERNBASE; - fake_preload[i++] = MODINFO_NAME; - fake_preload[i++] = strlen("md root") + 1; - strcpy((char*)&fake_preload[i++], "md root"); - i += 1; - fake_preload[i++] = MODINFO_TYPE; - fake_preload[i++] = strlen("md_image") + 1; - strcpy((char*)&fake_preload[i++], "md_image"); - i += 2; - fake_preload[i++] = MODINFO_ADDR; - fake_preload[i++] = sizeof(uint32_t); - fake_preload[i++] = MDROOT_ADDR; - fake_preload[i++] = MODINFO_SIZE; - fake_preload[i++] = sizeof(uint32_t); - fake_preload[i++] = MD_ROOT_SIZE * 1024; - fake_preload[i++] = 0; - fake_preload[i] = 0; - preload_metadata = (void *)fake_preload; - + lastaddr = fake_reload_metadata(); physmem = memsize / PAGE_SIZE; pc = &__pcpu; pcpu_init(pc, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); physical_start = (vm_offset_t) KERNBASE; - physical_end = (vm_offset_t) &end; + physical_end = lastaddr; physical_freestart = (((vm_offset_t)physical_end) + PAGE_MASK) & ~PAGE_MASK; md_addr.pv_va = md_addr.pv_pa = MDROOT_ADDR; -#define KERNEL_TEXT_BASE (KERNBASE + 0x00040000) - kerneldatasize = (u_int32_t)&end - (u_int32_t)KERNEL_TEXT_BASE; + kerneldatasize = (u_int32_t)&end - (u_int32_t)KERNVIRTADDR; symbolsize = 0; freemempos = (vm_offset_t)round_page(physical_freestart); memset((void *)freemempos, 0, 256*1024); @@ -348,7 +315,8 @@ pmap_link_l2pt(l1pagetable, KERNEL_VM_BASE + loop * 0x00100000, &kernel_pt_table[KERNEL_PT_VMDATA + loop]); pmap_map_chunk(l1pagetable, KERNBASE, KERNBASE, - ((uint32_t)&end - KERNBASE), VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); + ((uint32_t)lastaddr - KERNBASE), VM_PROT_READ|VM_PROT_WRITE, + PTE_CACHE); /* Map the stack pages */ pmap_map_chunk(l1pagetable, irqstack.pv_va, irqstack.pv_pa, IRQ_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); @@ -403,8 +371,6 @@ set_stackptr(PSR_UND32_MODE, undstack.pv_va + UND_STACK_SIZE * PAGE_SIZE); - - /* * We must now clean the cache again.... * Cleaning may be done by reading new data to displace any @@ -417,7 +383,6 @@ */ cpu_idcache_wbinv_all(); - bootverbose = 1; /* Set stack for exception handlers */ @@ -443,8 +408,7 @@ dump_avail[3] = phys_avail[3] = 0; mutex_init(); - pmap_bootstrap(freemempos, - 0xd0000000, &kernel_l1pt); + pmap_bootstrap(freemempos, 0xd0000000, &kernel_l1pt); /* Do basic tuning, hz etc */ init_param1(); Index: xscale/i80321/ep80219_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/arm/xscale/i80321/ep80219_machdep.c,v retrieving revision 1.8 diff -u -r1.8 ep80219_machdep.c --- xscale/i80321/ep80219_machdep.c 5 Nov 2007 11:36:10 -0000 1.8 +++ xscale/i80321/ep80219_machdep.c 3 Apr 2008 07:48:18 -0000 @@ -46,7 +46,6 @@ */ #include "opt_msgbuf.h" -#include "opt_ddb.h" #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/ep80219_machdep.c,v 1.8 2007/11/05 11:36:10 kib Exp $"); @@ -186,10 +185,6 @@ } }; -#ifdef DDB -extern vm_offset_t ksym_start, ksym_end; -#endif - extern vm_offset_t xscale_cache_clean_addr; void * @@ -203,56 +198,13 @@ vm_offset_t afterkern; vm_offset_t freemem_after; vm_offset_t lastaddr; -#ifdef DDB - vm_offset_t zstart = 0, zend = 0; -#endif - int i = 0; - uint32_t fake_preload[35]; uint32_t memsize, memstart; - i = 0; - set_cpufuncs(); - fake_preload[i++] = MODINFO_NAME; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; - fake_preload[i++] = MODINFO_TYPE; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; - fake_preload[i++] = MODINFO_ADDR; - fake_preload[i++] = sizeof(vm_offset_t); - fake_preload[i++] = KERNBASE + 0x00200000; - fake_preload[i++] = MODINFO_SIZE; - fake_preload[i++] = sizeof(uint32_t); - fake_preload[i++] = (uint32_t)&end - KERNBASE - 0x00200000; -#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); - ksym_start = zstart; - ksym_end = zend; - } else -#endif - lastaddr = (vm_offset_t)&end; - - fake_preload[i++] = 0; - fake_preload[i] = 0; - preload_metadata = (void *)fake_preload; - - + lastaddr = fake_reload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); -#define KERNEL_TEXT_BASE (KERNBASE + 0x00200000) freemempos = 0xa0200000; /* Define a macro to simplify memory allocation */ #define valloc_pages(var, np) \ @@ -437,9 +389,6 @@ /* Enable MMU, I-cache, D-cache, write buffer. */ arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); - - - pmap_curmaxkvaddr = afterkern + PAGE_SIZE; dump_avail[0] = 0xa0000000; dump_avail[1] = 0xa0000000 + memsize; Index: xscale/i80321/iq31244_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/arm/xscale/i80321/iq31244_machdep.c,v retrieving revision 1.29 diff -u -r1.29 iq31244_machdep.c --- xscale/i80321/iq31244_machdep.c 5 Nov 2007 11:36:10 -0000 1.29 +++ xscale/i80321/iq31244_machdep.c 3 Apr 2008 07:48:18 -0000 @@ -46,7 +46,6 @@ */ #include "opt_msgbuf.h" -#include "opt_ddb.h" #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/iq31244_machdep.c,v 1.29 2007/11/05 11:36:10 kib Exp $"); @@ -187,10 +186,6 @@ #define SDRAM_START 0xa0000000 -#ifdef DDB -extern vm_offset_t ksym_start, ksym_end; -#endif - extern vm_offset_t xscale_cache_clean_addr; void * @@ -204,56 +199,13 @@ vm_offset_t afterkern; vm_offset_t freemem_after; vm_offset_t lastaddr; -#ifdef DDB - vm_offset_t zstart = 0, zend = 0; -#endif - int i; - uint32_t fake_preload[35]; uint32_t memsize, memstart; - i = 0; - set_cpufuncs(); - fake_preload[i++] = MODINFO_NAME; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; - fake_preload[i++] = MODINFO_TYPE; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; - fake_preload[i++] = MODINFO_ADDR; - fake_preload[i++] = sizeof(vm_offset_t); - fake_preload[i++] = KERNBASE + 0x00200000; - fake_preload[i++] = MODINFO_SIZE; - fake_preload[i++] = sizeof(uint32_t); - fake_preload[i++] = (uint32_t)&end - KERNBASE - 0x00200000; -#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); - ksym_start = zstart; - ksym_end = zend; - } else -#endif - lastaddr = (vm_offset_t)&end; - - fake_preload[i++] = 0; - fake_preload[i] = 0; - preload_metadata = (void *)fake_preload; - - + last_addr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); -#define KERNEL_TEXT_BASE (KERNBASE + 0x00200000) freemempos = 0xa0200000; /* Define a macro to simplify memory allocation */ #define valloc_pages(var, np) \ Index: xscale/i8134x/crb_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/arm/xscale/i8134x/crb_machdep.c,v retrieving revision 1.4 diff -u -r1.4 crb_machdep.c --- xscale/i8134x/crb_machdep.c 12 Mar 2008 10:11:55 -0000 1.4 +++ xscale/i8134x/crb_machdep.c 3 Apr 2008 07:48:18 -0000 @@ -46,7 +46,6 @@ */ #include "opt_msgbuf.h" -#include "opt_ddb.h" #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/arm/xscale/i8134x/crb_machdep.c,v 1.4 2008/03/12 10:11:55 jeff Exp $"); @@ -125,11 +124,7 @@ extern u_int undefined_handler_address; struct pv_addr kernel_pt_table[NUM_KERNEL_PTS]; - -extern void *_end; - extern vm_offset_t sa1_cache_clean_addr; - extern int *end; struct pcpu __pcpu; @@ -189,10 +184,6 @@ #define SDRAM_START 0x00000000 -#ifdef DDB -extern vm_offset_t ksym_start, ksym_end; -#endif - extern vm_offset_t xscale_cache_clean_addr; void * @@ -206,56 +197,13 @@ vm_offset_t afterkern; vm_offset_t freemem_after; vm_offset_t lastaddr; -#ifdef DDB - vm_offset_t zstart = 0, zend = 0; -#endif - int i; - uint32_t fake_preload[35]; uint32_t memsize, memstart; - i = 0; - set_cpufuncs(); - fake_preload[i++] = MODINFO_NAME; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; - fake_preload[i++] = MODINFO_TYPE; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; - fake_preload[i++] = MODINFO_ADDR; - fake_preload[i++] = sizeof(vm_offset_t); - fake_preload[i++] = KERNBASE + 0x00200000; - fake_preload[i++] = MODINFO_SIZE; - fake_preload[i++] = sizeof(uint32_t); - fake_preload[i++] = (uint32_t)&end - KERNBASE - 0x00200000; -#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); - ksym_start = zstart; - ksym_end = zend; - } else -#endif - lastaddr = (vm_offset_t)&end; - - fake_preload[i++] = 0; - fake_preload[i] = 0; - preload_metadata = (void *)fake_preload; - - + last_addr = fake_preload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); -#define KERNEL_TEXT_BASE (KERNBASE + 0x00200000) freemempos = 0x00200000; /* Define a macro to simplify memory allocation */ #define valloc_pages(var, np) \ Index: xscale/ixp425/avila_machdep.c =================================================================== RCS file: /home/ncvs/src/sys/arm/xscale/ixp425/avila_machdep.c,v retrieving revision 1.7 diff -u -r1.7 avila_machdep.c --- xscale/ixp425/avila_machdep.c 3 Apr 2008 06:14:23 -0000 1.7 +++ xscale/ixp425/avila_machdep.c 3 Apr 2008 07:48:18 -0000 @@ -46,7 +46,6 @@ */ #include "opt_msgbuf.h" -#include "opt_ddb.h" #include <sys/cdefs.h> __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/avila_machdep.c,v 1.7 2008/04/03 06:14:23 imp Exp $"); @@ -251,10 +250,6 @@ #define SDRAM_START 0x10000000 -#ifdef DDB -extern vm_offset_t ksym_start, ksym_end; -#endif - extern vm_offset_t xscale_cache_clean_addr; void * @@ -268,52 +263,10 @@ vm_offset_t afterkern; vm_offset_t freemem_after; vm_offset_t lastaddr; -#ifdef DDB - vm_offset_t zstart = 0, zend = 0; -#endif - int i; - uint32_t fake_preload[35]; uint32_t memsize; - i = 0; - set_cpufuncs(); - fake_preload[i++] = MODINFO_NAME; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; - fake_preload[i++] = MODINFO_TYPE; - fake_preload[i++] = strlen("elf kernel") + 1; - strcpy((char*)&fake_preload[i++], "elf kernel"); - i += 2; - fake_preload[i++] = MODINFO_ADDR; - fake_preload[i++] = sizeof(vm_offset_t); - fake_preload[i++] = KERNVIRTADDR; - 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); - ksym_start = zstart; - ksym_end = zend; - } else -#endif - lastaddr = (vm_offset_t)&end; - - fake_preload[i++] = 0; - fake_preload[i] = 0; - preload_metadata = (void *)fake_preload; - - + lastaddr = fake_reload_metadata(); pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080403.014938.709397886.imp>