Changeset a8e96683 in mainline
- Timestamp:
- 2011-01-28T15:46:21Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d1984e0
- Parents:
- 10f479ae
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci/utils/malloc32.h
r10f479ae ra8e96683 37 37 #include <usb/usbmem.h> 38 38 39 #include <assert.h> 40 #include <malloc.h> 41 #include <mem.h> 42 #include <as.h> 43 39 44 static inline void * addr_to_phys(void *addr) 40 { return mman_getPA(addr); } 45 { 46 uintptr_t result; 47 int ret = as_get_physical_mapping(addr, &result); 48 assert(ret == 0); 49 return (void*)result; 50 } 41 51 42 52 static inline void * malloc32(size_t size) 43 /* TODO: tis is ugly */ 44 { return mman_malloc(size, 128, 0xffffffff); } 53 /* TODO: this is ugly */ 54 { return memalign(size, 128); } 55 56 static inline void * get_page() 57 { 58 void * free_address = as_get_mappable_page(4096); 59 assert(free_address); 60 if (free_address == 0) 61 return 0; 62 void* ret = 63 as_area_create(free_address, 4096, AS_AREA_READ | AS_AREA_WRITE |AS_AREA_CACHEABLE); 64 if (ret != free_address) 65 return 0; 66 return ret; 67 } 68 69 static inline void * memalign32(size_t size, size_t alignment) 70 { return memalign(size, alignment); } 45 71 46 72 static inline void free32(void * addr) 47 { mman_free(addr); }73 { free(addr); } 48 74 49 75 #endif
Note:
See TracChangeset
for help on using the changeset viewer.