]> git.proxmox.com Git - grub2.git/blob - grub-core/kern/ia64/cache.c
Import grub2_2.02+dfsg1.orig.tar.xz
[grub2.git] / grub-core / kern / ia64 / cache.c
1 /* init.c - initialize an ia64-based EFI system */
2 /*
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2008 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 */
19
20 #include <grub/types.h>
21 #include <grub/cache.h>
22
23 void
24 grub_arch_sync_caches (void *address, grub_size_t len)
25 {
26 /* Cache line length is at least 32. */
27 len += (grub_uint64_t)address & 0x1f;
28 grub_uint64_t a = (grub_uint64_t)address & ~0x1f;
29
30 /* Flush data. */
31 for (len = (len + 31) & ~0x1f; len > 0; len -= 0x20, a += 0x20)
32 asm volatile ("fc.i %0" : : "r" (a));
33 /* Sync and serialize. Maybe extra. */
34 asm volatile (";; sync.i;; srlz.i;;");
35 }