From owner-freebsd-arm@FreeBSD.ORG Sun Oct 18 11:36:28 2009 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 362DD106566B; Sun, 18 Oct 2009 11:36:28 +0000 (UTC) (envelope-from gballet@gmail.com) Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.27]) by mx1.freebsd.org (Postfix) with ESMTP id 94BFF8FC0C; Sun, 18 Oct 2009 11:36:27 +0000 (UTC) Received: by ey-out-2122.google.com with SMTP id 9so770249eyd.9 for ; Sun, 18 Oct 2009 04:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Khu0evFpU9BqGjgIBP5d/yYWIm8dB3eAJ1owxvLXEEM=; b=BeMMVQQdJnHwCQV8Svqnykd7uLllTGcTkV0EDlB2YxmHHt1WpYbueIz9KBeuLeuo7R F8KymHPjtMK8C2WvWsTtstJSFrRI8OhzFZNttUMST/fK/+daLOR5XQjO6requ81727PU 3RtN9W5z6bm6nplgjdBg1A/I+NAyt9OLOegX0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=eiyztnzvlCaGwpUFIfY4Uectn688317Isw3UPxjwif9PqM7T8Dmmmvqm2eWIQyDdSK wY/7qlHBUP9Emz13CcMOahiuVYhmPuSYm98kDvUyTkxh+XgYX+0hLXIKJ+gJdEToI6U1 ixWv3PfoTveAUCAKemI0OciLDMeh8Iy0YVS1E= MIME-Version: 1.0 Received: by 10.211.174.10 with SMTP id b10mr4267576ebp.39.1255865785997; Sun, 18 Oct 2009 04:36:25 -0700 (PDT) In-Reply-To: <200910122129.n9CLTHsp087996@casselton.net> References: <200910122129.n9CLTHsp087996@casselton.net> Date: Sun, 18 Oct 2009 13:36:25 +0200 Message-ID: From: Guillaume Ballet To: Mark Tinguely Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-arm@freebsd.org, stas@deglitch.com Subject: Re: Adding members to struct cpu_functions X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Oct 2009 11:36:28 -0000 On Mon, Oct 12, 2009 at 11:29 PM, Mark Tinguely wr= ote: > >> =A0As a result, extending the struct cpu_functions is not a good thing >> =A0either, for the same reason. The compiler can not inline a call >> =A0through a function pointer. >> >> =A0In which case, why not create a bunch of headers files with the >> =A0pattern cpufunc_myarch.h, in which all functions would be declared >> =A0inline? Something like: >> >> =A0static inline l2_l_entry(vm_addr_t pa, int prot, int cache); >> =A0static inline l2_s_entry(vm_addr_t pa, int prot, int cache); >> =A0... >> =A0which would then be included by pmap.c and friends. > > I think they need to be regular function calls because assembly routines > call the per-cpu functions. A few simple macros would save the branch to = NOP > functions. > I'm not sure what you mean by that: would macros be ok, in your opinion? I am a bit puzzled because I see a contradiction with the previous sentence that requires the functions to be callable from the assembly code. Obviously I am misinterpreting, so would you mind clarifying, please? I think it is important to notice that even though cache management relies a lot on assembly function, I haven't found any page table management done in assembly past locore.S. I think using macros for page table management functions can be done. For cache management, however, I agree that having different pmap.c files is probably the way to go. In both cases, I am still curious to see what Nathan will come up with. I took a more thorough look at pmap, and there is indeed lots of machine-specific code, especially at the beginning. And when it comes to cpufunc, it's all about #ifdefs. Since I'm still working on the cleanup for the beagleboard, I will declare cpufuncs in an armv6-specific file. Let's call it cpufunc_armv6.c. I am struggling with another MMU problem at the moment, but I'll try to come up asap with a patch for pmap.c. It will replace hardcoded values with machine-defined macros, for reference. Guillaume