unsigned long *machine_to_phys_mapping = (void *)MACH2PHYS_VIRT_START;
EXPORT_SYMBOL(machine_to_phys_mapping);
-unsigned int machine_to_phys_order;
-EXPORT_SYMBOL(machine_to_phys_order);
+unsigned long machine_to_phys_nr;
+EXPORT_SYMBOL(machine_to_phys_nr);
void __init pre_setup_arch_hook(void)
{
struct xen_machphys_mapping mapping;
- unsigned long machine_to_phys_nr_ents;
struct xen_platform_parameters pp;
init_mm.pgd = swapper_pg_dir = (pgd_t *)xen_start_info->pt_base;
if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) {
machine_to_phys_mapping = (unsigned long *)mapping.v_start;
- machine_to_phys_nr_ents = mapping.max_mfn + 1;
+ machine_to_phys_nr = mapping.max_mfn + 1;
} else
- machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES;
- machine_to_phys_order = fls(machine_to_phys_nr_ents - 1);
+ machine_to_phys_nr = MACH2PHYS_NR_ENTRIES;
+ if (machine_to_phys_mapping + machine_to_phys_nr
+ < machine_to_phys_mapping)
+ machine_to_phys_nr = (unsigned long *)NULL
+ - machine_to_phys_mapping;
if (!xen_feature(XENFEAT_auto_translated_physmap))
phys_to_machine_mapping =
#include <xen/interface/memory.h>
unsigned long *machine_to_phys_mapping;
EXPORT_SYMBOL(machine_to_phys_mapping);
-unsigned int machine_to_phys_order;
-EXPORT_SYMBOL(machine_to_phys_order);
+unsigned long machine_to_phys_nr;
+EXPORT_SYMBOL(machine_to_phys_nr);
void __init x86_64_start_kernel(char * real_mode_data)
{
struct xen_machphys_mapping mapping;
- unsigned long machine_to_phys_nr_ents;
char *s;
int i;
xen_start_info->nr_pt_frames;
machine_to_phys_mapping = (unsigned long *)MACH2PHYS_VIRT_START;
- machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES;
+ machine_to_phys_nr = MACH2PHYS_NR_ENTRIES;
if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) {
machine_to_phys_mapping = (unsigned long *)mapping.v_start;
- machine_to_phys_nr_ents = mapping.max_mfn + 1;
+ machine_to_phys_nr = mapping.max_mfn + 1;
}
- while ((1UL << machine_to_phys_order) < machine_to_phys_nr_ents )
- machine_to_phys_order++;
#if 0
for (i = 0; i < 256; i++)
*/
if (addr >= (unsigned long)machine_to_phys_mapping &&
addr < (unsigned long)(machine_to_phys_mapping +
- (1UL << machine_to_phys_order)))
+ machine_to_phys_nr))
return 1;
if (addr >= HYPERVISOR_VIRT_START && addr < HYPERVISOR_VIRT_END)
return 0;
#undef machine_to_phys_mapping
extern unsigned long *machine_to_phys_mapping;
-extern unsigned int machine_to_phys_order;
+extern unsigned long machine_to_phys_nr;
static inline unsigned long pfn_to_mfn(unsigned long pfn)
{
if (xen_feature(XENFEAT_auto_translated_physmap))
return mfn;
- if (unlikely((mfn >> machine_to_phys_order) != 0))
+ if (unlikely(mfn >= machine_to_phys_nr))
return max_mapnr;
/* The array access can fail (e.g., device space beyond end of RAM). */
#undef machine_to_phys_mapping
extern unsigned long *machine_to_phys_mapping;
-extern unsigned int machine_to_phys_order;
+extern unsigned long machine_to_phys_nr;
static inline unsigned long pfn_to_mfn(unsigned long pfn)
{
if (xen_feature(XENFEAT_auto_translated_physmap))
return mfn;
- if (unlikely((mfn >> machine_to_phys_order) != 0))
+ if (unlikely(mfn >= machine_to_phys_nr))
return end_pfn;
/* The array access can fail (e.g., device space beyond end of RAM). */