1
/* cache.S - Flush the processor cache for a specific region. */
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 2004,2007,2010 Free Software Foundation, Inc.
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.
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.
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/>.
20
#undef CACHE_LINE_BYTES
21
#define CACHE_LINE_BYTES 32
23
/* `address' may not be CACHE_LINE_BYTES-aligned. */
24
andi. 6, 3, CACHE_LINE_BYTES - 1 /* Find the misalignment. */
25
add 4, 4, 6 /* Adjust `size' to compensate. */
27
/* Force the dcache lines to memory. */
30
addi 5, 5, CACHE_LINE_BYTES
33
sync /* Force all dcbsts to complete. */
35
/* Invalidate the icache lines. */
38
addi 5, 5, CACHE_LINE_BYTES
41
sync /* Force all icbis to complete. */
42
isync /* Discard partially executed instructions that were
43
loaded from the invalid icache. */