|
|
1.1 ! root 1: ! 2: /* ! 3: * Copyright (C) 2006-2009, 2011 Free Software Foundation ! 4: * ! 5: * This program is free software ; you can redistribute it and/or modify ! 6: * it under the terms of the GNU General Public License as published by ! 7: * the Free Software Foundation ; either version 2 of the License, or ! 8: * (at your option) any later version. ! 9: * ! 10: * This program is distributed in the hope that it will be useful, ! 11: * but WITHOUT ANY WARRANTY ; without even the implied warranty of ! 12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 13: * GNU General Public License for more details. ! 14: * ! 15: * You should have received a copy of the GNU General Public License ! 16: * along with the program ; if not, write to the Free Software ! 17: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ! 18: */ ! 19: ! 20: #ifndef _MACH_XEN_H ! 21: #define _MACH_XEN_H ! 22: #ifdef MACH_XEN ! 23: #include <sys/types.h> ! 24: #include <xen/public/xen.h> ! 25: #include <i386/vm_param.h> ! 26: ! 27: extern struct start_info boot_info; ! 28: ! 29: extern volatile struct shared_info hyp_shared_info; ! 30: ! 31: #ifdef MACH_PV_PAGETABLES ! 32: /* Memory translations */ ! 33: ! 34: /* pa are physical addresses, from 0 to size of memory */ ! 35: /* ma are machine addresses, i.e. _real_ hardware adresses */ ! 36: /* la are linear addresses, i.e. without segmentation */ ! 37: ! 38: /* This might also be useful out of Xen */ ! 39: #if VM_MIN_KERNEL_ADDRESS != LINEAR_MIN_KERNEL_ADDRESS ! 40: extern unsigned long la_shift; ! 41: #else ! 42: #define la_shift LINEAR_MIN_KERNEL_ADDRESS ! 43: #endif ! 44: #define la_to_pa(a) ((vm_offset_t)(((vm_offset_t)(a)) - la_shift)) ! 45: #define pa_to_la(a) ((vm_offset_t)(((vm_offset_t)(a)) + la_shift)) ! 46: ! 47: #define kv_to_la(a) pa_to_la(_kvtophys(a)) ! 48: #define la_to_kv(a) phystokv(la_to_pa(a)) ! 49: ! 50: #ifdef MACH_PSEUDO_PHYS ! 51: #if PAE ! 52: #define PFN_LIST MACH2PHYS_VIRT_START_PAE ! 53: #else ! 54: #define PFN_LIST MACH2PHYS_VIRT_START_NONPAE ! 55: #endif ! 56: #if VM_MIN_KERNEL_ADDRESS != LINEAR_MIN_KERNEL_ADDRESS ! 57: extern unsigned long *pfn_list; ! 58: #else ! 59: #define pfn_list ((unsigned long *) PFN_LIST) ! 60: #endif ! 61: #define mfn_to_pfn(n) (pfn_list[n]) ! 62: ! 63: extern unsigned long *mfn_list; ! 64: #define pfn_to_mfn(n) (mfn_list[n]) ! 65: #else ! 66: #define mfn_to_pfn(n) (n) ! 67: #define pfn_to_mfn(n) (n) ! 68: #endif /* MACH_PSEUDO_PHYS */ ! 69: ! 70: #define pa_to_mfn(a) (pfn_to_mfn(atop(a))) ! 71: #ifdef PAE ! 72: #define pa_to_ma(a) ({ vm_offset_t __a = (vm_offset_t) (a); (((pt_entry_t) pa_to_mfn(__a)) << PAGE_SHIFT) | (__a & PAGE_MASK); }) ! 73: #define ma_to_pa(a) ({ pt_entry_t __a = (pt_entry_t) (a); (mfn_to_pfn(__a >> PAGE_SHIFT) << PAGE_SHIFT) | (__a & PAGE_MASK); }) ! 74: #else ! 75: #define pa_to_ma(a) ({ vm_offset_t __a = (vm_offset_t) (a); ptoa(pa_to_mfn(__a)) | (__a & PAGE_MASK); }) ! 76: #define ma_to_pa(a) ({ vm_offset_t __a = (vm_offset_t) (a); (mfn_to_pfn(atop((__a))) << PAGE_SHIFT) | (__a & PAGE_MASK); }) ! 77: #endif ! 78: ! 79: #define kv_to_mfn(a) pa_to_mfn(_kvtophys(a)) ! 80: #define kv_to_ma(a) pa_to_ma(_kvtophys(a)) ! 81: #else /* MACH_PV_PAGETABLES */ ! 82: #define mfn_to_pfn(n) (n) ! 83: #define pfn_to_mfn(n) (n) ! 84: #endif /* MACH_PV_PAGETABLES */ ! 85: ! 86: #define mfn_to_kv(mfn) phystokv(ptoa(mfn_to_pfn(mfn))) ! 87: ! 88: #include <machine/xen.h> ! 89: ! 90: #endif /* MACH_XEN */ ! 91: #endif /* _MACH_XEN_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.