debuggers.hg

view xen/include/asm-x86/fixmap.h @ 22855:1d1eec7e1fb4

xl: Perform minimal validation of virtual disk file while parsing config file

This patch performs some very basic validation on the virtual disk
file passed through the config file. This validation ensures that we
don't go too far with the initialization like spawn qemu and more
while there could be some potentially fundamental issues.

[ Patch fixed up to work with PHYSTYPE_EMPTY 22808:6ec61438713a -iwj ]

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Kamala Narasimhan <kamala.narasimhan@gmail.com>
date Tue Jan 25 18:09:49 2011 +0000 (2011-01-25)
parents b48d8f27fca2
children
line source
1 /*
2 * fixmap.h: compile-time virtual memory allocation
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * Copyright (C) 1998 Ingo Molnar
9 * Modifications for Xen are copyright (c) 2002-2004, K A Fraser
10 */
12 #ifndef _ASM_FIXMAP_H
13 #define _ASM_FIXMAP_H
15 #include <xen/config.h>
16 #include <asm/apicdef.h>
17 #include <asm/acpi.h>
18 #include <asm/page.h>
19 #include <xen/kexec.h>
20 #include <xen/iommu.h>
21 #include <asm/amd-iommu.h>
22 #include <asm/msi.h>
23 #include <acpi/apei.h>
25 /*
26 * Here we define all the compile-time 'special' virtual
27 * addresses. The point is to have a constant address at
28 * compile time, but to set the physical address only
29 * in the boot process. We allocate these special addresses
30 * from the end of virtual memory backwards.
31 */
32 enum fixed_addresses {
33 FIX_RESERVED, /* Index 0 is reserved since fix_to_virt(0) > FIXADDR_TOP. */
34 #ifdef __i386__
35 FIX_PAE_HIGHMEM_0,
36 FIX_PAE_HIGHMEM_END = FIX_PAE_HIGHMEM_0 + NR_CPUS-1,
37 #endif
38 FIX_APIC_BASE,
39 FIX_IO_APIC_BASE_0,
40 FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,
41 FIX_ACPI_BEGIN,
42 FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
43 FIX_HPET_BASE,
44 FIX_CYCLONE_TIMER,
45 FIX_KEXEC_BASE_0,
46 FIX_KEXEC_BASE_END = FIX_KEXEC_BASE_0 \
47 + ((KEXEC_XEN_NO_PAGES >> 1) * KEXEC_IMAGE_NR) - 1,
48 FIX_IOMMU_REGS_BASE_0,
49 FIX_IOMMU_REGS_END = FIX_IOMMU_REGS_BASE_0 + MAX_IOMMUS-1,
50 FIX_IOMMU_MMIO_BASE_0,
51 FIX_IOMMU_MMIO_END = FIX_IOMMU_MMIO_BASE_0 + IOMMU_PAGES -1,
52 FIX_TBOOT_SHARED_BASE,
53 FIX_MSIX_IO_RESERV_BASE,
54 FIX_MSIX_IO_RESERV_END = FIX_MSIX_IO_RESERV_BASE + FIX_MSIX_MAX_PAGES -1,
55 FIX_TBOOT_MAP_ADDRESS,
56 FIX_APEI_RANGE_BASE,
57 FIX_APEI_RANGE_END = FIX_APEI_RANGE_BASE + FIX_APEI_RANGE_MAX -1,
58 FIX_IGD_MMIO,
59 __end_of_fixed_addresses
60 };
62 #define FIXADDR_TOP (IOREMAP_VIRT_END - PAGE_SIZE)
63 #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
64 #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
66 extern void __set_fixmap(
67 enum fixed_addresses idx, unsigned long mfn, unsigned long flags);
69 #define set_fixmap(idx, phys) \
70 __set_fixmap(idx, (phys)>>PAGE_SHIFT, PAGE_HYPERVISOR)
72 #define set_fixmap_nocache(idx, phys) \
73 __set_fixmap(idx, (phys)>>PAGE_SHIFT, PAGE_HYPERVISOR_NOCACHE)
75 #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
76 #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
78 #define fix_to_virt(x) (__fix_to_virt(x))
80 static inline unsigned long virt_to_fix(const unsigned long vaddr)
81 {
82 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
83 return __virt_to_fix(vaddr);
84 }
86 #endif