Merge branch 'makefile' into haiku
[grub2/phcoder.git] / kern / sparc64 / cache.S
blob1a16adde863e0e62eac7a6c43db44e0c7f9f1a56
1 /* cache.S - Flush the processor cache for a specific region.  */
2 /*
3  *  GRUB  --  GRand Unified Bootloader
4  *  Copyright (C) 2005,2007,2009  Free Software Foundation, Inc.
5  *
6  *  GRUB is free software: you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation, either version 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  GRUB is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
18  */
20 #include <grub/symbol.h>
22         .file   "cache.S"
24         .text
27  * void grub_arch_sync_caches (void *address, grub_size_t len)
28  */
29 FUNCTION(grub_arch_sync_caches)
30         brz,pn          %o1, 2f
31          add            %o0, %o1, %o1
32         add             %o1, 7, %o1
33         andn            %o1, 7, %o1
34         andn            %o0, 7, %o0
35         sub             %o1, %o0, %o1
36 1:      subcc           %o1, 8, %o1
37         bne,pt          %icc, 1b
38          flush          %o0 + %o1
39 2:      retl
40          nop