Changes in uspace/drv/uhci-hcd/utils/malloc32.h [001b152:46d12fb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/utils/malloc32.h
r001b152 r46d12fb 40 40 #include <as.h> 41 41 42 #include "slab.h"43 44 42 #define UHCI_STRCUTURES_ALIGNMENT 16 45 43 #define UHCI_REQUIRED_PAGE_SIZE 4096 46 47 44 48 45 /** Get physical address translation … … 57 54 58 55 uintptr_t result; 59 const int ret = as_get_physical_mapping(addr, &result); 60 assert(ret == EOK); 56 int ret = as_get_physical_mapping(addr, &result); 61 57 62 58 if (ret != EOK) … … 70 66 * @return Address of the alligned and big enough memory place, NULL on failure. 71 67 */ 72 static inline void * malloc32(size_t size) { 73 if (size <= SLAB_ELEMENT_SIZE) 74 return slab_malloc_g(); 75 assert(false); 76 return memalign(UHCI_STRCUTURES_ALIGNMENT, size); 77 } 68 static inline void * malloc32(size_t size) 69 { return memalign(UHCI_STRCUTURES_ALIGNMENT, size); } 78 70 /*----------------------------------------------------------------------------*/ 79 71 /** Physical mallocator simulator … … 81 73 * @param[in] addr Address of the place allocated by malloc32 82 74 */ 83 static inline void free32(void *addr) { 84 if (!addr) 85 return; 86 if (slab_in_range_g(addr)) 87 return slab_free_g(addr); 88 free(addr); 89 } 75 static inline void free32(void *addr) 76 { if (addr) free(addr); } 90 77 /*----------------------------------------------------------------------------*/ 91 78 /** Create 4KB page mapping … … 95 82 static inline void * get_page(void) 96 83 { 97 void * free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);98 assert(free_address); /* TODO: remove this assert */84 void * free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE); 85 assert(free_address); 99 86 if (free_address == 0) 100 87 return NULL; 101 void *ret = as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE, 88 void* ret = 89 as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE, 102 90 AS_AREA_READ | AS_AREA_WRITE); 103 91 if (ret != free_address)
Note:
See TracChangeset
for help on using the changeset viewer.