From owner-freebsd-emulation@FreeBSD.ORG Wed Apr 18 17:44:01 2007 Return-Path: X-Original-To: freebsd-emulation@FreeBSD.org Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CCBF916A402; Wed, 18 Apr 2007 17:44:01 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from anuket.mj.niksun.com (gwnew.niksun.com [65.115.46.162]) by mx1.freebsd.org (Postfix) with ESMTP id 4661413C468; Wed, 18 Apr 2007 17:44:00 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from niksun.com (anuket [10.70.0.5]) by anuket.mj.niksun.com (8.13.6/8.13.6) with ESMTP id l3IHhxCD045819; Wed, 18 Apr 2007 13:43:59 -0400 (EDT) (envelope-from jkim@FreeBSD.org) From: Jung-uk Kim To: freebsd-emulation@FreeBSD.org Date: Wed, 18 Apr 2007 13:43:54 -0400 User-Agent: KMail/1.6.2 References: <790a9fff0612190922t1f4a3fa1m44092944485297f7@mail.gmail.com> <20061219180156.GA87609@stud.fit.vutbr.cz> <790a9fff0704181019m37456143o36c82bd24f7dfe9c@mail.gmail.com> In-Reply-To: <790a9fff0704181019m37456143o36c82bd24f7dfe9c@mail.gmail.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200704181343.57111.jkim@FreeBSD.org> X-Virus-Scanned: ClamAV 0.88.6/3121/Wed Apr 18 12:24:14 2007 on anuket.mj.niksun.com X-Virus-Status: Clean Cc: Alexander Leidinger , Divacky Roman , Scot Hetzel Subject: Re: linuxolator: implement settimeofday call on FreeBSD/amd64 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Apr 2007 17:44:01 -0000 On Wednesday 18 April 2007 01:19 pm, Scot Hetzel wrote: > On 12/19/06, Divacky Roman wrote: > > On Tue, Dec 19, 2006 at 11:22:56AM -0600, Scot Hetzel wrote: > > > I noticed that the settimeofday call in the linuxolator is > > > implemented on FreeBSD/i386, but it is missing from > > > FreeBSD/amd64. The attached patch implements the function on > > > FreeBSD/amd64. > > > > makes me wonder... what is MD on this code? I dont see anything > > I finally figured out what is MD for the settimeofday call. > > On FreeBSD/i386: > > struct l_timeval = struct timeval > > for FreeBSD/amd64 > > struct l_timeval < struct timeval > > The reason for this difference is tv_sec is 32 bits on i386 and 64 > bits on amd64. > > amd64/include/_types.h: > typedef __int64_t __time_t; /* time()... */ > > i386/include/_types.h: > typedef __int32_t __time_t; /* time()... */ > > sys/_types.h: > typedef long __suseconds_t; /* microseconds (signed) > */ > > sys/_timeval.h: > typedef __time_t time_t; > typedef __suseconds_t suseconds_t; /* microseconds (signed) > */ > > struct timeval { > time_t tv_sec; /* seconds */ > suseconds_t tv_usec; /* and microseconds */ > }; > > The reason we can't use freebsd's settimeofday call directly (as > done in the i386 linuxolator) in the linuxolator for amd64 is that > the freebsd settimeofday function uses copyin, and since the > l_timeval stuct is < timeval struct, it ends up copying the tv_usec > value into tv_sec. Correct. > Attached is the current patch to add the settimeofday call to the > linuxolator for amd64. It looks okay but it has style changes as well. I will do some clean up and check it in directly to CVS. Thanks, Jung-uk Kim