From owner-p4-projects@FreeBSD.ORG Fri May 16 12:14:29 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 89B0E106568C; Fri, 16 May 2008 12:14:29 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4B1741065681 for ; Fri, 16 May 2008 12:14:29 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 3959C8FC24 for ; Fri, 16 May 2008 12:14:29 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m4GCETj3093136 for ; Fri, 16 May 2008 12:14:29 GMT (envelope-from julian@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m4GCESui093134 for perforce@freebsd.org; Fri, 16 May 2008 12:14:28 GMT (envelope-from julian@freebsd.org) Date: Fri, 16 May 2008 12:14:28 GMT Message-Id: <200805161214.m4GCESui093134@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 Cc: Subject: PERFORCE change 141715 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 May 2008 12:14:30 -0000 http://perforce.freebsd.org/chv.cgi?CH=141715 Change 141715 by julian@julian_trafmon1 on 2008/05/16 12:13:50 IFC@141713 Affected files ... .. //depot/projects/vimage/src/sys/amd64/amd64/pmap.c#14 integrate .. //depot/projects/vimage/src/sys/amd64/linux32/linux32_dummy.c#6 integrate .. //depot/projects/vimage/src/sys/amd64/linux32/linux32_proto.h#7 integrate .. //depot/projects/vimage/src/sys/amd64/linux32/linux32_syscall.h#7 integrate .. //depot/projects/vimage/src/sys/amd64/linux32/linux32_sysent.c#7 integrate .. //depot/projects/vimage/src/sys/amd64/linux32/syscalls.master#7 integrate .. //depot/projects/vimage/src/sys/cddl/compat/opensolaris/sys/lock.h#2 integrate .. //depot/projects/vimage/src/sys/compat/linux/linux_emul.c#6 integrate .. //depot/projects/vimage/src/sys/compat/linux/linux_emul.h#5 integrate .. //depot/projects/vimage/src/sys/compat/linux/linux_futex.c#5 integrate .. //depot/projects/vimage/src/sys/compat/linux/linux_futex.h#4 integrate .. //depot/projects/vimage/src/sys/compat/linux/linux_misc.c#15 integrate .. //depot/projects/vimage/src/sys/compat/ndis/subr_ndis.c#7 integrate .. //depot/projects/vimage/src/sys/conf/NOTES#22 integrate .. //depot/projects/vimage/src/sys/conf/options#24 integrate .. //depot/projects/vimage/src/sys/dev/ath/if_ath.c#16 integrate .. //depot/projects/vimage/src/sys/dev/bge/if_bge.c#13 integrate .. //depot/projects/vimage/src/sys/dev/bge/if_bgereg.h#11 integrate .. //depot/projects/vimage/src/sys/dev/ciss/ciss.c#10 integrate .. //depot/projects/vimage/src/sys/dev/coretemp/coretemp.c#4 integrate .. //depot/projects/vimage/src/sys/dev/if_ndis/if_ndis.c#11 integrate .. //depot/projects/vimage/src/sys/dev/ipw/if_ipw.c#10 integrate .. //depot/projects/vimage/src/sys/dev/iwi/if_iwi.c#11 integrate .. //depot/projects/vimage/src/sys/dev/iwn/if_iwn.c#2 integrate .. //depot/projects/vimage/src/sys/dev/k8temp/k8temp.c#2 integrate .. //depot/projects/vimage/src/sys/dev/malo/if_malo.c#2 integrate .. //depot/projects/vimage/src/sys/dev/mfi/mfi.c#11 integrate .. //depot/projects/vimage/src/sys/dev/mfi/mfi_ioctl.h#4 integrate .. //depot/projects/vimage/src/sys/dev/ral/rt2560.c#14 integrate .. //depot/projects/vimage/src/sys/dev/ral/rt2661.c#12 integrate .. //depot/projects/vimage/src/sys/dev/speaker/spkr.c#4 integrate .. //depot/projects/vimage/src/sys/dev/sym/sym_defs.h#2 integrate .. //depot/projects/vimage/src/sys/dev/sym/sym_fw.h#2 integrate .. //depot/projects/vimage/src/sys/dev/sym/sym_fw1.h#2 integrate .. //depot/projects/vimage/src/sys/dev/sym/sym_fw2.h#2 integrate .. //depot/projects/vimage/src/sys/dev/sym/sym_hipd.c#9 integrate .. //depot/projects/vimage/src/sys/dev/usb/ehci.c#7 integrate .. //depot/projects/vimage/src/sys/dev/usb/if_axe.c#11 integrate .. //depot/projects/vimage/src/sys/dev/usb/if_rum.c#9 integrate .. //depot/projects/vimage/src/sys/dev/usb/if_ural.c#13 integrate .. //depot/projects/vimage/src/sys/dev/usb/if_zyd.c#8 integrate .. //depot/projects/vimage/src/sys/dev/usb/ohci.c#5 integrate .. //depot/projects/vimage/src/sys/dev/usb/usbdevs#19 integrate .. //depot/projects/vimage/src/sys/dev/wi/if_wi.c#12 integrate .. //depot/projects/vimage/src/sys/dev/wpi/if_wpi.c#4 integrate .. //depot/projects/vimage/src/sys/dev/wpi/if_wpivar.h#3 integrate .. //depot/projects/vimage/src/sys/fs/ntfs/ntfs_subr.c#3 integrate .. //depot/projects/vimage/src/sys/i386/i386/pmap.c#14 integrate .. //depot/projects/vimage/src/sys/i386/linux/linux_dummy.c#5 integrate .. //depot/projects/vimage/src/sys/i386/linux/linux_proto.h#8 integrate .. //depot/projects/vimage/src/sys/i386/linux/linux_syscall.h#8 integrate .. //depot/projects/vimage/src/sys/i386/linux/linux_sysent.c#8 integrate .. //depot/projects/vimage/src/sys/i386/linux/syscalls.master#8 integrate .. //depot/projects/vimage/src/sys/kern/imgact_elf.c#8 integrate .. //depot/projects/vimage/src/sys/kern/kern_conf.c#9 integrate .. //depot/projects/vimage/src/sys/kern/kern_switch.c#13 integrate .. //depot/projects/vimage/src/sys/kern/kern_sx.c#12 integrate .. //depot/projects/vimage/src/sys/kern/subr_lock.c#11 integrate .. //depot/projects/vimage/src/sys/kern/subr_witness.c#10 integrate .. //depot/projects/vimage/src/sys/kern/uipc_sockbuf.c#9 integrate .. //depot/projects/vimage/src/sys/net/ethernet.h#7 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211.c#13 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211.h#7 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211_ddb.c#3 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211_freebsd.c#9 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211_ht.c#7 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211_ht.h#6 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211_ioctl.c#8 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211_phy.c#2 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211_phy.h#2 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211_proto.h#9 integrate .. //depot/projects/vimage/src/sys/net80211/ieee80211_var.h#11 integrate .. //depot/projects/vimage/src/sys/netinet/ip_icmp.c#12 integrate .. //depot/projects/vimage/src/sys/nfsclient/bootp_subr.c#6 integrate .. //depot/projects/vimage/src/sys/pci/intpm.c#7 integrate .. //depot/projects/vimage/src/sys/sys/_lock.h#3 integrate .. //depot/projects/vimage/src/sys/sys/_lockmgr.h#2 integrate .. //depot/projects/vimage/src/sys/sys/_mutex.h#3 integrate .. //depot/projects/vimage/src/sys/sys/_rwlock.h#4 integrate .. //depot/projects/vimage/src/sys/sys/_sx.h#2 integrate .. //depot/projects/vimage/src/sys/sys/lock.h#7 integrate .. //depot/projects/vimage/src/sys/sys/lockmgr.h#7 integrate .. //depot/projects/vimage/src/sys/sys/mutex.h#10 integrate .. //depot/projects/vimage/src/sys/sys/param.h#17 integrate .. //depot/projects/vimage/src/sys/sys/rwlock.h#8 integrate .. //depot/projects/vimage/src/sys/sys/socketvar.h#9 integrate .. //depot/projects/vimage/src/sys/vm/vm_page.c#15 integrate Differences ... ==== //depot/projects/vimage/src/sys/amd64/amd64/pmap.c#14 (text+ko) ==== @@ -77,7 +77,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.616 2008/05/09 16:48:06 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/pmap.c,v 1.617 2008/05/11 20:33:46 alc Exp $"); /* * Manages physical address maps. @@ -4480,11 +4480,12 @@ { vm_offset_t superpage_offset; + if (size < NBPDR) + return; if (object != NULL && (object->flags & OBJ_COLORED) != 0) offset += ptoa(object->pg_color); superpage_offset = offset & PDRMASK; - if (size < superpage_offset || - size - superpage_offset < NBPDR || + if (size - ((NBPDR - superpage_offset) & PDRMASK) < NBPDR || (*addr & PDRMASK) == superpage_offset) return; if ((*addr & PDRMASK) < superpage_offset) ==== //depot/projects/vimage/src/sys/amd64/linux32/linux32_dummy.c#6 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_dummy.c,v 1.12 2008/04/23 15:56:33 rdivacky Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/linux32/linux32_dummy.c,v 1.13 2008/05/13 20:01:26 rdivacky Exp $"); #include #include @@ -98,8 +98,6 @@ DUMMY(pselect6); DUMMY(ppoll); DUMMY(unshare); -DUMMY(set_robust_list); -DUMMY(get_robust_list); DUMMY(splice); DUMMY(sync_file_range); DUMMY(tee); ==== //depot/projects/vimage/src/sys/amd64/linux32/linux32_proto.h#7 (text+ko) ==== @@ -2,8 +2,8 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/amd64/linux32/linux32_proto.h,v 1.36 2008/04/16 19:27:35 jkim Exp $ - * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.33 2008/04/16 19:25:38 jkim Exp + * $FreeBSD: src/sys/amd64/linux32/linux32_proto.h,v 1.37 2008/05/13 20:02:25 rdivacky Exp $ + * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.34 2008/05/13 20:01:26 rdivacky Exp */ #ifndef _LINUX_SYSPROTO_H_ @@ -969,10 +969,13 @@ register_t dummy; }; struct linux_set_robust_list_args { - register_t dummy; + char head_l_[PADL_(struct linux_robust_list_head *)]; struct linux_robust_list_head * head; char head_r_[PADR_(struct linux_robust_list_head *)]; + char len_l_[PADL_(l_size_t)]; l_size_t len; char len_r_[PADR_(l_size_t)]; }; struct linux_get_robust_list_args { - register_t dummy; + char pid_l_[PADL_(l_int)]; l_int pid; char pid_r_[PADR_(l_int)]; + char head_l_[PADL_(struct linux_robust_list_head *)]; struct linux_robust_list_head * head; char head_r_[PADR_(struct linux_robust_list_head *)]; + char len_l_[PADL_(l_size_t *)]; l_size_t * len; char len_r_[PADR_(l_size_t *)]; }; struct linux_splice_args { register_t dummy; ==== //depot/projects/vimage/src/sys/amd64/linux32/linux32_syscall.h#7 (text+ko) ==== @@ -2,8 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/amd64/linux32/linux32_syscall.h,v 1.36 2008/04/16 19:27:35 jkim Exp $ - * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.33 2008/04/16 19:25:38 jkim Exp + * $FreeBSD: src/sys/amd64/linux32/linux32_syscall.h,v 1.37 2008/05/13 20:02:25 rdivacky Exp $ + * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.34 2008/05/13 20:01:26 rdivacky Exp */ #define LINUX_SYS_exit 1 ==== //depot/projects/vimage/src/sys/amd64/linux32/linux32_sysent.c#7 (text+ko) ==== @@ -2,8 +2,8 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/amd64/linux32/linux32_sysent.c,v 1.36 2008/04/16 19:27:35 jkim Exp $ - * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.33 2008/04/16 19:25:38 jkim Exp + * $FreeBSD: src/sys/amd64/linux32/linux32_sysent.c,v 1.37 2008/05/13 20:02:25 rdivacky Exp $ + * created from FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.34 2008/05/13 20:01:26 rdivacky Exp */ #include "opt_compat.h" @@ -330,8 +330,8 @@ { 0, (sy_call_t *)linux_pselect6, AUE_NULL, NULL, 0, 0 }, /* 308 = linux_pselect6 */ { 0, (sy_call_t *)linux_ppoll, AUE_NULL, NULL, 0, 0 }, /* 309 = linux_ppoll */ { 0, (sy_call_t *)linux_unshare, AUE_NULL, NULL, 0, 0 }, /* 310 = linux_unshare */ - { 0, (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0 }, /* 311 = linux_set_robust_list */ - { 0, (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0 }, /* 312 = linux_get_robust_list */ + { AS(linux_set_robust_list_args), (sy_call_t *)linux_set_robust_list, AUE_NULL, NULL, 0, 0 }, /* 311 = linux_set_robust_list */ + { AS(linux_get_robust_list_args), (sy_call_t *)linux_get_robust_list, AUE_NULL, NULL, 0, 0 }, /* 312 = linux_get_robust_list */ { 0, (sy_call_t *)linux_splice, AUE_NULL, NULL, 0, 0 }, /* 313 = linux_splice */ { 0, (sy_call_t *)linux_sync_file_range, AUE_NULL, NULL, 0, 0 }, /* 314 = linux_sync_file_range */ { 0, (sy_call_t *)linux_tee, AUE_NULL, NULL, 0, 0 }, /* 315 = linux_tee */ ==== //depot/projects/vimage/src/sys/amd64/linux32/syscalls.master#7 (text+ko) ==== @@ -1,4 +1,4 @@ - $FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.33 2008/04/16 19:25:38 jkim Exp $ + $FreeBSD: src/sys/amd64/linux32/syscalls.master,v 1.34 2008/05/13 20:01:26 rdivacky Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 ; System call name/number master file (or rather, slave, from LINUX). @@ -493,8 +493,10 @@ 308 AUE_NULL STD { int linux_pselect6(void); } 309 AUE_NULL STD { int linux_ppoll(void); } 310 AUE_NULL STD { int linux_unshare(void); } -311 AUE_NULL STD { int linux_set_robust_list(void); } -312 AUE_NULL STD { int linux_get_robust_list(void); } +311 AUE_NULL STD { int linux_set_robust_list(struct linux_robust_list_head *head, \ + l_size_t len); } +312 AUE_NULL STD { int linux_get_robust_list(l_int pid, struct linux_robust_list_head *head, \ + l_size_t *len); } 313 AUE_NULL STD { int linux_splice(void); } 314 AUE_NULL STD { int linux_sync_file_range(void); } 315 AUE_NULL STD { int linux_tee(void); } ==== //depot/projects/vimage/src/sys/cddl/compat/opensolaris/sys/lock.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/cddl/compat/opensolaris/sys/lock.h,v 1.2 2008/03/28 22:16:06 jb Exp $ + * $FreeBSD: src/sys/cddl/compat/opensolaris/sys/lock.h,v 1.3 2008/05/16 02:09:13 attilio Exp $ */ #ifndef _OPENSOLARIS_SYS_LOCK_H_ @@ -35,8 +35,7 @@ #define LO_ALLMASK (LO_INITIALIZED | LO_WITNESS | LO_QUIET | \ LO_RECURSABLE | LO_SLEEPABLE | LO_UPGRADABLE | \ - LO_DUPOK | LO_ENROLLPEND | LO_CLASSMASK | \ - LO_NOPROFILE) + LO_DUPOK | LO_CLASSMASK | LO_NOPROFILE) #define LO_EXPECTED (LO_INITIALIZED | LO_WITNESS | LO_RECURSABLE | \ LO_SLEEPABLE | LO_UPGRADABLE | LO_DUPOK | \ /* sx lock class */(2 << LO_CLASSSHIFT)) ==== //depot/projects/vimage/src/sys/compat/linux/linux_emul.c#6 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_emul.c,v 1.20 2007/04/02 18:38:13 jkim Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_emul.c,v 1.21 2008/05/13 20:01:27 rdivacky Exp $"); #include "opt_compat.h" @@ -44,9 +44,6 @@ #include #include -#include -#include - #ifdef COMPAT_LINUX32 #include #include @@ -55,6 +52,9 @@ #include #endif +#include +#include + struct sx emul_shared_lock; struct mtx emul_lock; @@ -86,6 +86,7 @@ em = malloc(sizeof *em, M_LINUX, M_WAITOK | M_ZERO); em->pid = child; em->pdeath_signal = 0; + em->robust_futexes = NULL; if (flags & LINUX_CLONE_THREAD) { /* handled later in the code */ } else { @@ -161,6 +162,8 @@ if (__predict_true(p->p_sysent != &elf_linux_sysvec)) return; + release_futexes(p); + /* find the emuldata */ em = em_find(p, EMUL_DOLOCK); ==== //depot/projects/vimage/src/sys/compat/linux/linux_emul.h#5 (text+ko) ==== @@ -25,12 +25,14 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/compat/linux/linux_emul.h,v 1.7 2007/04/02 18:38:13 jkim Exp $ + * $FreeBSD: src/sys/compat/linux/linux_emul.h,v 1.8 2008/05/13 20:01:27 rdivacky Exp $ */ #ifndef _LINUX_EMUL_H_ #define _LINUX_EMUL_H_ +#include + struct linux_emuldata_shared { int refs; pid_t group_pid; @@ -52,6 +54,8 @@ int pdeath_signal; /* parent death signal */ + struct linux_robust_list_head *robust_futexes; + LIST_ENTRY(linux_emuldata) threads; /* list of linux threads */ }; ==== //depot/projects/vimage/src/sys/compat/linux/linux_futex.c#5 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_futex.c,v 1.12 2008/03/20 17:03:55 rdivacky Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_futex.c,v 1.13 2008/05/13 20:01:27 rdivacky Exp $"); #if 0 __KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.7 2006/07/24 19:01:49 manu Exp $"); #endif @@ -45,8 +45,11 @@ #include #include #include +#include #include #include +#include +#include #include #include @@ -57,6 +60,7 @@ #include #include #endif +#include #include struct futex; @@ -533,3 +537,160 @@ return (-ENOSYS); } } + +int +linux_set_robust_list(struct thread *td, struct linux_set_robust_list_args *args) +{ + struct linux_emuldata *em; + +#ifdef DEBUG + if (ldebug(set_robust_list)) + printf(ARGS(set_robust_list, "")); +#endif + if (args->len != sizeof(struct linux_robust_list_head)) + return (EINVAL); + + em = em_find(td->td_proc, EMUL_DOLOCK); + em->robust_futexes = args->head; + EMUL_UNLOCK(&emul_lock); + + return (0); +} + +int +linux_get_robust_list(struct thread *td, struct linux_get_robust_list_args *args) +{ + struct linux_emuldata *em; + struct linux_robust_list_head *head; + l_size_t len = sizeof(struct linux_robust_list_head); + int error = 0; + +#ifdef DEBUG + if (ldebug(get_robust_list)) + printf(ARGS(get_robust_list, "")); +#endif + + if (!args->pid) { + em = em_find(td->td_proc, EMUL_DONTLOCK); + head = em->robust_futexes; + } else { + struct proc *p; + + p = pfind(args->pid); + if (p == NULL) + return (ESRCH); + + em = em_find(p, EMUL_DONTLOCK); + /* XXX: ptrace? */ + if (priv_check(td, PRIV_CRED_SETUID) || + priv_check(td, PRIV_CRED_SETEUID) || + p_candebug(td, p)) + return (EPERM); + head = em->robust_futexes; + + PROC_UNLOCK(p); + } + + error = copyout(&len, args->len, sizeof(l_size_t)); + if (error) + return (EFAULT); + + error = copyout(head, args->head, sizeof(struct linux_robust_list_head)); + + return (error); +} + +static int +handle_futex_death(void *uaddr, pid_t pid, int pi) +{ + int uval, nval, mval; + struct futex *f; + +retry: + if (copyin(uaddr, &uval, 4)) + return (EFAULT); + + if ((uval & FUTEX_TID_MASK) == pid) { + mval = (uval & FUTEX_WAITERS) | FUTEX_OWNER_DIED; + nval = casuword32(uaddr, uval, mval); + + if (nval == -1) + return (EFAULT); + + if (nval != uval) + goto retry; + + if (!pi && (uval & FUTEX_WAITERS)) { + f = futex_get(uaddr, FUTEX_UNLOCKED); + futex_wake(f, 1, NULL, 0); + } + } + + return (0); +} + +static int +fetch_robust_entry(struct linux_robust_list **entry, + struct linux_robust_list **head, int *pi) +{ + l_ulong uentry; + + if (copyin((const void *)head, &uentry, sizeof(l_ulong))) + return (EFAULT); + + *entry = (void *)(uentry & ~1UL); + *pi = uentry & 1; + + return (0); +} + +/* This walks the list of robust futexes releasing them. */ +void +release_futexes(struct proc *p) +{ + struct linux_robust_list_head *head = NULL; + struct linux_robust_list *entry, *next_entry, *pending; + unsigned int limit = 2048, pi, next_pi, pip; + struct linux_emuldata *em; + l_ulong futex_offset; + int rc; + + em = em_find(p, EMUL_DONTLOCK); + head = em->robust_futexes; + + if (head == NULL) + return; + + if (fetch_robust_entry(&entry, &head->list.next, &pi)) + return; + + if (copyin(&head->futex_offset, &futex_offset, sizeof(l_ulong))) + return; + + if (fetch_robust_entry(&pending, &head->pending_list, &pip)) + return; + + while (entry != &head->list) { + rc = fetch_robust_entry(&next_entry, &entry->next, &next_pi); + + if (entry != pending) + if (handle_futex_death((char *)entry + futex_offset, + p->p_pid, pi)) + return; + + if (rc) + return; + + entry = next_entry; + pi = next_pi; + + if (!--limit) + break; + + sched_relinquish(curthread); + } + + if (pending) + handle_futex_death((char *) pending + futex_offset, + p->p_pid, pip); +} ==== //depot/projects/vimage/src/sys/compat/linux/linux_futex.h#4 (text+ko) ==== @@ -30,7 +30,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/compat/linux/linux_futex.h,v 1.3 2008/03/20 17:03:55 rdivacky Exp $ + * $FreeBSD: src/sys/compat/linux/linux_futex.h,v 1.4 2008/05/13 20:01:27 rdivacky Exp $ */ #ifndef _LINUX_FUTEX_H @@ -63,4 +63,22 @@ #define FUTEX_OP_CMP_GT 4 /* if (oldval > CMPARG) wake */ #define FUTEX_OP_CMP_GE 5 /* if (oldval >= CMPARG) wake */ +/* This is defined by Linux user-space */ + +struct linux_robust_list { + struct linux_robust_list *next; +}; + +struct linux_robust_list_head { + struct linux_robust_list list; + l_ulong futex_offset; + struct linux_robust_list *pending_list; +}; + +#define FUTEX_WAITERS 0x80000000 +#define FUTEX_OWNER_DIED 0x40000000 +#define FUTEX_TID_MASK 0x3fffffff + +void release_futexes(struct proc *); + #endif /* !_LINUX_FUTEX_H */ ==== //depot/projects/vimage/src/sys/compat/linux/linux_misc.c#15 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.220 2008/04/08 09:45:47 kib Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.221 2008/05/13 20:01:27 rdivacky Exp $"); #include "opt_compat.h" #include "opt_mac.h" @@ -77,10 +77,6 @@ #include #include -#include -#include -#include - #ifdef COMPAT_LINUX32 #include #include @@ -93,6 +89,9 @@ #include #include #include +#include +#include +#include #ifdef __i386__ #include ==== //depot/projects/vimage/src/sys/compat/ndis/subr_ndis.c#7 (text+ko) ==== @@ -31,7 +31,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.111 2008/01/13 14:43:59 attilio Exp $"); +__FBSDID("$FreeBSD: src/sys/compat/ndis/subr_ndis.c,v 1.112 2008/05/15 04:29:28 weongyo Exp $"); /* * This file implements a translation layer between the BSD networking @@ -1360,6 +1360,10 @@ block = (ndis_miniport_block *)adapter; sc = device_get_softc(block->nmb_physdeviceobj->do_devext); + if (sc->ifp == NULL) { + *status = NDIS_STATUS_FAILURE; + return; + } #ifdef IFP2ENADDR if (bcmp(IFP2ENADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0) ==== //depot/projects/vimage/src/sys/conf/NOTES#22 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/NOTES,v 1.1485 2008/05/09 23:02:55 julian Exp $ +# $FreeBSD: src/sys/conf/NOTES,v 1.1486 2008/05/16 06:50:40 benno Exp $ # # NOTES -- Lines that can be cut/pasted into kernel and hints configs. # @@ -2374,6 +2374,7 @@ options BOOTP_NFSV3 # Use NFS v3 to NFS mount root options BOOTP_COMPAT # Workaround for broken bootp daemons. options BOOTP_WIRED_TO=fxp0 # Use interface fxp0 for BOOTP +options BOOTP_BLOCKSIZE=8192 # Override NFS block size # # Add software watchdog routines. ==== //depot/projects/vimage/src/sys/conf/options#24 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/sys/conf/options,v 1.628 2008/05/09 23:02:55 julian Exp $ +# $FreeBSD: src/sys/conf/options,v 1.629 2008/05/16 06:27:03 benno Exp $ # # On the handling of kernel options # @@ -351,6 +351,7 @@ ALTQ_NOPCC opt_altq.h ALTQ_DEBUG opt_altq.h BOOTP opt_bootp.h +BOOTP_BLOCKSIZE opt_bootp.h BOOTP_COMPAT opt_bootp.h BOOTP_NFSROOT opt_bootp.h BOOTP_NFSV3 opt_bootp.h ==== //depot/projects/vimage/src/sys/dev/ath/if_ath.c#16 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.185 2008/05/03 21:55:02 sam Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.186 2008/05/12 00:15:27 sam Exp $"); /* * Driver for the Atheros Wireless LAN controller. @@ -515,7 +515,8 @@ ic->ic_phytype = IEEE80211_T_OFDM; ic->ic_opmode = IEEE80211_M_STA; ic->ic_caps = - IEEE80211_C_IBSS /* ibss, nee adhoc, mode */ + IEEE80211_C_STA /* station mode */ + | IEEE80211_C_IBSS /* ibss, nee adhoc, mode */ | IEEE80211_C_HOSTAP /* hostap mode */ | IEEE80211_C_MONITOR /* monitor mode */ | IEEE80211_C_AHDEMO /* adhoc demo mode */ ==== //depot/projects/vimage/src/sys/dev/bge/if_bge.c#13 (text+ko) ==== @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.210 2008/05/05 18:42:17 bz Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.211 2008/05/14 21:00:27 marius Exp $"); /* * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. @@ -325,6 +325,7 @@ static int bge_dma_alloc(device_t); static void bge_dma_free(struct bge_softc *); +static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]); static int bge_get_eaddr_mem(struct bge_softc *, uint8_t[]); static int bge_get_eaddr_nvram(struct bge_softc *, uint8_t[]); static int bge_get_eaddr_eeprom(struct bge_softc *, uint8_t[]); @@ -374,7 +375,7 @@ static int bge_chipinit(struct bge_softc *); static int bge_blockinit(struct bge_softc *); -static int bge_has_eeprom(struct bge_softc *); +static int bge_has_eaddr(struct bge_softc *); static uint32_t bge_readmem_ind(struct bge_softc *, int); static void bge_writemem_ind(struct bge_softc *, int, int); static void bge_writembx(struct bge_softc *, int, int); @@ -459,7 +460,7 @@ #define SPARC64_OFW_SUBVENDOR "subsystem-vendor-id" static int -bge_has_eeprom(struct bge_softc *sc) +bge_has_eaddr(struct bge_softc *sc) { #ifdef __sparc64__ char buf[sizeof(SPARC64_BLADE_1500_PATH_BGE)]; @@ -471,7 +472,7 @@ /* * The on-board BGEs found in sun4u machines aren't fitted with * an EEPROM which means that we have to obtain the MAC address - * via OFW and that some tests will always fail. We distinguish + * via OFW and that some tests will always fail. We distinguish * such BGEs by the subvendor ID, which also has to be obtained * from OFW instead of the PCI configuration space as the latter * indicates Broadcom as the subvendor of the netboot interface. @@ -493,10 +494,6 @@ return (0); } #endif - - if (sc->bge_asicrev == BGE_ASICREV_BCM5906) - return (0); - return (1); } @@ -763,8 +760,9 @@ } if (i == BGE_TIMEOUT) { - device_printf(sc->bge_dev, "PHY read timed out " - "(phy %d, reg %d, val 0x%08x)\n", phy, reg, val); + device_printf(sc->bge_dev, + "PHY read timed out (phy %d, reg %d, val 0x%08x)\n", + phy, reg, val); val = 0; goto done; } @@ -818,8 +816,8 @@ if (i == BGE_TIMEOUT) { device_printf(sc->bge_dev, - "PHY write timed out (phy %d, reg %d, val %d)\n", - phy, reg, val); + "PHY write timed out (phy %d, reg %d, val %d)\n", + phy, reg, val); return (0); } @@ -1283,10 +1281,10 @@ /* * Check the 'ROM failed' bit on the RX CPU to see if * self-tests passed. Skip this check when there's no - * EEPROM fitted, since in that case it will always - * fail. + * chip containing the Ethernet address fitted, since + * in that case it will always fail. */ - if ((sc->bge_flags & BGE_FLAG_EEPROM) && + if ((sc->bge_flags & BGE_FLAG_EADDR) && CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL) { device_printf(sc->bge_dev, "RX CPU self-diagnostics failed!\n"); return (ENODEV); @@ -2399,8 +2397,8 @@ sc->bge_chipid != BGE_CHIPID_BCM5705_A1) sc->bge_flags |= BGE_FLAG_WIRESPEED; - if (bge_has_eeprom(sc)) - sc->bge_flags |= BGE_FLAG_EEPROM; + if (bge_has_eaddr(sc)) + sc->bge_flags |= BGE_FLAG_EADDR; /* Save chipset family. */ switch (sc->bge_asicrev) { @@ -2562,20 +2560,12 @@ goto fail; } -#ifdef __sparc64__ - if (((sc->bge_flags & BGE_FLAG_EEPROM) == 0) && - (sc->bge_asicrev != BGE_ASICREV_BCM5906)) - OF_getetheraddr(dev, eaddr); - else -#endif - { - error = bge_get_eaddr(sc, eaddr); - if (error) { - device_printf(sc->bge_dev, - "failed to read station address\n"); - error = ENXIO; - goto fail; - } + error = bge_get_eaddr(sc, eaddr); + if (error) { + device_printf(sc->bge_dev, + "failed to read station address\n"); + error = ENXIO; + goto fail; } /* 5705 limits RX return ring to 512 entries. */ @@ -2647,7 +2637,8 @@ */ if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER) hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG); - else if (sc->bge_flags & BGE_FLAG_EEPROM) { + else if ((sc->bge_flags & BGE_FLAG_EADDR) && + (sc->bge_asicrev != BGE_ASICREV_BCM5906)) { if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET, sizeof(hwcfg))) { device_printf(sc->bge_dev, "failed to read EEPROM\n"); @@ -2822,9 +2813,9 @@ bge_reset(struct bge_softc *sc) { device_t dev; - uint32_t cachesize, command, pcistate, reset; + uint32_t cachesize, command, pcistate, reset, val; void (*write_op)(struct bge_softc *, int, int); - int i, val = 0; + int i; dev = sc->bge_dev; @@ -2886,14 +2877,12 @@ write_op(sc, BGE_MISC_CFG, reset); if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { - uint32_t status, ctrl; - - status = CSR_READ_4(sc, BGE_VCPU_STATUS); + val = CSR_READ_4(sc, BGE_VCPU_STATUS); CSR_WRITE_4(sc, BGE_VCPU_STATUS, - status | BGE_VCPU_STATUS_DRV_RESET); - ctrl = CSR_READ_4(sc, BGE_VCPU_EXT_CTRL); + val | BGE_VCPU_STATUS_DRV_RESET); + val = CSR_READ_4(sc, BGE_VCPU_EXT_CTRL); CSR_WRITE_4(sc, BGE_VCPU_EXT_CTRL, - ctrl & ~BGE_VCPU_EXT_CTRL_HALT_CPU); + val & ~BGE_VCPU_EXT_CTRL_HALT_CPU); } DELAY(1000); @@ -2901,11 +2890,9 @@ /* XXX: Broadcom Linux driver. */ if (sc->bge_flags & BGE_FLAG_PCIE) { if (sc->bge_chipid == BGE_CHIPID_BCM5750_A0) { - uint32_t v; - DELAY(500000); /* wait for link training to complete */ - v = pci_read_config(dev, 0xC4, 4); - pci_write_config(dev, 0xC4, v | (1 << 15), 4); + val = pci_read_config(dev, 0xC4, 4); + pci_write_config(dev, 0xC4, val | (1 << 15), 4); } /* * Set PCIE max payload size to 128 bytes and clear error @@ -2924,8 +2911,6 @@ /* Re-enable MSI, if neccesary, and enable the memory arbiter. */ if (BGE_IS_5714_FAMILY(sc)) { - uint32_t val; - /* This chip disables MSI on reset. */ if (sc->bge_flags & BGE_FLAG_MSI) { val = pci_read_config(dev, BGE_PCI_MSI_CTL, 2); @@ -2955,7 +2940,8 @@ /* * Poll until we see the 1's complement of the magic number. * This indicates that the firmware initialization is complete. - * We expect this to fail if no EEPROM is fitted though. + * We expect this to fail if no chip containing the Ethernet + * address is fitted though. */ for (i = 0; i < BGE_TIMEOUT; i++) { DELAY(10); @@ -2964,7 +2950,7 @@ break; } - if ((sc->bge_flags & BGE_FLAG_EEPROM) && i == BGE_TIMEOUT) + if ((sc->bge_flags & BGE_FLAG_EADDR) && i == BGE_TIMEOUT) device_printf(sc->bge_dev, "firmware handshake timed out, " "found 0x%08x\n", val); } @@ -3005,20 +2991,16 @@ */ if (sc->bge_asicrev == BGE_ASICREV_BCM5704 && sc->bge_flags & BGE_FLAG_TBI) { - uint32_t serdescfg; - - serdescfg = CSR_READ_4(sc, BGE_SERDES_CFG); - serdescfg = (serdescfg & ~0xFFF) | 0x880; - CSR_WRITE_4(sc, BGE_SERDES_CFG, serdescfg); + val = CSR_READ_4(sc, BGE_SERDES_CFG); + val = (val & ~0xFFF) | 0x880; + CSR_WRITE_4(sc, BGE_SERDES_CFG, val); } /* XXX: Broadcom Linux driver. */ if (sc->bge_flags & BGE_FLAG_PCIE && sc->bge_chipid != BGE_CHIPID_BCM5750_A0) { - uint32_t v; - - v = CSR_READ_4(sc, 0x7C00); - CSR_WRITE_4(sc, 0x7C00, v | (1 << 25)); + val = CSR_READ_4(sc, 0x7C00); + CSR_WRITE_4(sc, 0x7C00, val | (1 << 25)); } DELAY(10000); @@ -4725,10 +4707,23 @@ #endif static int +bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]) +{ + + if (sc->bge_flags & BGE_FLAG_EADDR) + return (1); + +#ifdef __sparc64__ + OF_getetheraddr(sc->bge_dev, ether_addr); + return (0); +#endif + return (1); +} + +static int bge_get_eaddr_mem(struct bge_softc *sc, uint8_t ether_addr[]) { uint32_t mac_addr; - int ret = 1; mac_addr = bge_readmem_ind(sc, 0x0c14); if ((mac_addr >> 16) == 0x484b) { @@ -4739,9 +4734,9 @@ ether_addr[3] = (uint8_t)(mac_addr >> 16); ether_addr[4] = (uint8_t)(mac_addr >> 8); ether_addr[5] = (uint8_t)mac_addr; - ret = 0; + return (0); } - return ret; + return (1); } static int @@ -4752,17 +4747,19 @@ if (sc->bge_asicrev == BGE_ASICREV_BCM5906) mac_offset = BGE_EE_MAC_OFFSET_5906; - return bge_read_nvram(sc, ether_addr, mac_offset + 2, ETHER_ADDR_LEN); + return (bge_read_nvram(sc, ether_addr, mac_offset + 2, + ETHER_ADDR_LEN)); } static int bge_get_eaddr_eeprom(struct bge_softc *sc, uint8_t ether_addr[]) { - if (!(sc->bge_flags & BGE_FLAG_EEPROM)) - return 1; + + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) + return (1); - return bge_read_eeprom(sc, ether_addr, BGE_EE_MAC_OFFSET + 2, - ETHER_ADDR_LEN); + return (bge_read_eeprom(sc, ether_addr, BGE_EE_MAC_OFFSET + 2, + ETHER_ADDR_LEN)); } static int @@ -4770,6 +4767,7 @@ { static const bge_eaddr_fcn_t bge_eaddr_funcs[] = { /* NOTE: Order is critical */ + bge_get_eaddr_fw, bge_get_eaddr_mem, bge_get_eaddr_nvram, bge_get_eaddr_eeprom, ==== //depot/projects/vimage/src/sys/dev/bge/if_bgereg.h#11 (text+ko) ==== @@ -30,7 +30,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.79 2008/05/05 18:42:17 bz Exp $ + * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.80 2008/05/14 21:00:27 marius Exp $ */ /* @@ -2532,7 +2532,7 @@ #define BGE_FLAG_TBI 0x00000001 #define BGE_FLAG_JUMBO 0x00000002 >>> TRUNCATED FOR MAIL (1000 lines) <<<