From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 25 18:26:58 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC7BF106564A for ; Tue, 25 Nov 2008 18:26:58 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: from gv-out-0910.google.com (gv-out-0910.google.com [216.239.58.189]) by mx1.freebsd.org (Postfix) with ESMTP id 4E4EB8FC0C for ; Tue, 25 Nov 2008 18:26:58 +0000 (UTC) (envelope-from bsd.quest@googlemail.com) Received: by gv-out-0910.google.com with SMTP id n8so45014gve.39 for ; Tue, 25 Nov 2008 10:26:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:reply-to:mail-followup-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=g+fnkmfcJvimqqHEjQejYKzcO/UKvMQChEKb/cebGos=; b=Pog9Qoa6L0dPHl8d1EMrw5DBtXjkZuq2ERY9xtwiz0xOkakmf+XnHsoFWksa4+XcjX X/4iH70iVLCfXeHspSU24LMIGXjLgjErXKMFFJAMi5F8xld9qFXiySqGgglULGLvYPh6 d1w9ZfZ+Y/+2WrKkSLbK7Nr8hv09yq1Tr7iNU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:subject:message-id:reply-to:mail-followup-to :references:mime-version:content-type:content-disposition :in-reply-to:user-agent; b=T5sGr9O9b86FT49lNlRLjRZ5DzuSsi62qumRSsg+QOFgNkB1UUqdbSVKEAzCUFECD3 /5X/o9LNWplvinnz2vaqnT97X8KSvQx7y6Mm4PKrY9Q7zXmTevMjpb3h8X49n3WYgWXA M5bpI6DtrBvASGw8RvQx2lR+x6758GBKQZdvs= Received: by 10.103.121.19 with SMTP id y19mr1726767mum.56.1227637616992; Tue, 25 Nov 2008 10:26:56 -0800 (PST) Received: from localhost (BAJ43d7.baj.pppool.de [77.137.67.215]) by mx.google.com with ESMTPS id j2sm8134593mue.35.2008.11.25.10.26.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 25 Nov 2008 10:26:56 -0800 (PST) Date: Tue, 25 Nov 2008 19:26:27 +0100 From: Alexej Sokolov To: freebsd-hackers@freebsd.org Message-ID: <20081125182627.GA4223@debian.samsung.router> Mail-Followup-To: freebsd-hackers@freebsd.org References: <20081125173750.GA4131@debian.samsung.router> <200811251855.44853.max@love2party.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <200811251855.44853.max@love2party.net> User-Agent: Mutt/1.5.18 (2008-05-17) Subject: Re: copy, copyin, copyout X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Alexej Sokolov List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 18:26:58 -0000 On Tue, Nov 25, 2008 at 06:55:21PM +0100, Max Laier wrote: > On Tuesday 25 November 2008 18:37:50 Alexej Sokolov wrote: > > Hello, > > could anyone please explain to me the difference between functions: > > copystr() and copyinstr() ? > > > > For i386 copyinstr is implemented in assembler. I can not read > > the assembler code very well. > > > > I tried to allocate a memory in space of user process using vm_map_find > > and then with copystr() I could copy data between user and kernel > > memory. copystr() seemed to be able to do the same what copyinstr do. > > You might get lucky with copystr() if the user page is already resident, but > if you page fault copystr() will kill the kernel. copyinstr() handles page > faults. Thanks a lot! I was lucky because I wired allocated pages before. > > -- > /"\ Best regards, | mlaier@freebsd.org > \ / Max Laier | ICQ #67774661 > X http://pf4freebsd.love2party.net/ | mlaier@EFnet > / \ ASCII Ribbon Campaign | Against HTML Mail and News -- Alexej Sokolov