From owner-p4-projects@FreeBSD.ORG Mon Jul 17 15:15:23 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1CA0F16A4E1; Mon, 17 Jul 2006 15:15:23 +0000 (UTC) X-Original-To: perforce@FreeBSD.org 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 D2F4F16A4E0 for ; Mon, 17 Jul 2006 15:15:22 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3BA2A43D6A for ; Mon, 17 Jul 2006 15:15:22 +0000 (GMT) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6HFFMCC003090 for ; Mon, 17 Jul 2006 15:15:22 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6HFFMuq003087 for perforce@freebsd.org; Mon, 17 Jul 2006 15:15:22 GMT (envelope-from rdivacky@FreeBSD.org) Date: Mon, 17 Jul 2006 15:15:22 GMT Message-Id: <200607171515.k6HFFMuq003087@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rdivacky@FreeBSD.org using -f From: Roman Divacky To: Perforce Change Reviews Cc: Subject: PERFORCE change 101770 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: Mon, 17 Jul 2006 15:15:23 -0000 http://perforce.freebsd.org/chv.cgi?CH=101770 Change 101770 by rdivacky@rdivacky_witten on 2006/07/17 15:15:00 Several small things I have in queue: o template for SETTLS in clone o change set_thread_area() debug print to be even more sane o change get_thread() to always read segment 3 (reading segment 6 is bogus) o dont leak emuldata in a case when linux binary execs to fbsd one Affected files ... .. //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_machdep.c#16 edit Differences ... ==== //depot/projects/soc2006/rdivacky_linuxolator/i386/linux/linux_machdep.c#16 (text+ko) ==== @@ -368,6 +368,7 @@ #define CLONE_SIGHAND 0x800 #define CLONE_PID 0x1000 #define CLONE_THREAD 0x10000 +#define CLONE_SETTLS 0x80000 #define CLONE_CHILD_CLEARTID 0x00200000 #define CLONE_CHILD_SETTID 0x01000000 #define CLONE_PARENT_SETTID 0x00100000 @@ -457,6 +458,10 @@ em->child_set_tid = NULL; EMUL_RUNLOCK(&emul_lock); + if (args->flags & CLONE_SETTLS) { + /* XXX: set the TLS */ + } + PROC_LOCK(p2); p2->p_sigparent = exit_signal; PROC_UNLOCK(p2); @@ -948,7 +953,7 @@ #ifdef DEBUG if (ldebug(set_thread_area)) - printf(ARGS(set_thread_area, "%i, %i, %i, %i, %i, %i, %i, %i, %i\n"), + printf(ARGS(set_thread_area, "%i, %x, %x, %i, %i, %i, %i, %i, %i\n"), info.entry_number, info.base_addr, info.limit, @@ -1045,6 +1050,8 @@ if (idx != 6 && idx != 3) return (EINVAL); + idx = 3; + memset(&info, 0, sizeof(info)); sd = PCPU_GET(fsgs_gdt)[1]; @@ -1197,6 +1204,20 @@ if (__predict_false(imgp->sysent == &elf_linux_sysvec && p->p_sysent == &elf32_freebsd_sysvec)) linux_proc_init(FIRST_THREAD_IN_PROC(p), p->p_pid); + if (__predict_false(imgp->sysent == &elf32_freebsd_sysvec + && p->p_sysent == &elf_linux_sysvec)) { + struct linux_emuldata *em; + + em = em_find(p->p_pid, EMUL_UNLOCKED); + + if (em == NULL) { +#ifdef DEBUG + printf(LMSG("we didnt find emuldata for the execing process.\n")); +#endif + return; + } + FREE(em, M_LINUX); + } } void