00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*- 00002 00003 #ifndef mapped_alloc_h 00004 #define mapped_alloc_h 00005 00006 #include <cstddef> // size_t 00007 00008 #include "kern_types.h" // P_ptr 00009 00010 // 00011 // INTERFACE definition follows 00012 // 00013 00014 00015 00016 class Mapped_allocator 00017 { 00018 public: 00020 virtual void *alloc(size_t order) = 0; 00021 00023 virtual void free(size_t order, void *p) = 0; 00024 00025 virtual void *unaligned_alloc(int pages) = 0; 00026 virtual void unaligned_free(int pages, void *p) = 0; 00027 private: 00028 static Mapped_allocator *_alloc; 00029 00030 public: 00031 static Mapped_allocator * allocator(); 00032 00033 inline void free_phys(size_t s, P_ptr<void> p); 00034 00035 protected: 00036 static void allocator(Mapped_allocator *a); 00037 }; 00038 00039 // 00040 // IMPLEMENTATION includes follow (for use by inline functions) 00041 // 00042 00043 00044 #include "mem_layout.h" 00045 00046 // 00047 // IMPLEMENTATION of inline functions (and needed classes) 00048 // 00049 00050 00051 00052 00053 inline void Mapped_allocator::free_phys(size_t s, P_ptr<void> p) 00054 { 00055 void *va = (void*)Mem_layout::phys_to_pmem(p.get_unsigned()); 00056 if(va) 00057 free(s, va); 00058 } 00059 00060 #endif // mapped_alloc_h