1 /* 2 * Declarations for functions which are internal to the memory subsystem. 3 * 4 * Copyright 2011 Red Hat, Inc. and/or its affiliates 5 * 6 * Authors: 7 * Avi Kivity <avi@redhat.com> 8 * 9 * This work is licensed under the terms of the GNU GPL, version 2 or 10 * later. See the COPYING file in the top-level directory. 11 * 12 */ 13 14 #ifndef MEMORY_INTERNAL_H 15 #define MEMORY_INTERNAL_H 16 17 #ifndef CONFIG_USER_ONLY flatview_to_dispatch(FlatView * fv)18static inline AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv) 19 { 20 return fv->dispatch; 21 } 22 address_space_to_dispatch(AddressSpace * as)23static inline AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as) 24 { 25 return flatview_to_dispatch(address_space_to_flatview(as)); 26 } 27 28 FlatView *address_space_get_flatview(AddressSpace *as); 29 void flatview_unref(FlatView *view); 30 31 extern const MemoryRegionOps unassigned_mem_ops; 32 33 void flatview_add_to_dispatch(FlatView *fv, MemoryRegionSection *section); 34 AddressSpaceDispatch *address_space_dispatch_new(FlatView *fv); 35 void address_space_dispatch_compact(AddressSpaceDispatch *d); 36 void address_space_dispatch_free(AddressSpaceDispatch *d); 37 38 void mtree_print_dispatch(struct AddressSpaceDispatch *d, 39 MemoryRegion *root); 40 41 /* returns true if end is big endian. */ devend_big_endian(enum device_endian end)42static inline bool devend_big_endian(enum device_endian end) 43 { 44 if (end == DEVICE_NATIVE_ENDIAN) { 45 return target_big_endian(); 46 } 47 return end == DEVICE_BIG_ENDIAN; 48 } 49 50 /* enum device_endian to MemOp. */ devend_memop(enum device_endian end)51static inline MemOp devend_memop(enum device_endian end) 52 { 53 return devend_big_endian(end) ? MO_BE : MO_LE; 54 } 55 56 #endif 57 #endif 58