Date: Wed, 21 Dec 2005 20:46:49 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 88529 for review Message-ID: <200512212046.jBLKkn9Z036887@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=88529 Change 88529 by jhb@jhb_slimer on 2005/12/21 20:45:50 IFC @88526. Affected files ... .. //depot/projects/smpng/sys/alpha/alpha/elf_machdep.c#15 integrate .. //depot/projects/smpng/sys/amd64/amd64/elf_machdep.c#10 integrate .. //depot/projects/smpng/sys/amd64/pci/pci_bus.c#14 integrate .. //depot/projects/smpng/sys/arm/arm/elf_trampoline.c#3 integrate .. //depot/projects/smpng/sys/arm/arm/locore.S#11 integrate .. //depot/projects/smpng/sys/arm/xscale/i80321/iq31244_machdep.c#17 integrate .. //depot/projects/smpng/sys/boot/common/bootstrap.h#9 integrate .. //depot/projects/smpng/sys/boot/common/load_elf.c#13 integrate .. //depot/projects/smpng/sys/boot/common/load_elf_obj.c#2 integrate .. //depot/projects/smpng/sys/boot/common/reloc_elf.c#2 integrate .. //depot/projects/smpng/sys/boot/i386/libi386/Makefile#14 integrate .. //depot/projects/smpng/sys/boot/i386/libi386/biosdisk.c#12 integrate .. //depot/projects/smpng/sys/boot/i386/libi386/biosmem.c#4 integrate .. //depot/projects/smpng/sys/boot/i386/libi386/biospnp.c#6 integrate .. //depot/projects/smpng/sys/boot/i386/libi386/biossmap.c#4 integrate .. //depot/projects/smpng/sys/boot/i386/libi386/i386_copy.c#3 integrate .. //depot/projects/smpng/sys/boot/i386/libi386/libi386.h#10 integrate .. //depot/projects/smpng/sys/boot/i386/loader/main.c#12 integrate .. //depot/projects/smpng/sys/boot/pc98/libpc98/Makefile#13 integrate .. //depot/projects/smpng/sys/boot/pc98/libpc98/biosdisk.c#11 integrate .. //depot/projects/smpng/sys/boot/pc98/libpc98/biosmem.c#5 integrate .. //depot/projects/smpng/sys/boot/pc98/loader/main.c#10 integrate .. //depot/projects/smpng/sys/cam/scsi/scsi_da.c#61 integrate .. //depot/projects/smpng/sys/conf/Makefile.arm#17 integrate .. //depot/projects/smpng/sys/conf/NOTES#110 integrate .. //depot/projects/smpng/sys/conf/files#161 integrate .. //depot/projects/smpng/sys/contrib/pf/net/pf.c#21 integrate .. //depot/projects/smpng/sys/contrib/pf/net/pfvar.h#9 integrate .. //depot/projects/smpng/sys/dev/acpica/acpi_pci.c#19 integrate .. //depot/projects/smpng/sys/dev/acpica/acpi_video.c#10 integrate .. //depot/projects/smpng/sys/dev/bge/if_bge.c#66 integrate .. //depot/projects/smpng/sys/dev/bge/if_bgereg.h#35 integrate .. //depot/projects/smpng/sys/dev/cp/cpddk.c#5 integrate .. //depot/projects/smpng/sys/dev/drm/drm_agpsupport.c#4 integrate .. //depot/projects/smpng/sys/dev/drm/drm_drv.c#3 integrate .. //depot/projects/smpng/sys/dev/drm/i915_drv.c#3 integrate .. //depot/projects/smpng/sys/dev/drm/mach64_drv.c#3 integrate .. //depot/projects/smpng/sys/dev/drm/mga_drv.c#9 integrate .. //depot/projects/smpng/sys/dev/drm/r128_drv.c#9 integrate .. //depot/projects/smpng/sys/dev/drm/radeon_drv.c#11 integrate .. //depot/projects/smpng/sys/dev/drm/savage_drv.c#3 integrate .. //depot/projects/smpng/sys/dev/drm/sis_drv.c#7 integrate .. //depot/projects/smpng/sys/dev/drm/tdfx_drv.c#9 integrate .. //depot/projects/smpng/sys/dev/em/if_em.c#60 integrate .. //depot/projects/smpng/sys/dev/ixgb/if_ixgb.c#15 integrate .. //depot/projects/smpng/sys/dev/nge/if_nge.c#47 integrate .. //depot/projects/smpng/sys/dev/pci/hostb_pci.c#1 branch .. //depot/projects/smpng/sys/dev/pci/pci.c#66 integrate .. //depot/projects/smpng/sys/dev/pci/pci_if.m#5 integrate .. //depot/projects/smpng/sys/dev/pci/pci_private.h#13 integrate .. //depot/projects/smpng/sys/dev/pci/pcireg.h#13 integrate .. //depot/projects/smpng/sys/dev/pci/pcivar.h#16 integrate .. //depot/projects/smpng/sys/dev/pci/vga_pci.c#1 branch .. //depot/projects/smpng/sys/dev/ppbus/if_plip.c#16 integrate .. //depot/projects/smpng/sys/dev/ppbus/immio.c#3 integrate .. //depot/projects/smpng/sys/dev/ppbus/lpbb.c#6 integrate .. //depot/projects/smpng/sys/dev/ppbus/lpt.c#14 integrate .. //depot/projects/smpng/sys/dev/ppbus/ppi.c#12 integrate .. //depot/projects/smpng/sys/dev/ppbus/pps.c#19 integrate .. //depot/projects/smpng/sys/dev/ppc/ppc.c#7 integrate .. //depot/projects/smpng/sys/dev/random/nehemiah.c#4 integrate .. //depot/projects/smpng/sys/dev/random/randomdev.c#29 integrate .. //depot/projects/smpng/sys/dev/random/randomdev.h#6 integrate .. //depot/projects/smpng/sys/dev/random/randomdev_soft.c#10 integrate .. //depot/projects/smpng/sys/dev/random/randomdev_soft.h#2 integrate .. //depot/projects/smpng/sys/dev/random/yarrow.c#13 integrate .. //depot/projects/smpng/sys/dev/re/if_re.c#35 integrate .. //depot/projects/smpng/sys/dev/smbus/smb.c#9 integrate .. //depot/projects/smpng/sys/dev/smbus/smbus.c#7 integrate .. //depot/projects/smpng/sys/dev/sound/usb/uaudio.c#10 integrate .. //depot/projects/smpng/sys/dev/ti/if_ti.c#2 integrate .. //depot/projects/smpng/sys/dev/txp/if_txp.c#32 integrate .. //depot/projects/smpng/sys/dev/usb/umass.c#50 integrate .. //depot/projects/smpng/sys/dev/usb/usb_quirks.c#15 integrate .. //depot/projects/smpng/sys/dev/usb/usbdevs#81 integrate .. //depot/projects/smpng/sys/dev/vge/if_vge.c#14 integrate .. //depot/projects/smpng/sys/geom/nop/g_nop.c#7 integrate .. //depot/projects/smpng/sys/i386/conf/NOTES#113 integrate .. //depot/projects/smpng/sys/i386/pci/pci_bus.c#28 integrate .. //depot/projects/smpng/sys/ia64/ia64/elf_machdep.c#17 integrate .. //depot/projects/smpng/sys/kern/imgact_elf.c#50 integrate .. //depot/projects/smpng/sys/kern/kern_clock.c#46 integrate .. //depot/projects/smpng/sys/kern/kern_switch.c#61 integrate .. //depot/projects/smpng/sys/kern/link_elf.c#31 integrate .. //depot/projects/smpng/sys/kern/link_elf_obj.c#7 integrate .. //depot/projects/smpng/sys/kern/sched_ule.c#63 integrate .. //depot/projects/smpng/sys/kern/vfs_mount.c#55 integrate .. //depot/projects/smpng/sys/kern/vfs_syscalls.c#94 integrate .. //depot/projects/smpng/sys/modules/i2c/controllers/Makefile#4 integrate .. //depot/projects/smpng/sys/modules/i2c/controllers/amdsmb/Makefile#1 branch .. //depot/projects/smpng/sys/modules/i2c/controllers/nfsmb/Makefile#1 branch .. //depot/projects/smpng/sys/net/bridgestp.c#6 integrate .. //depot/projects/smpng/sys/net/if_bridge.c#19 integrate .. //depot/projects/smpng/sys/net/if_bridgevar.h#6 integrate .. //depot/projects/smpng/sys/net/if_ethersubr.c#67 integrate .. //depot/projects/smpng/sys/net/if_vlan_var.h#15 integrate .. //depot/projects/smpng/sys/net80211/ieee80211_input.c#26 integrate .. //depot/projects/smpng/sys/netatm/uni/unisig_encode.c#6 integrate .. //depot/projects/smpng/sys/netinet/if_ether.c#44 integrate .. //depot/projects/smpng/sys/netinet/in.h#34 integrate .. //depot/projects/smpng/sys/pc98/cbus/sio.c#6 integrate .. //depot/projects/smpng/sys/pc98/conf/NOTES#49 integrate .. //depot/projects/smpng/sys/pci/agp.c#24 integrate .. //depot/projects/smpng/sys/pci/agp_ali.c#13 integrate .. //depot/projects/smpng/sys/pci/agp_amd.c#16 integrate .. //depot/projects/smpng/sys/pci/agp_amd64.c#8 integrate .. //depot/projects/smpng/sys/pci/agp_ati.c#2 integrate .. //depot/projects/smpng/sys/pci/agp_i810.c#20 integrate .. //depot/projects/smpng/sys/pci/agp_intel.c#21 integrate .. //depot/projects/smpng/sys/pci/agp_nvidia.c#7 integrate .. //depot/projects/smpng/sys/pci/agp_sis.c#13 integrate .. //depot/projects/smpng/sys/pci/agp_via.c#17 integrate .. //depot/projects/smpng/sys/pci/agpreg.h#15 integrate .. //depot/projects/smpng/sys/pci/agpvar.h#3 integrate .. //depot/projects/smpng/sys/pci/amdpm.c#16 integrate .. //depot/projects/smpng/sys/pci/amdsmb.c#1 branch .. //depot/projects/smpng/sys/pci/if_devar.h#14 integrate .. //depot/projects/smpng/sys/pci/nfsmb.c#1 branch .. //depot/projects/smpng/sys/powerpc/conf/Makefile#1 branch .. //depot/projects/smpng/sys/powerpc/conf/NOTES#1 branch .. //depot/projects/smpng/sys/sparc64/pci/ofw_pcibus.c#7 integrate .. //depot/projects/smpng/sys/sparc64/sparc64/elf_machdep.c#17 integrate .. //depot/projects/smpng/sys/sys/elf32.h#3 integrate .. //depot/projects/smpng/sys/sys/elf64.h#3 integrate .. //depot/projects/smpng/sys/sys/elf_common.h#6 integrate .. //depot/projects/smpng/sys/sys/elf_generic.h#4 integrate .. //depot/projects/smpng/sys/sys/imgact_elf.h#9 integrate .. //depot/projects/smpng/sys/sys/ktr.h#24 integrate .. //depot/projects/smpng/sys/sys/linker.h#15 integrate .. //depot/projects/smpng/sys/sys/mount.h#47 integrate .. //depot/projects/smpng/sys/sys/param.h#93 integrate .. //depot/projects/smpng/sys/vm/vm_fault.c#52 integrate Differences ... ==== //depot/projects/smpng/sys/alpha/alpha/elf_machdep.c#15 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/alpha/alpha/elf_machdep.c,v 1.19 2004/08/11 02:35:04 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/alpha/elf_machdep.c,v 1.20 2005/12/18 04:52:34 marcel Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -121,7 +121,7 @@ Elf_Addr *where; Elf_Addr addr; Elf_Addr addend; - Elf_Word rtype, symidx; + Elf_Size rtype, symidx; const Elf_Rel *rel; const Elf_Rela *rela; ==== //depot/projects/smpng/sys/amd64/amd64/elf_machdep.c#10 (text+ko) ==== @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/elf_machdep.c,v 1.23 2005/09/27 18:18:23 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/elf_machdep.c,v 1.24 2005/12/18 04:52:35 marcel Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -119,7 +119,7 @@ Elf32_Addr *where32, val32; Elf_Addr addr; Elf_Addr addend; - Elf_Word rtype, symidx; + Elf_Size rtype, symidx; const Elf_Rel *rel; const Elf_Rela *rela; ==== //depot/projects/smpng/sys/amd64/pci/pci_bus.c#14 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/pci/pci_bus.c,v 1.114 2005/09/18 01:42:43 imp Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/pci/pci_bus.c,v 1.115 2005/12/20 21:09:44 jhb Exp $"); #include "opt_cpu.h" @@ -336,64 +336,6 @@ /* - * Provide a device to "eat" the host->pci bridges that we dug up above - * and stop them showing up twice on the probes. This also stops them - * showing up as 'none' in pciconf -l. - */ -static int -pci_hostb_probe(device_t dev) -{ - u_int32_t id; - - id = pci_get_devid(dev); - - switch (id) { - - /* VIA VT82C596 Power Managment Function */ - case 0x30501106: - return ENXIO; - - default: - break; - } - - if (pci_get_class(dev) == PCIC_BRIDGE && - pci_get_subclass(dev) == PCIS_BRIDGE_HOST) { - device_set_desc(dev, "Host to PCI bridge"); - device_quiet(dev); - return -10000; - } - return ENXIO; -} - -static int -pci_hostb_attach(device_t dev) -{ - - return 0; -} - -static device_method_t pci_hostb_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, pci_hostb_probe), - DEVMETHOD(device_attach, pci_hostb_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - { 0, 0 } -}; -static driver_t pci_hostb_driver = { - "hostb", - pci_hostb_methods, - 1, -}; -static devclass_t pci_hostb_devclass; - -DRIVER_MODULE(hostb, pci, pci_hostb_driver, pci_hostb_devclass, 0, 0); - - -/* * Install placeholder to claim the resources owned by the * PCI bus interface. This could be used to extract the * config space registers in the extreme case where the PnP ==== //depot/projects/smpng/sys/arm/arm/elf_trampoline.c#3 (text+ko) ==== @@ -23,7 +23,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/elf_trampoline.c,v 1.3 2005/12/05 12:55:46 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/elf_trampoline.c,v 1.4 2005/12/20 01:28:17 cognet Exp $"); #include <machine/asm.h> #include <sys/types.h> #include <sys/elf32.h> @@ -47,9 +47,10 @@ { const char *s = src; char *d = dst; - + while (len) { - if (len >= 4 && !((vm_offset_t)d & 3) && !((vm_offset_t)s & 3)) { + if (0 && len >= 4 && !((vm_offset_t)d & 3) && + !((vm_offset_t)s & 3)) { *(uint32_t *)d = *(uint32_t *)s; s += 4; d += 4; @@ -83,6 +84,29 @@ void _start(void) { + int physaddr = KERNPHYSADDR; + int tmp1; + + __asm __volatile("adr %0, 2f\n" + "bic %0, %0, #0xff000000\n" + "bic sp, sp, #0xff000000\n" + "and %1, %1, #0xff000000\n" + "orr %0, %0, %1\n" + "orr sp, sp, %1\n" + "mrc p15, 0, %1, c1, c0, 0\n" + "bic %1, %1, #1\n" /* Disable MMU */ + "orr %1, %1, #(4 | 8)\n" /* Add DC enable, + WBUF enable */ + "orr %1, %1, #0x1000\n" /* Add IC enable */ + "orr %1, %1, #(0x800)\n" /* BPRD enable */ + + "mcr p15, 0, %1, c1, c0, 0\n" + "nop\n" + "nop\n" + "nop\n" + "mov pc, %0\n" + "2: nop\n" + : "=r" (tmp1), "+r" (physaddr)); __start(); } @@ -156,6 +180,7 @@ char slide[GZ_WSIZE]; orig_input = kernel; + memcnt = memtot = 0; i_input = (char *)kernel + GZ_HEAD; if (((char *)kernel)[3] & 0x18) { while (*i_input) @@ -173,7 +198,6 @@ #endif - void * load_kernel(unsigned int kstart, unsigned int curaddr,unsigned int func_end, int d) @@ -194,6 +218,7 @@ entry_point = (void*)eh->e_entry; memcpy(phdr, (void *)(kstart + eh->e_phoff ), eh->e_phnum * sizeof(phdr[0])); + /* Determine lastaddr. */ for (i = 0; i < eh->e_phnum; i++) { if (lastaddr < (phdr[i].p_vaddr - KERNVIRTADDR + curaddr @@ -204,9 +229,12 @@ /* Save the symbol tables, as there're about to be scratched. */ lastaddr = roundup(lastaddr, sizeof(long)); + shdr = (Elf_Shdr *)lastaddr; + lastaddr += sizeof(*shdr) * eh->e_shnum; + memcpy(shdr, (void *)(kstart + eh->e_shoff), + sizeof(*shdr) * eh->e_shnum); if (eh->e_shnum * eh->e_shentsize != 0 && eh->e_shoff != 0) { - shdr = (Elf_Shdr *)(kstart + eh->e_shoff); for (i = 0; i < eh->e_shnum; i++) { if (shdr[i].sh_type == SHT_SYMTAB) { for (j = 0; j < eh->e_phnum; j++) { @@ -295,6 +323,10 @@ *((Elf_Addr *)curaddr + 2) = lastaddr - curaddr + KERNVIRTADDR; } else *(Elf_Addr *)curaddr = 0; + /* Invalidate the instruction cache. */ + __asm __volatile("mcr p15, 0, %0, c7, c5, 0\n" + "mcr p15, 0, %0, c7, c10, 4\n" + : : "r" (curaddr)); /* Jump to the entry point. */ ((void(*)(void))(entry_point - KERNVIRTADDR + curaddr))(); __asm __volatile(".globl func_end\n" ==== //depot/projects/smpng/sys/arm/arm/locore.S#11 (text+ko) ==== @@ -37,7 +37,7 @@ #include <machine/asm.h> #include <machine/armreg.h> #include <machine/pte.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/locore.S,v 1.11 2005/10/03 14:10:55 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/locore.S,v 1.13 2005/12/21 15:02:31 cognet Exp $"); /* What size should this really be ? It is only used by init_arm() */ #define INIT_ARM_STACK_SIZE 2048 @@ -103,12 +103,16 @@ Lstart_off: .word start_inram-_C_LABEL(_start) start_inram: adr r7, Lunmapped - bic r7, r7, #0xff000000 - orr r7, r7, #PHYSADDR + bic r7, r7, #0xff000000 + orr r7, r7, #PHYSADDR + /* Disable MMU for a while */ mrc p15, 0, r2, c1, c0, 0 - bic r2, r2, #CPU_CONTROL_MMU_ENABLE + bic r2, r2, #(CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_DC_ENABLE |\ + CPU_CONTROL_WBUF_ENABLE) + bic r2, r2, #(CPU_CONTROL_IC_ENABLE) + bic r2, r2, #(CPU_CONTROL_BPRD_ENABLE) mcr p15, 0, r2, c1, c0, 0 nop @@ -143,43 +147,29 @@ /* Set the Domain Access register. Very important! */ mov r0, #((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT) mcr p15, 0, r0, c3, c0, 0 - /* Enable MMU */ mrc p15, 0, r0, c1, c0, 0 orr r0, r0, #CPU_CONTROL_MMU_ENABLE mcr p15, 0, r0, c1, c0, 0 + nop + nop + nop CPWAIT(r0) - bl mmu_done +#endif mmu_done: -#endif + nop adr r1, .Lstart ldmia r1, {r1, r2, sp} /* Set initial stack and */ sub r2, r2, r1 /* get zero init data */ mov r3, #0 - .L1: str r3, [r1], #0x0004 /* get zero init data */ subs r2, r2, #4 bgt .L1 + ldr pc, .Lvirt_done - ldr r4, =KERNVIRTADDR - cmp pc, r4 -#if KERNVIRTADDR > KERNPHYSADDR - bgt virt_done - ldr r4, =KERNVIRTADDR - ldr r5, =KERNPHYSADDR - sub r4, r4, r5 - add pc, pc, r4 -#else - blt virt_done - ldr r4, =KERNPHYSADDR - ldr r5, =KERNVIRTADDR - sub r4, r4, r5 - sub pc, pc, r4 -#endif virt_done: - nop mov fp, #0 /* trace back starts here */ bl _C_LABEL(initarm) /* Off we go */ @@ -217,6 +207,8 @@ .word _end .word svcstk + INIT_ARM_STACK_SIZE +.Lvirt_done: + .word virt_done .Lmainreturned: .asciz "main() returned" .align 0 ==== //depot/projects/smpng/sys/arm/xscale/i80321/iq31244_machdep.c#17 (text+ko) ==== @@ -49,7 +49,7 @@ #include "opt_ddb.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/iq31244_machdep.c,v 1.17 2005/12/09 23:54:50 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/iq31244_machdep.c,v 1.18 2005/12/21 15:01:49 cognet Exp $"); #define _ARM32_BUS_DMA_PRIVATE #include <sys/param.h> @@ -94,7 +94,6 @@ #include <machine/bus.h> #include <sys/reboot.h> -#undef DDB #include <arm/xscale/i80321/i80321reg.h> #include <arm/xscale/i80321/i80321var.h> #include <arm/xscale/i80321/iq80321reg.h> ==== //depot/projects/smpng/sys/boot/common/bootstrap.h#9 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/boot/common/bootstrap.h,v 1.41 2004/08/29 00:48:41 iedowse Exp $ + * $FreeBSD: src/sys/boot/common/bootstrap.h,v 1.42 2005/12/18 04:52:35 marcel Exp $ */ #include <sys/types.h> @@ -240,7 +240,7 @@ #define ELF_RELOC_RELA 2 struct elf_file; -typedef Elf_Addr (symaddr_fn)(struct elf_file *ef, Elf_Word symidx); +typedef Elf_Addr (symaddr_fn)(struct elf_file *ef, Elf_Size symidx); int __elfN(loadfile)(char *filename, u_int64_t dest, struct preloaded_file **result); int __elfN(obj_loadfile)(char *filename, u_int64_t dest, ==== //depot/projects/smpng/sys/boot/common/load_elf.c#13 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/common/load_elf.c,v 1.32 2004/08/28 23:03:05 iedowse Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/common/load_elf.c,v 1.33 2005/12/18 04:52:35 marcel Exp $"); #include <sys/param.h> #include <sys/exec.h> @@ -744,7 +744,7 @@ } static Elf_Addr -__elfN(symaddr)(struct elf_file *ef, Elf_Word symidx) +__elfN(symaddr)(struct elf_file *ef, Elf_Size symidx) { /* Symbol lookup by index not required here. */ ==== //depot/projects/smpng/sys/boot/common/load_elf_obj.c#2 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/common/load_elf_obj.c,v 1.1 2004/08/29 00:48:41 iedowse Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/common/load_elf_obj.c,v 1.2 2005/12/18 04:52:35 marcel Exp $"); #include <sys/param.h> #include <sys/exec.h> @@ -70,7 +70,7 @@ Elf_Addr p, void *val, size_t len); static int __elfN(obj_parse_modmetadata)(struct preloaded_file *mp, elf_file_t ef); -static Elf_Addr __elfN(obj_symaddr)(struct elf_file *ef, Elf_Word symidx); +static Elf_Addr __elfN(obj_symaddr)(struct elf_file *ef, Elf_Size symidx); const char *__elfN(obj_kerneltype) = "elf kernel"; const char *__elfN(obj_moduletype) = "elf obj module"; @@ -495,7 +495,7 @@ /* Look up the address of a specified symbol. */ static Elf_Addr -__elfN(obj_symaddr)(struct elf_file *ef, Elf_Word symidx) +__elfN(obj_symaddr)(struct elf_file *ef, Elf_Size symidx) { Elf_Sym sym; Elf_Addr base; ==== //depot/projects/smpng/sys/boot/common/reloc_elf.c#2 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/common/reloc_elf.c,v 1.1 2004/08/28 23:03:05 iedowse Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/common/reloc_elf.c,v 1.2 2005/12/18 04:52:35 marcel Exp $"); #include <sys/types.h> #include <machine/elf.h> @@ -54,7 +54,7 @@ int reltype, Elf_Addr relbase, Elf_Addr dataaddr, void *data, size_t len) { #ifdef __sparc__ - Elf_Word w; + Elf_Size w; const Elf_Rela *a; switch (reltype) { @@ -81,7 +81,7 @@ #elif defined(__i386__) && __ELF_WORD_SIZE == 64 Elf64_Addr *where, val; Elf_Addr addend, addr; - Elf_Word rtype, symidx; + Elf_Size rtype, symidx; const Elf_Rel *rel; const Elf_Rela *rela; @@ -138,7 +138,7 @@ return (0); #elif defined(__i386__) && __ELF_WORD_SIZE == 32 Elf_Addr addend, addr, *where, val; - Elf_Word rtype, symidx; + Elf_Size rtype, symidx; const Elf_Rel *rel; const Elf_Rela *rela; ==== //depot/projects/smpng/sys/boot/i386/libi386/Makefile#14 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/boot/i386/libi386/Makefile,v 1.38 2005/07/14 19:52:22 jkim Exp $ +# $FreeBSD: src/sys/boot/i386/libi386/Makefile,v 1.39 2005/12/19 09:00:11 sobomax Exp $ # LIB= i386 INTERNALLIB= @@ -24,6 +24,9 @@ # Include simple terminal emulation (cons25-compatible) CFLAGS+= -DTERM_EMU +# XXX: make alloca() useable +CFLAGS+= -Dalloca=__builtin_alloca + CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ -I${.CURDIR}/../../../contrib/dev/acpica \ -I${.CURDIR}/../../.. -I. ==== //depot/projects/smpng/sys/boot/i386/libi386/biosdisk.c#12 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/biosdisk.c,v 1.45 2004/09/21 06:46:44 wes Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/biosdisk.c,v 1.46 2005/12/19 09:00:11 sobomax Exp $"); /* * BIOS disk device handling. @@ -861,17 +861,18 @@ p = dest; /* Decide whether we have to bounce */ - if ((od->od_unit < 0x80) && - ((VTOP(dest) >> 16) != (VTOP(dest + blks * BIOSDISK_SECSIZE) >> 16))) { + if (VTOP(dest) >> 20 != 0 || ((od->od_unit < 0x80) && + ((VTOP(dest) >> 16) != (VTOP(dest + blks * BIOSDISK_SECSIZE) >> 16)))) { /* - * There is a 64k physical boundary somewhere in the destination buffer, so we have + * There is a 64k physical boundary somewhere in the destination buffer, or the + * destination buffer is above first 1MB of physical memory so we have * to arrange a suitable bounce buffer. Allocate a buffer twice as large as we * need to. Use the bottom half unless there is a break there, in which case we * use the top half. */ x = min(FLOPPY_BOUNCEBUF, (unsigned)blks); - bbuf = malloc(x * 2 * BIOSDISK_SECSIZE); + bbuf = alloca(x * 2 * BIOSDISK_SECSIZE); if (((u_int32_t)VTOP(bbuf) & 0xffff0000) == ((u_int32_t)VTOP(bbuf + x * BIOSDISK_SECSIZE) & 0xffff0000)) { breg = bbuf; } else { @@ -960,8 +961,6 @@ DEBUG("ax = 0x%04x cx = 0x%04x dx = 0x%04x status 0x%x", 0x200 | x, ((cyl & 0xff) << 8) | ((cyl & 0x300) >> 2) | sec, (hd << 8) | od->od_unit, (v86.eax >> 8) & 0xff); if (result) { - if (bbuf != NULL) - free(bbuf); return(-1); } if (bbuf != NULL) @@ -972,8 +971,6 @@ } /* hexdump(dest, (blks * BIOSDISK_SECSIZE)); */ - if (bbuf != NULL) - free(bbuf); return(0); } @@ -993,18 +990,18 @@ p = dest; /* Decide whether we have to bounce */ - if ((od->od_unit < 0x80) && - ((VTOP(dest) >> 16) != (VTOP(dest + blks * BIOSDISK_SECSIZE) >> 16))) { + if (VTOP(dest) >> 20 != 0 || ((od->od_unit < 0x80) && + ((VTOP(dest) >> 16) != (VTOP(dest + blks * BIOSDISK_SECSIZE) >> 16)))) { /* - * There is a 64k physical boundary somewhere in the destination buffer, so we have + * There is a 64k physical boundary somewhere in the destination buffer, or the + * destination buffer is above first 1MB of physical memory so we have * to arrange a suitable bounce buffer. Allocate a buffer twice as large as we * need to. Use the bottom half unless there is a break there, in which case we * use the top half. */ - x = min(FLOPPY_BOUNCEBUF, (unsigned)blks); - bbuf = malloc(x * 2 * BIOSDISK_SECSIZE); + bbuf = alloca(x * 2 * BIOSDISK_SECSIZE); if (((u_int32_t)VTOP(bbuf) & 0xffff0000) == ((u_int32_t)VTOP(bbuf + x * BIOSDISK_SECSIZE) & 0xffff0000)) { breg = bbuf; } else { @@ -1104,15 +1101,11 @@ DEBUG("ax = 0x%04x cx = 0x%04x dx = 0x%04x status 0x%x", 0x200 | x, ((cyl & 0xff) << 8) | ((cyl & 0x300) >> 2) | sec, (hd << 8) | od->od_unit, (v86.eax >> 8) & 0xff); if (result) { - if (bbuf != NULL) - free(bbuf); return(-1); } } /* hexdump(dest, (blks * BIOSDISK_SECSIZE)); */ - if (bbuf != NULL) - free(bbuf); return(0); } static int ==== //depot/projects/smpng/sys/boot/i386/libi386/biosmem.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/biosmem.c,v 1.7 2003/08/25 23:28:31 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/biosmem.c,v 1.8 2005/12/21 02:17:58 sobomax Exp $"); /* * Obtain memory configuration information from the BIOS @@ -34,7 +34,7 @@ #include "libi386.h" #include "btxv86.h" -vm_offset_t memtop; +vm_offset_t memtop, memtop_copyin; u_int32_t bios_basemem, bios_extmem; #define SMAPSIG 0x534D4150 @@ -101,7 +101,7 @@ } /* Set memtop to actual top of memory */ - memtop = 0x100000 + bios_extmem; + memtop = memtop_copyin = 0x100000 + bios_extmem; } ==== //depot/projects/smpng/sys/boot/i386/libi386/biospnp.c#6 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/biospnp.c,v 1.9 2003/08/25 23:28:31 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/biospnp.c,v 1.10 2005/12/19 09:00:11 sobomax Exp $"); /* * PnP BIOS enumerator. @@ -165,7 +165,7 @@ if (biospnp_init()) return; - devNodeBuffer = (struct pnp_devNode *)malloc(pnp_NodeSize); + devNodeBuffer = (struct pnp_devNode *)alloca(pnp_NodeSize); Node = 0; count = 1000; while((Node != 0xff) && (count-- > 0)) { ==== //depot/projects/smpng/sys/boot/i386/libi386/biossmap.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/biossmap.c,v 1.3 2004/11/08 23:59:44 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/biossmap.c,v 1.4 2005/12/19 09:00:11 sobomax Exp $"); /* * Obtain memory configuration information from the BIOS @@ -86,9 +86,10 @@ v86.eax = 0xe820; v86.ecx = sizeof(struct smap); v86.edx = SMAPSIG; - v86.es = VTOPSEG(&smapbase[smaplen]); - v86.edi = VTOPOFF(&smapbase[smaplen]); + v86.es = VTOPSEG(&smap); + v86.edi = VTOPOFF(&smap); v86int(); + bcopy(&smap, &smapbase[smaplen], sizeof(struct smap)); smaplen++; if ((v86.efl & 1) || (v86.eax != SMAPSIG)) break; ==== //depot/projects/smpng/sys/boot/i386/libi386/i386_copy.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/i386_copy.c,v 1.10 2003/08/25 23:28:31 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/i386_copy.c,v 1.12 2005/12/21 02:17:58 sobomax Exp $"); /* * MD primitives supporting placement of module data @@ -37,8 +37,6 @@ #include "libi386.h" #include "btxv86.h" -#define READIN_BUF (16 * 1024) - ssize_t i386_copyin(const void *src, vm_offset_t dest, const size_t len) { @@ -67,25 +65,11 @@ ssize_t i386_readin(const int fd, vm_offset_t dest, const size_t len) { - void *buf; - size_t resid, chunk, get; - ssize_t got; - if (dest + len >= memtop) - return(0); + if (dest + len >= memtop_copyin) { + errno = EFBIG; + return(-1); + } - chunk = min(READIN_BUF, len); - buf = malloc(chunk); - if (buf == NULL) - return(0); - - for (resid = len; resid > 0; resid -= got, dest += got) { - get = min(chunk, resid); - got = read(fd, buf, get); - if (got <= 0) - break; - bcopy(buf, PTOV(dest), (size_t)got); - } - free(buf); - return(len - resid); + return (read(fd, PTOV(dest), len)); } ==== //depot/projects/smpng/sys/boot/i386/libi386/libi386.h#10 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/boot/i386/libi386/libi386.h,v 1.22 2005/09/22 15:14:12 ru Exp $ + * $FreeBSD: src/sys/boot/i386/libi386/libi386.h,v 1.23 2005/12/21 02:17:58 sobomax Exp $ */ @@ -91,7 +91,10 @@ void bios_getmem(void); extern u_int32_t bios_basemem; /* base memory in bytes */ extern u_int32_t bios_extmem; /* extended memory in bytes */ -extern vm_offset_t memtop; +extern vm_offset_t memtop; /* last address of physical memory + 1 */ +extern vm_offset_t memtop_copyin; /* memtop less heap size for the cases */ + /* when heap is at the top of extended memory */ + /* for other cases - just the same as memtop */ int biospci_find_devclass(uint32_t class, int index); int biospci_write_config(uint32_t locator, int offset, int width, int val); ==== //depot/projects/smpng/sys/boot/i386/loader/main.c#12 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/i386/loader/main.c,v 1.33 2005/09/22 15:14:13 ru Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/loader/main.c,v 1.36 2005/12/21 02:17:58 sobomax Exp $"); /* * MD bootstrap main() and assorted miscellaneous @@ -72,6 +72,9 @@ /* XXX debugging */ extern char end[]; +static void *heap_top; +static void *heap_bottom; + int main(void) { @@ -88,7 +91,15 @@ */ bios_getmem(); - setheap((void *)end, (void *)bios_basemem); +#ifdef LOADER_BZIP2_SUPPORT + heap_top = PTOV(memtop_copyin); + memtop_copyin -= 0x300000; + heap_bottom = PTOV(memtop_copyin); +#else + heap_top = (void *)bios_basemem; + heap_bottom = (void *)end; +#endif + setheap(heap_bottom, heap_top); /* * XXX Chicken-and-egg problem; we want to have console output early, but some @@ -269,7 +280,8 @@ command_heap(int argc, char *argv[]) { mallocstats(); - printf("heap base at %p, top at %p\n", end, sbrk(0)); + printf("heap base at %p, top at %p, upper limit at %p\n", heap_bottom, + sbrk(0), heap_top); return(CMD_OK); } ==== //depot/projects/smpng/sys/boot/pc98/libpc98/Makefile#13 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/boot/pc98/libpc98/Makefile,v 1.22 2005/05/08 14:17:28 nyan Exp $ +# $FreeBSD: src/sys/boot/pc98/libpc98/Makefile,v 1.23 2005/12/20 08:54:30 sobomax Exp $ # LIB= pc98 INTERNALLIB= @@ -24,6 +24,9 @@ # Include simple terminal emulation (cons25-compatible) CFLAGS+= -DTERM_EMU +# XXX: make alloca() useable +CFLAGS+= -Dalloca=__builtin_alloca + CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \ -I${.CURDIR}/../../i386/libi386 \ -I${.CURDIR}/../../.. -I. ==== //depot/projects/smpng/sys/boot/pc98/libpc98/biosdisk.c#11 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/boot/pc98/libpc98/biosdisk.c,v 1.32 2005/05/08 14:17:28 nyan Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/pc98/libpc98/biosdisk.c,v 1.33 2005/12/21 06:09:09 nyan Exp $"); /* * BIOS disk device handling. @@ -754,16 +754,18 @@ p = dest; /* Decide whether we have to bounce */ - if (((VTOP(dest) >> 16) != (VTOP(dest + blks * BIOSDISK_SECSIZE) >> 16))) { + if (VTOP(dest) >> 20 != 0 || + ((VTOP(dest) >> 16) != (VTOP(dest + blks * BIOSDISK_SECSIZE) >> 16))) { /* - * There is a 64k physical boundary somewhere in the destination buffer, so we have + * There is a 64k physical boundary somewhere in the destination buffer, or the + * destination buffer is above first 1MB of physical memory so we have * to arrange a suitable bounce buffer. Allocate a buffer twice as large as we * need to. Use the bottom half unless there is a break there, in which case we * use the top half. */ x = min(od->od_sec, (unsigned)blks); - bbuf = malloc(x * 2 * BIOSDISK_SECSIZE); + bbuf = alloca(x * 2 * BIOSDISK_SECSIZE); if (((u_int32_t)VTOP(bbuf) & 0xffff0000) == ((u_int32_t)VTOP(bbuf + x * BIOSDISK_SECSIZE) & 0xffff0000)) { breg = bbuf; } else { @@ -837,8 +839,6 @@ od->od_flags & BD_FLOPPY ? 0x0200 | cyl : cyl, (hd << 8) | sec, (v86.eax >> 8) & 0xff); if (result) { - if (bbuf != NULL) - free(bbuf); return(-1); } if (bbuf != NULL) @@ -849,8 +849,6 @@ } /* hexdump(dest, (blks * BIOSDISK_SECSIZE)); */ - if (bbuf != NULL) - free(bbuf); return(0); } @@ -870,17 +868,18 @@ p = dest; /* Decide whether we have to bounce */ - if (((VTOP(dest) >> 16) != (VTOP(dest + blks * BIOSDISK_SECSIZE) >> 16))) { + if (VTOP(dest) >> 20 != 0 || + ((VTOP(dest) >> 16) != (VTOP(dest + blks * BIOSDISK_SECSIZE) >> 16))) { /* - * There is a 64k physical boundary somewhere in the destination buffer, so we have + * There is a 64k physical boundary somewhere in the destination buffer, or the + * destination buffer is above first 1MB of physical memory so we have * to arrange a suitable bounce buffer. Allocate a buffer twice as large as we * need to. Use the bottom half unless there is a break there, in which case we * use the top half. */ - x = min(od->od_sec, (unsigned)blks); - bbuf = malloc(x * 2 * BIOSDISK_SECSIZE); + bbuf = alloca(x * 2 * BIOSDISK_SECSIZE); if (((u_int32_t)VTOP(bbuf) & 0xffff0000) == ((u_int32_t)VTOP(bbuf + x * BIOSDISK_SECSIZE) & 0xffff0000)) { breg = bbuf; } else { @@ -959,15 +958,11 @@ (v86.eax >> 8) & 0xff); if (result) { - if (bbuf != NULL) - free(bbuf); return(-1); } >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512212046.jBLKkn9Z036887>