From owner-p4-projects@FreeBSD.ORG Fri Sep 29 13:57:45 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 E3C7D16A4F1; Fri, 29 Sep 2006 13:57:44 +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 6807016A4A0 for ; Fri, 29 Sep 2006 13:57:44 +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 4919243E5B for ; Fri, 29 Sep 2006 13:55:56 +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 k8TDtu7N080539 for ; Fri, 29 Sep 2006 13:55:56 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k8TDtudD080536 for perforce@freebsd.org; Fri, 29 Sep 2006 13:55:56 GMT (envelope-from rdivacky@FreeBSD.org) Date: Fri, 29 Sep 2006 13:55:56 GMT Message-Id: <200609291355.k8TDtudD080536@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 106886 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, 29 Sep 2006 13:57:45 -0000 http://perforce.freebsd.org/chv.cgi?CH=106886 Change 106886 by rdivacky@rdivacky_witten on 2006/09/29 13:55:30 Use the "base_addr" from the given descriptor instead of translating it to fbsd one and then back. Affected files ... .. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#6 edit Differences ... ==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_machdep.c#6 (text+ko) ==== @@ -635,7 +635,6 @@ if (args->flags & CLONE_SETTLS) { struct l_user_desc info; int idx; - int a[2]; struct segment_descriptor sd; error = copyin((void *)td->td_frame->tf_rsi, &info, sizeof(struct l_user_desc)); @@ -660,28 +659,10 @@ return (error); } - a[0] = LDT_entry_a(&info); - a[1] = LDT_entry_b(&info); - - memcpy(&sd, &a, sizeof(a)); -#ifdef DEBUG - if (ldebug(clone)) - printf("Segment created in clone with CLONE_SETTLS: lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, type: %i, dpl: %i, p: %i, xx: %i, def32: %i, gran: %i\n", sd.sd_lobase, - sd.sd_hibase, - sd.sd_lolimit, - sd.sd_hilimit, - sd.sd_type, - sd.sd_dpl, - sd.sd_p, - sd.sd_xx, - sd.sd_def32, - sd.sd_gran); -#endif - /* this is taken from amd64 version of cpu_set_user_tls() */ critical_enter(); /* set %gs */ - td->td_pcb->pcb_gsbase = (register_t)((register_t)sd.sd_hibase << 24 | sd.sd_lobase); + td->td_pcb->pcb_gsbase = (register_t)info.base_addr; #if 0 wrmsr(MSR_KGSBASE, td->td_pcb->pcb_fsbase); #endif @@ -1203,7 +1184,6 @@ struct l_user_desc info; int error; int idx; - int a[2]; struct segment_descriptor sd; error = copyin(args->desc, &info, sizeof(struct l_user_desc)); @@ -1259,33 +1239,9 @@ if (error) return (error); - if (LDT_empty(&info)) { - a[0] = 0; - a[1] = 0; - } else { - a[0] = LDT_entry_a(&info); - a[1] = LDT_entry_b(&info); - } - - memcpy(&sd, &a, sizeof(a)); -#ifdef DEBUG - if (ldebug(set_thread_area)) - printf("Segment created in set_thread_area: lobase: %x, hibase: %x, lolimit: %x, hilimit: %x, type: %i, dpl: %i, p: %i, xx: %i, def32: %i, gran: %i\n", sd.sd_lobase, - sd.sd_hibase, - sd.sd_lolimit, - sd.sd_hilimit, - sd.sd_type, - sd.sd_dpl, - sd.sd_p, - sd.sd_xx, - sd.sd_def32, - sd.sd_gran); -#endif - - /* this is taken from amd64 version of cpu_set_user_tls() */ critical_enter(); /* set %gs */ - td->td_pcb->pcb_gsbase = (register_t)((register_t)sd.sd_hibase << 24 | sd.sd_lobase); + td->td_pcb->pcb_gsbase = (register_t)info.base_addr; wrmsr(MSR_KGSBASE, td->td_pcb->pcb_gsbase); critical_exit();