Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LehEI-0007pI-CB for mharc-grub-devel@gnu.org; Tue, 03 Mar 2009 21:53:06 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LehEG-0007nh-0G for grub-devel@gnu.org; Tue, 03 Mar 2009 21:53:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LehED-0007mo-Tm for grub-devel@gnu.org; Tue, 03 Mar 2009 21:53:02 -0500 Received: from [199.232.76.173] (port=33227 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LehED-0007mi-HV for grub-devel@gnu.org; Tue, 03 Mar 2009 21:53:01 -0500 Received: from [74.93.104.97] (port=55410 helo=sunset.davemloft.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LehEC-00045q-Q6 for grub-devel@gnu.org; Tue, 03 Mar 2009 21:53:01 -0500 Received: from localhost (localhost [127.0.0.1]) by sunset.davemloft.net (Postfix) with ESMTP id A882E35C050 for ; Tue, 3 Mar 2009 18:15:17 -0800 (PST) Date: Tue, 03 Mar 2009 18:15:17 -0800 (PST) Message-Id: <20090303.181517.248308747.davem@davemloft.net> To: grub-devel@gnu.org From: David Miller X-Mailer: Mew version 6.1 on Emacs 22.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Subject: [PATCH 2/7]: Fix sparc64 cache flush implementation. X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2009 02:53:04 -0000 The sparc64 cache flush implementation was wrong in so many ways. When you "save" you have to allocate at least a full register save area, which would be 128 bytes on sparc64. But we actually don't need a register window here, this is a leaf function and there are enough global and out registers available for what we need to do. The 'flush' instruction is guarenteed to operate on at least 8 bytes, so we only need to flush as many 8 byte chunks as necessary after alignment. 2009-03-03 David S. Miller * kern/sparc64/cache.S: Fix grub_arch_sync_caches implementation. --- kern/sparc64/cache.S | 22 +++++++++------------- 1 files changed, 9 insertions(+), 13 deletions(-) diff --git a/kern/sparc64/cache.S b/kern/sparc64/cache.S index 2ebb693..a8d3843 100644 --- a/kern/sparc64/cache.S +++ b/kern/sparc64/cache.S @@ -27,17 +27,13 @@ * void grub_arch_sync_caches (void *address, grub_size_t len) */ FUNCTION(grub_arch_sync_caches) - save %o6, -0xC, %o6 ! Get a new register window, - ! reserve space on stack for - ! %i0, %i1, %i2 - brz,pn %i0, return ! Return if address == 0. - nop - brz,pn %i1, return ! Return if len == 0. - clr %i2 ! index = 0. -loop: flush %i0 + %i2 ! Flush address + index. - cmp %i1, %i2 ! Compare len & index . - bpos,a,pt %xcc, loop ! If len > index, loop. - add %i2, 8, %i2 ! Go to next doubleword. -return: ret ! Restore caller's register - restore ! window and return. + brz,pn %o1, 2f + andn %o0, 7, %o0 + add %o1, 7, %o1 + andn %o1, 7, %o1 +1: subcc %o1, 8, %o1 + bne,pt %icc, 1b + flush %o0 + %o1 +2: retl + nop -- 1.6.1.2.253.ga34a