From owner-p4-projects@FreeBSD.ORG Sun Aug 29 23:04:14 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D1DB116A4D0; Sun, 29 Aug 2004 23:04:13 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 77ACB16A4CE for ; Sun, 29 Aug 2004 23:04:13 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5301D43D2D for ; Sun, 29 Aug 2004 23:04:13 +0000 (GMT) (envelope-from julian@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i7TN4DlR075592 for ; Sun, 29 Aug 2004 23:04:13 GMT (envelope-from julian@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i7TN4CYX075589 for perforce@freebsd.org; Sun, 29 Aug 2004 23:04:12 GMT (envelope-from julian@freebsd.org) Date: Sun, 29 Aug 2004 23:04:12 GMT Message-Id: <200408292304.i7TN4CYX075589@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to julian@freebsd.org using -f From: Julian Elischer To: Perforce Change Reviews Subject: PERFORCE change 60668 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Aug 2004 23:04:14 -0000 http://perforce.freebsd.org/chv.cgi?CH=60668 Change 60668 by julian@julian_ref on 2004/08/29 23:03:27 IFC@60665 Affected files ... .. //depot/projects/nsched/sys/alpha/conf/GENERIC#6 integrate .. //depot/projects/nsched/sys/alpha/conf/NOTES#3 integrate .. //depot/projects/nsched/sys/alpha/pci/pcibus.c#3 integrate .. //depot/projects/nsched/sys/amd64/amd64/mp_machdep.c#6 integrate .. //depot/projects/nsched/sys/amd64/amd64/pmap.c#17 integrate .. //depot/projects/nsched/sys/boot/common/Makefile.inc#2 integrate .. //depot/projects/nsched/sys/boot/common/bootstrap.h#2 integrate .. //depot/projects/nsched/sys/boot/common/load_elf.c#2 integrate .. //depot/projects/nsched/sys/boot/common/load_elf32_obj.c#1 branch .. //depot/projects/nsched/sys/boot/common/load_elf64_obj.c#1 branch .. //depot/projects/nsched/sys/boot/common/load_elf_obj.c#1 branch .. //depot/projects/nsched/sys/boot/common/misc.c#2 integrate .. //depot/projects/nsched/sys/boot/common/reloc_elf.c#1 branch .. //depot/projects/nsched/sys/boot/common/reloc_elf32.c#1 branch .. //depot/projects/nsched/sys/boot/common/reloc_elf64.c#1 branch .. //depot/projects/nsched/sys/boot/i386/boot2/boot1.S#6 integrate .. //depot/projects/nsched/sys/boot/i386/libi386/elf32_freebsd.c#2 integrate .. //depot/projects/nsched/sys/boot/i386/libi386/elf64_freebsd.c#2 integrate .. //depot/projects/nsched/sys/boot/i386/loader/conf.c#2 integrate .. //depot/projects/nsched/sys/boot/i386/mbr/Makefile#3 integrate .. //depot/projects/nsched/sys/boot/i386/mbr/mbr.s#2 integrate .. //depot/projects/nsched/sys/cam/scsi/scsi_da.c#5 integrate .. //depot/projects/nsched/sys/conf/NOTES#13 integrate .. //depot/projects/nsched/sys/conf/files#20 integrate .. //depot/projects/nsched/sys/conf/kmod.mk#9 integrate .. //depot/projects/nsched/sys/conf/options#14 integrate .. //depot/projects/nsched/sys/dev/drm/radeon_drv.c#2 integrate .. //depot/projects/nsched/sys/dev/firewire/fwcrom.c#3 integrate .. //depot/projects/nsched/sys/dev/re/if_re.c#7 integrate .. //depot/projects/nsched/sys/dev/tga/tga_pci.c#3 integrate .. //depot/projects/nsched/sys/dev/usb/usbdi.c#3 integrate .. //depot/projects/nsched/sys/geom/mirror/g_mirror.c#4 integrate .. //depot/projects/nsched/sys/geom/raid3/g_raid3.c#5 integrate .. //depot/projects/nsched/sys/geom/raid3/g_raid3_ctl.c#3 integrate .. //depot/projects/nsched/sys/i386/conf/NOTES#11 integrate .. //depot/projects/nsched/sys/i386/i386/mp_machdep.c#6 integrate .. //depot/projects/nsched/sys/i386/i386/pmap.c#15 integrate .. //depot/projects/nsched/sys/kern/kern_kse.c#25 integrate .. //depot/projects/nsched/sys/kern/kern_shutdown.c#8 integrate .. //depot/projects/nsched/sys/kern/kern_switch.c#6 integrate .. //depot/projects/nsched/sys/kern/link_elf_obj.c#7 integrate .. //depot/projects/nsched/sys/kern/sched_ule.c#20 integrate .. //depot/projects/nsched/sys/kern/subr_bus.c#8 integrate .. //depot/projects/nsched/sys/kern/subr_smp.c#5 integrate .. //depot/projects/nsched/sys/modules/Makefile#8 integrate .. //depot/projects/nsched/sys/modules/cam/Makefile#3 integrate .. //depot/projects/nsched/sys/net/netisr.c#4 integrate .. //depot/projects/nsched/sys/netgraph/ng_tty.c#6 integrate .. //depot/projects/nsched/sys/netinet6/ipsec.c#3 integrate .. //depot/projects/nsched/sys/netipx/ipx.c#2 integrate .. //depot/projects/nsched/sys/pc98/pc98/wd.c#3 integrate .. //depot/projects/nsched/sys/pci/if_pcn.c#5 integrate .. //depot/projects/nsched/sys/pci/if_rlreg.h#5 integrate .. //depot/projects/nsched/sys/pci/if_sf.c#6 integrate .. //depot/projects/nsched/sys/pci/if_ste.c#8 integrate .. //depot/projects/nsched/sys/pci/if_ti.c#5 integrate .. //depot/projects/nsched/sys/pci/if_tl.c#3 integrate .. //depot/projects/nsched/sys/pci/if_wb.c#5 integrate .. //depot/projects/nsched/sys/powerpc/powerpc/pmap.c#9 integrate .. //depot/projects/nsched/sys/sys/kernel.h#3 integrate .. //depot/projects/nsched/sys/sys/proc.h#23 integrate .. //depot/projects/nsched/sys/sys/smp.h#3 integrate .. //depot/projects/nsched/sys/sys/systm.h#8 integrate .. //depot/projects/nsched/sys/vm/vm_object.c#6 integrate .. //depot/projects/nsched/sys/vm/vm_zeroidle.c#3 integrate Differences ... ==== //depot/projects/nsched/sys/alpha/conf/GENERIC#6 (text+ko) ==== @@ -18,7 +18,7 @@ # # For hardware specific information check HARDWARE.TXT # -# $FreeBSD: src/sys/alpha/conf/GENERIC,v 1.175 2004/08/27 15:16:21 andre Exp $ +# $FreeBSD: src/sys/alpha/conf/GENERIC,v 1.176 2004/08/28 21:42:15 wilko Exp $ machine alpha cpu EV4 @@ -41,7 +41,8 @@ options DEC_ST550 # Personal Workstation 433, 500, 600 options DEC_ST6600 # XP1000, DP264, DS20, DS10, family options DEC_1000A # AlphaServer 1000, 1000A, 800 -options DEC_KN8AE # AlphaServer 8200/8400 (Turbolaser) +# TurboLaser support is broken +# options DEC_KN8AE # AlphaServer 8200/8400 (Turbolaser) options DEC_KN300 # AlphaServer 4100 (Rawhide), # AlphaServer 1200 (Tincup) ==== //depot/projects/nsched/sys/alpha/conf/NOTES#3 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/alpha/conf/NOTES,v 1.154 2004/07/10 22:29:40 marcel Exp $ +# $FreeBSD: src/sys/alpha/conf/NOTES,v 1.155 2004/08/28 21:47:24 wilko Exp $ # # This file contains machine dependent kernel configuration notes. For # machine independent notes, look in /sys/conf/NOTES. @@ -36,7 +36,8 @@ options DEC_ST550 # Personal Workstation 433, 500, 600 options DEC_ST6600 # XP1000, DP264, DS20, DS10, family options DEC_1000A # AlphaServer 1000, 1000A, 800 -options DEC_KN8AE # AlphaServer 8200/8400 (Turbolaser) +# TurboLaser support is broken +# options DEC_KN8AE # AlphaServer 8200/8400 (Turbolaser) options DEC_KN300 # AlphaServer 4100 (Rawhide), # AlphaServer 1200 (Tincup) ==== //depot/projects/nsched/sys/alpha/pci/pcibus.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/alpha/pci/pcibus.c,v 1.34 2004/07/01 15:07:27 gallatin Exp $"); +__FBSDID("$FreeBSD: src/sys/alpha/pci/pcibus.c,v 1.35 2004/08/29 19:07:14 marcel Exp $"); #include "opt_isa.h" @@ -262,7 +262,7 @@ else if (flags & PCI_RF_BWX) va = ALPHAPCI_CVT_BWX(bus, rv->r_start); else - va = (void *) rv->r_start; /* maybe NULL? */ + va = (void *)ALPHA_PHYS_TO_K0SEG(rv->r_start); rman_set_virtual(rv, va); break; ==== //depot/projects/nsched/sys/amd64/amd64/mp_machdep.c#6 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.243 2004/08/23 21:39:28 peter Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.244 2004/08/28 00:49:54 obrien Exp $"); #include "opt_cpu.h" #include "opt_kstack_pages.h" @@ -708,7 +708,7 @@ ncpu = mp_ncpus - 1; /* does not shootdown self */ if (ncpu < 1) return; /* no other cpus */ - mtx_assert(&smp_rv_mtx, MA_OWNED); + mtx_assert(&smp_ipi_mtx, MA_OWNED); smp_tlb_addr1 = addr1; smp_tlb_addr2 = addr2; atomic_store_rel_int(&smp_tlb_wait, 0); @@ -794,7 +794,7 @@ if (ncpu < 1) return; } - mtx_assert(&smp_rv_mtx, MA_OWNED); + mtx_assert(&smp_ipi_mtx, MA_OWNED); smp_tlb_addr1 = addr1; smp_tlb_addr2 = addr2; atomic_store_rel_int(&smp_tlb_wait, 0); ==== //depot/projects/nsched/sys/amd64/amd64/pmap.c#17 (text+ko) ==== @@ -75,7 +75,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.494 2004/08/27 19:06:16 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.495 2004/08/28 00:49:54 obrien Exp $"); /* * Manages physical address maps. @@ -631,7 +631,7 @@ if (smp_started) { if (!(read_rflags() & PSL_I)) panic("%s: interrupts disabled", __func__); - mtx_lock_spin(&smp_rv_mtx); + mtx_lock_spin(&smp_ipi_mtx); } else critical_enter(); /* @@ -652,7 +652,7 @@ smp_masked_invlpg(pmap->pm_active & other_cpus, va); } if (smp_started) - mtx_unlock_spin(&smp_rv_mtx); + mtx_unlock_spin(&smp_ipi_mtx); else critical_exit(); } @@ -667,7 +667,7 @@ if (smp_started) { if (!(read_rflags() & PSL_I)) panic("%s: interrupts disabled", __func__); - mtx_lock_spin(&smp_rv_mtx); + mtx_lock_spin(&smp_ipi_mtx); } else critical_enter(); /* @@ -691,7 +691,7 @@ sva, eva); } if (smp_started) - mtx_unlock_spin(&smp_rv_mtx); + mtx_unlock_spin(&smp_ipi_mtx); else critical_exit(); } @@ -705,7 +705,7 @@ if (smp_started) { if (!(read_rflags() & PSL_I)) panic("%s: interrupts disabled", __func__); - mtx_lock_spin(&smp_rv_mtx); + mtx_lock_spin(&smp_ipi_mtx); } else critical_enter(); /* @@ -726,7 +726,7 @@ smp_masked_invltlb(pmap->pm_active & other_cpus); } if (smp_started) - mtx_unlock_spin(&smp_rv_mtx); + mtx_unlock_spin(&smp_ipi_mtx); else critical_exit(); } ==== //depot/projects/nsched/sys/boot/common/Makefile.inc#2 (text+ko) ==== @@ -1,17 +1,18 @@ -# $FreeBSD: src/sys/boot/common/Makefile.inc,v 1.17 2004/02/07 11:05:10 ru Exp $ +# $FreeBSD: src/sys/boot/common/Makefile.inc,v 1.19 2004/08/29 00:48:41 iedowse Exp $ SRCS+= bcache.c boot.c commands.c console.c devopen.c interp.c SRCS+= interp_backslash.c interp_parse.c ls.c misc.c SRCS+= module.c panic.c .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" -SRCS+= load_elf32.c load_elf64.c +SRCS+= load_elf32.c load_elf32_obj.c load_elf64.c load_elf64_obj.c +SRCS+= reloc_elf32.c reloc_elf64.c .endif .if ${MACHINE_ARCH} == "powerpc" -SRCS+= load_elf32.c +SRCS+= load_elf32.c reloc_elf32.c .endif .if ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "ia64" || ${MACHINE_ARCH} == "alpha" -SRCS+= load_elf64.c +SRCS+= load_elf64.c reloc_elf64.c .endif .if defined(LOADER_NET_SUPPORT) ==== //depot/projects/nsched/sys/boot/common/bootstrap.h#2 (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.38 2003/05/01 03:56:29 peter Exp $ + * $FreeBSD: src/sys/boot/common/bootstrap.h,v 1.41 2004/08/29 00:48:41 iedowse Exp $ */ #include @@ -76,6 +76,9 @@ void hexdump(caddr_t region, size_t len); size_t strlenout(vm_offset_t str); char *strdupout(vm_offset_t str); +void kern_bzero(vm_offset_t dest, size_t len); +int kern_pread(int fd, vm_offset_t dest, size_t len, off_t off); +void *alloc_pread(int fd, off_t off, size_t len); /* bcache.c */ int bcache_init(u_int nblks, size_t bsize); @@ -232,7 +235,19 @@ /* MI module loaders */ #ifdef __elfN +/* Relocation types. */ +#define ELF_RELOC_REL 1 +#define ELF_RELOC_RELA 2 + +struct elf_file; +typedef Elf_Addr (symaddr_fn)(struct elf_file *ef, Elf_Word symidx); + int __elfN(loadfile)(char *filename, u_int64_t dest, struct preloaded_file **result); +int __elfN(obj_loadfile)(char *filename, u_int64_t dest, + struct preloaded_file **result); +int __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, + const void *reldata, int reltype, Elf_Addr relbase, + Elf_Addr dataaddr, void *data, size_t len); #endif /* ==== //depot/projects/nsched/sys/boot/common/load_elf.c#2 (text+ko) ==== @@ -26,7 +26,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/boot/common/load_elf.c,v 1.30 2004/03/11 10:07:24 bde Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/common/load_elf.c,v 1.32 2004/08/28 23:03:05 iedowse Exp $"); #include #include @@ -58,6 +58,8 @@ Elf_Hashelt nchains; Elf_Hashelt *buckets; Elf_Hashelt *chains; + Elf_Rel *rel; + size_t relsz; Elf_Rela *rela; size_t relasz; char *strtab; @@ -71,11 +73,10 @@ static int __elfN(loadimage)(struct preloaded_file *mp, elf_file_t ef, u_int64_t loadaddr); static int __elfN(lookup_symbol)(struct preloaded_file *mp, elf_file_t ef, const char* name, Elf_Sym* sym); -#ifdef __sparc__ -static void __elfN(reloc_ptr)(struct preloaded_file *mp, elf_file_t ef, - void *p, void *val, size_t len); -#endif +static int __elfN(reloc_ptr)(struct preloaded_file *mp, elf_file_t ef, + Elf_Addr p, void *val, size_t len); static int __elfN(parse_modmetadata)(struct preloaded_file *mp, elf_file_t ef); +static symaddr_fn __elfN(symaddr); static char *fake_modname(const char *name); const char *__elfN(kerneltype) = "elf kernel"; @@ -241,10 +242,8 @@ int ret; vm_offset_t firstaddr; vm_offset_t lastaddr; - void *buf; - size_t resid, chunk; + size_t chunk; ssize_t result; - vm_offset_t dest; Elf_Addr ssym, esym; Elf_Dyn *dp; Elf_Addr adp; @@ -305,14 +304,10 @@ phdr[i].p_vaddr + off, fpcopy); } if (phdr[i].p_filesz > fpcopy) { - if (lseek(ef->fd, (off_t)(phdr[i].p_offset + fpcopy), - SEEK_SET) == -1) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadexec: cannot seek\n"); - goto out; - } - if (archsw.arch_readin(ef->fd, phdr[i].p_vaddr + off + fpcopy, - phdr[i].p_filesz - fpcopy) != (ssize_t)(phdr[i].p_filesz - fpcopy)) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadexec: archsw.readin failed\n"); + if (kern_pread(ef->fd, phdr[i].p_vaddr + off + fpcopy, + phdr[i].p_filesz - fpcopy, phdr[i].p_offset + fpcopy) != 0) { + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: read failed\n"); goto out; } } @@ -324,22 +319,8 @@ (long)(phdr[i].p_vaddr + off + phdr[i].p_memsz - 1)); #endif - /* no archsw.arch_bzero */ - buf = malloc(PAGE_SIZE); - if (buf == NULL) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: malloc() failed\n"); - goto out; - } - bzero(buf, PAGE_SIZE); - resid = phdr[i].p_memsz - phdr[i].p_filesz; - dest = phdr[i].p_vaddr + off + phdr[i].p_filesz; - while (resid > 0) { - chunk = min(PAGE_SIZE, resid); - archsw.arch_copyin(buf, dest, chunk); - resid -= chunk; - dest += chunk; - } - free(buf); + kern_bzero(phdr[i].p_vaddr + off + phdr[i].p_filesz, + phdr[i].p_memsz - phdr[i].p_filesz); } #ifdef ELF_VERBOSE printf("\n"); @@ -361,16 +342,10 @@ chunk = ehdr->e_shnum * ehdr->e_shentsize; if (chunk == 0 || ehdr->e_shoff == 0) goto nosyms; - shdr = malloc(chunk); - if (shdr == NULL) - goto nosyms; - if (lseek(ef->fd, (off_t)ehdr->e_shoff, SEEK_SET) == -1) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: cannot lseek() to section headers"); - goto nosyms; - } - result = read(ef->fd, shdr, chunk); - if (result < 0 || (size_t)result != chunk) { - printf("\nelf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: read section headers failed"); + shdr = alloc_pread(ef->fd, ehdr->e_shoff, chunk); + if (shdr == NULL) { + printf("\nelf" __XSTRING(__ELF_WORD_SIZE) + "_loadimage: failed to read section headers"); goto nosyms; } symtabindex = -1; @@ -507,6 +482,12 @@ case DT_SYMTAB: ef->symtab = (Elf_Sym*)(uintptr_t)(dp[i].d_un.d_ptr + off); break; + case DT_REL: + ef->rel = (Elf_Rel *)(uintptr_t)(dp[i].d_un.d_ptr + off); + break; + case DT_RELSZ: + ef->relsz = dp[i].d_un.d_val; + break; case DT_RELA: ef->rela = (Elf_Rela *)(uintptr_t)(dp[i].d_un.d_ptr + off); break; @@ -589,7 +570,7 @@ struct mod_version mver; Elf_Sym sym; char *s; - int modcnt, minfolen; + int error, modcnt, minfolen; Elf_Addr v, p, p_stop; if (__elfN(lookup_symbol)(fp, ef, "__start_set_modmetadata_set", &sym) != 0) @@ -602,25 +583,31 @@ modcnt = 0; while (p < p_stop) { COPYOUT(p, &v, sizeof(v)); -#ifdef __sparc64__ - __elfN(reloc_ptr)(fp, ef, p, &v, sizeof(v)); -#else - v += ef->off; -#endif + error = __elfN(reloc_ptr)(fp, ef, p, &v, sizeof(v)); + if (error == EOPNOTSUPP) + v += ef->off; + else if (error != 0) + return (error); #if defined(__i386__) && __ELF_WORD_SIZE == 64 COPYOUT(v, &md64, sizeof(md64)); + error = __elfN(reloc_ptr)(fp, ef, v, &md64, sizeof(md64)); + if (error == EOPNOTSUPP) { + md64.md_cval += ef->off; + md64.md_data += ef->off; + } else if (error != 0) + return (error); md.md_version = md64.md_version; md.md_type = md64.md_type; - md.md_cval = (const char *)(uintptr_t)(md64.md_cval + ef->off); - md.md_data = (void *)(uintptr_t)(md64.md_data + ef->off); + md.md_cval = (const char *)(uintptr_t)md64.md_cval; + md.md_data = (void *)(uintptr_t)md64.md_data; #else COPYOUT(v, &md, sizeof(md)); -#ifdef __sparc64__ - __elfN(reloc_ptr)(fp, ef, v, &md, sizeof(md)); -#else - md.md_cval += ef->off; - md.md_data += ef->off; -#endif + error = __elfN(reloc_ptr)(fp, ef, v, &md, sizeof(md)); + if (error == EOPNOTSUPP) { + md.md_cval += ef->off; + md.md_data += ef->off; + } else if (error != 0) + return (error); #endif p += sizeof(Elf_Addr); switch(md.md_type) { @@ -713,29 +700,53 @@ return ENOENT; } -#ifdef __sparc__ /* - * Apply any intra-module relocations to the value. *p is the load address + * Apply any intra-module relocations to the value. p is the load address * of the value and val/len is the value to be modified. This does NOT modify * the image in-place, because this is done by kern_linker later on. + * + * Returns EOPNOTSUPP if no relocation method is supplied. */ -static void +static int __elfN(reloc_ptr)(struct preloaded_file *mp, elf_file_t ef, - void *p, void *val, size_t len) + Elf_Addr p, void *val, size_t len) { - Elf_Addr off = (Elf_Addr)p - ef->off, word; size_t n; - Elf_Rela r; + Elf_Rela a; + Elf_Rel r; + int error; + + /* + * The kernel is already relocated, but we still want to apply + * offset adjustments. + */ + if (ef->kernel) + return (EOPNOTSUPP); + + for (n = 0; n < ef->relsz / sizeof(r); n++) { + COPYOUT(ef->rel + n, &r, sizeof(r)); - for (n = 0; n < ef->relasz / sizeof(r); n++) { - COPYOUT(ef->rela + n, &r, sizeof(r)); + error = __elfN(reloc)(ef, __elfN(symaddr), &r, ELF_RELOC_REL, + ef->off, p, val, len); + if (error != 0) + return (error); + } + for (n = 0; n < ef->relasz / sizeof(a); n++) { + COPYOUT(ef->rela + n, &a, sizeof(a)); - if (r.r_offset >= off && r.r_offset < off + len && - ELF_R_TYPE(r.r_info) == R_SPARC_RELATIVE) { - word = ef->off + r.r_addend; - bcopy(&word, (char *)val + (r.r_offset - off), - sizeof(word)); - } + error = __elfN(reloc)(ef, __elfN(symaddr), &a, ELF_RELOC_RELA, + ef->off, p, val, len); + if (error != 0) + return (error); } + + return (0); } -#endif + +static Elf_Addr +__elfN(symaddr)(struct elf_file *ef, Elf_Word symidx) +{ + + /* Symbol lookup by index not required here. */ + return (0); +} ==== //depot/projects/nsched/sys/boot/common/misc.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/boot/common/misc.c,v 1.8 2003/08/25 23:30:41 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/common/misc.c,v 1.9 2004/08/28 14:57:34 iedowse Exp $"); #include #include @@ -93,6 +93,74 @@ return(result); } +/* Zero a region in kernel space. */ +void +kern_bzero(vm_offset_t dest, size_t len) +{ + char buf[256]; + size_t chunk, resid; + + bzero(buf, sizeof(buf)); + resid = len; + while (resid > 0) { + chunk = min(sizeof(buf), resid); + archsw.arch_copyin(buf, dest, chunk); + resid -= chunk; + dest += chunk; + } +} + +/* + * Read the specified part of a file to kernel space. Unlike regular + * pread, the file pointer is advanced to the end of the read data, + * and it just returns 0 if successful. + */ +int +kern_pread(int fd, vm_offset_t dest, size_t len, off_t off) +{ + ssize_t nread; + + if (lseek(fd, off, SEEK_SET) == -1) { + printf("\nlseek failed\n"); + return (-1); + } + nread = archsw.arch_readin(fd, dest, len); + if (nread != len) { + printf("\nreadin failed\n"); + return (-1); + } + return (0); +} + +/* + * Read the specified part of a file to a malloced buffer. The file + * pointer is advanced to the end of the read data. + */ +void * +alloc_pread(int fd, off_t off, size_t len) +{ + void *buf; + ssize_t nread; + + buf = malloc(len); + if (buf == NULL) { + printf("\nmalloc(%d) failed\n", (int)len); + return (NULL); + } + if (lseek(fd, off, SEEK_SET) == -1) { + printf("\nlseek failed\n"); + free(buf); + return (NULL); + } + nread = read(fd, buf, len); + if (nread != len) { + printf("\nread failed\n"); + free(buf); + return (NULL); + } + return (buf); +} + /* * Display a region in traditional hexdump format. */ ==== //depot/projects/nsched/sys/boot/i386/boot2/boot1.S#6 (text+ko) ==== @@ -12,7 +12,7 @@ * warranties of merchantability and fitness for a particular * purpose. * - * $FreeBSD: src/sys/boot/i386/boot2/boot1.S,v 1.29 2004/08/05 06:00:05 kan Exp $ + * $FreeBSD: src/sys/boot/i386/boot2/boot1.S,v 1.30 2004/08/28 08:32:23 yar Exp $ */ /* Memory Locations */ @@ -269,7 +269,25 @@ * %dl - byte - drive number * stack - 10 bytes - EDD Packet */ -read: push %dx # Save +read: testb $FL_PACKET,%cs:MEM_REL+flags-start # LBA support enabled? + jz read.1 # No, use CHS + cmpb $0x80,%dl # Hard drive? + jb read.1 # No, use CHS + mov $0x55aa,%bx # Magic + push %dx # Save + movb $0x41,%ah # BIOS: Check + int $0x13 # extensions present + pop %dx # Restore + jc read.1 # If error, use CHS + cmp $0xaa55,%bx # Magic? + jne read.1 # No, so use CHS + testb $0x1,%cl # Packet interface? + jz read.1 # No, so use CHS + mov %bp,%si # Disk packet + movb $0x42,%ah # BIOS: Extended + int $0x13 # read + retw # To caller +read.1: push %dx # Save movb $0x8,%ah # BIOS: Get drive int $0x13 # parameters movb %dh,%ch # Max head number @@ -292,7 +310,7 @@ pop %dx # Restore cmpl $0x3ff,%eax # Cylinder number supportable? sti # Enable interrupts - ja read.7 # No, try EDD + ja ereturn # No, return an error xchgb %al,%ah # Set up cylinder rorb $0x2,%al # number orb %ch,%al # Merge @@ -328,24 +346,8 @@ read.5: shlb %bl # buffer add %bl,0x5(%bp) # pointer, sub %al,0x2(%bp) # block count - ja read # If not done + ja read.1 # If not done read.6: retw # To caller -read.7: testb $FL_PACKET,%cs:MEM_REL+flags-start # LBA support enabled? - jz ereturn # No, so return an error - mov $0x55aa,%bx # Magic - push %dx # Save - movb $0x41,%ah # BIOS: Check - int $0x13 # extensions present - pop %dx # Restore - jc return # If error, return an error - cmp $0xaa55,%bx # Magic? - jne ereturn # No, so return an error - testb $0x1,%cl # Packet interface? - jz ereturn # No, so return an error - mov %bp,%si # Disk packet - movb $0x42,%ah # BIOS: Extended - int $0x13 # read - retw # To caller /* Messages */ ==== //depot/projects/nsched/sys/boot/i386/libi386/elf32_freebsd.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/elf32_freebsd.c,v 1.13 2003/08/25 23:28:31 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/elf32_freebsd.c,v 1.14 2004/08/29 00:48:41 iedowse Exp $"); #include #include @@ -40,8 +40,10 @@ #include "btxv86.h" static int elf32_exec(struct preloaded_file *amp); +static int elf32_obj_exec(struct preloaded_file *amp); struct file_format i386_elf = { elf32_loadfile, elf32_exec }; +struct file_format i386_elf_obj = { elf32_obj_loadfile, elf32_obj_exec }; /* * There is an a.out kernel and one or more a.out modules loaded. @@ -74,3 +76,9 @@ panic("exec returned"); } + +static int +elf32_obj_exec(struct preloaded_file *fp) +{ + return (EFTYPE); +} ==== //depot/projects/nsched/sys/boot/i386/libi386/elf64_freebsd.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/elf64_freebsd.c,v 1.14 2003/08/25 23:28:31 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/elf64_freebsd.c,v 1.15 2004/08/29 00:48:41 iedowse Exp $"); #define __ELF_WORD_SIZE 64 #include @@ -41,8 +41,10 @@ #include "btxv86.h" static int elf64_exec(struct preloaded_file *amp); +static int elf64_obj_exec(struct preloaded_file *amp); struct file_format amd64_elf = { elf64_loadfile, elf64_exec }; +struct file_format amd64_elf_obj = { elf64_obj_loadfile, elf64_obj_exec }; #define PG_V 0x001 #define PG_RW 0x002 @@ -116,3 +118,9 @@ panic("exec returned"); } + +static int +elf64_obj_exec(struct preloaded_file *fp) +{ + return (EFTYPE); +} ==== //depot/projects/nsched/sys/boot/i386/loader/conf.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/boot/i386/loader/conf.c,v 1.24 2003/08/25 23:28:32 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/boot/i386/loader/conf.c,v 1.25 2004/08/29 00:48:42 iedowse Exp $"); #include #include @@ -83,11 +83,15 @@ * rather than reading the file go first. */ extern struct file_format i386_elf; +extern struct file_format i386_elf_obj; extern struct file_format amd64_elf; +extern struct file_format amd64_elf_obj; struct file_format *file_formats[] = { &i386_elf, + &i386_elf_obj, &amd64_elf, + &amd64_elf_obj, NULL }; ==== //depot/projects/nsched/sys/boot/i386/mbr/Makefile#3 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/boot/i386/mbr/Makefile,v 1.13 2004/04/28 21:31:21 ru Exp $ +# $FreeBSD: src/sys/boot/i386/mbr/Makefile,v 1.14 2004/08/28 08:39:35 yar Exp $ PROG= mbr STRIP= @@ -6,8 +6,12 @@ NOMAN= SRCS= ${PROG}.s +# MBR flags: 0x80 -- try packet interface (also known as EDD or LBA) +BOOT_MBR_FLAGS?= 0x80 + ORG= 0x600 +AFLAGS+=--defsym FLAGS=${BOOT_MBR_FLAGS} LDFLAGS=-N -e start -Ttext ${ORG} -Wl,-S,--oformat,binary .include ==== //depot/projects/nsched/sys/boot/i386/mbr/mbr.s#2 (text+ko) ==== @@ -13,7 +13,7 @@ # purpose. # -# $FreeBSD: src/sys/boot/i386/mbr/mbr.s,v 1.6 2000/06/27 20:04:10 jhb Exp $ +# $FreeBSD: src/sys/boot/i386/mbr/mbr.s,v 1.7 2004/08/28 08:39:35 yar Exp $ # A 512 byte MBR boot manager that simply boots the active partition. @@ -21,6 +21,7 @@ .set EXEC,0x600 # Execution address .set PT_OFF,0x1be # Partition table .set MAGIC,0xaa55 # Magic: bootable + .set FL_PACKET,0x80 # Flag: try EDD .set NHRDRV,0x475 # Number of hard drives @@ -88,10 +89,8 @@ movb 0x1(%si),%dh # Load head movw 0x2(%si),%cx # Load cylinder:sector movw $LOAD,%bx # Transfer buffer - cmpb $0xff,%dh # Might we need to use LBA? - jnz main.7 # No. - cmpw $0xffff,%cx # Do we need to use LBA? - jnz main.7 # No. + testb $FL_PACKET,flags # Try EDD? + jz main.7 # No. pushw %cx # Save %cx pushw %bx # Save %bx movw $0x55aa,%bx # Magic @@ -151,7 +150,8 @@ msg_rd: .asciz "Error loading operating system" msg_os: .asciz "Missing operating system" - .org PT_OFF + .org PT_OFF-1,0x90 +flags: .byte FLAGS # Flags partbl: .fill 0x10,0x4,0x0 # Partition table .word MAGIC # Magic number ==== //depot/projects/nsched/sys/cam/scsi/scsi_da.c#5 (text+ko) ==== @@ -27,11 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.171 2004/08/12 23:17:09 sanpei Exp $"); - -#ifdef _KERNEL -#include "opt_hw_wdog.h" -#endif /* _KERNEL */ +__FBSDID("$FreeBSD: src/sys/cam/scsi/scsi_da.c,v 1.172 2004/08/29 11:10:09 des Exp $"); #include ==== //depot/projects/nsched/sys/conf/NOTES#13 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/NOTES,v 1.1265 2004/08/27 15:46:16 andre Exp $ +# $FreeBSD: src/sys/conf/NOTES,v 1.1269 2004/08/29 15:03:06 ru Exp $ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # @@ -2177,12 +2177,6 @@ options BOOTP_WIRED_TO=fxp0 # Use interface fxp0 for BOOTP # -# Add tie-ins for a hardware watchdog. This only enables the hooks; -# the user must still supply the actual driver. -# -options HW_WDOG - -# # Add software watchdog routines. # options SW_WATCHDOG ==== //depot/projects/nsched/sys/conf/files#20 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/files,v 1.945 2004/08/27 15:16:21 andre Exp $ +# $FreeBSD: src/sys/conf/files,v 1.947 2004/08/29 11:26:36 des Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and ==== //depot/projects/nsched/sys/conf/kmod.mk#9 (text+ko) ==== @@ -1,5 +1,5 @@ # From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 -# $FreeBSD: src/sys/conf/kmod.mk,v 1.166 2004/08/14 23:53:04 marius Exp $ +# $FreeBSD: src/sys/conf/kmod.mk,v 1.167 2004/08/29 02:00:50 iedowse Exp $ # # The include file handles installing Kernel Loadable Device # drivers (KLD's). @@ -126,6 +126,9 @@ LDFLAGS+= -d -warn-common CFLAGS+= ${DEBUG_FLAGS} +.if ${MACHINE_ARCH} == amd64 +CFLAGS+= -fno-omit-frame-pointer +.endif OBJS+= ${SRCS:N*.h:R:S/$/.o/g} ==== //depot/projects/nsched/sys/conf/options#14 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/options,v 1.477 2004/08/27 15:16:21 andre Exp $ +# $FreeBSD: src/sys/conf/options,v 1.479 2004/08/29 11:10:09 des Exp $ # # On the handling of kernel options # @@ -85,7 +85,6 @@ GEOM_SUNLABEL opt_geom.h GEOM_UZIP opt_geom.h GEOM_VOL opt_geom.h -HW_WDOG KSTACK_MAX_PAGES KSTACK_PAGES KTRACE @@ -361,6 +360,7 @@ MBUF_STRESS_TEST opt_mbuf_stress_test.h NCP NETATALK opt_atalk.h +NET_WITH_GIANT opt_net.h PPP_BSDCOMP opt_ppp.h PPP_DEFLATE opt_ppp.h PPP_FILTER opt_ppp.h ==== //depot/projects/nsched/sys/dev/drm/radeon_drv.c#2 (text+ko) ==== @@ -26,7 +26,7 @@ * Authors: * Gareth Hughes * - * $FreeBSD: src/sys/dev/drm/radeon_drv.c,v 1.9 2003/10/24 01:48:17 anholt Exp $ + * $FreeBSD: src/sys/dev/drm/radeon_drv.c,v 1.10 2004/08/29 07:49:53 ru Exp $ */ #include "dev/drm/radeon.h" @@ -58,7 +58,7 @@ #endif #ifdef __FreeBSD__ -DRIVER_MODULE(DRIVER_NAME, pci, DRM(driver), DRM(devclass), 0, 0); +DRIVER_MODULE(radeon, pci, DRM(driver), DRM(devclass), 0, 0); #elif defined(__NetBSD__) CFDRIVER_DECL(radeon, DV_TTY, NULL); #endif /* __FreeBSD__ */ ==== //depot/projects/nsched/sys/dev/firewire/fwcrom.c#3 (text+ko) ==== @@ -34,7 +34,7 @@ #ifdef __FreeBSD__ #include -__FBSDID("$FreeBSD: src/sys/dev/firewire/fwcrom.c,v 1.11 2004/05/22 16:14:17 dfr Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/firewire/fwcrom.c,v 1.12 2004/08/29 13:45:55 simokawa Exp $"); #endif #include @@ -294,7 +294,7 @@ { struct csrreg *reg; struct csrdirectory *dir; - char *desc, st; + char *desc; uint16_t crc; >>> TRUNCATED FOR MAIL (1000 lines) <<<