Changes in kernel/generic/src/ddi/ddi.c [9d58539:f72906c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ddi/ddi.c
r9d58539 rf72906c 314 314 315 315 NO_TRACE static int dmamem_map(uintptr_t virt, size_t size, unsigned int map_flags, 316 unsigned int flags, void **phys)316 unsigned int flags, uintptr_t *phys) 317 317 { 318 318 ASSERT(TASK); … … 322 322 } 323 323 324 NO_TRACE static int dmamem_map_anonymous(size_t size, unsigned int map_flags, 325 unsigned int flags, void **phys, uintptr_t *virt, uintptr_t bound) 324 NO_TRACE static int dmamem_map_anonymous(size_t size, uintptr_t constraint, 325 unsigned int map_flags, unsigned int flags, uintptr_t *phys, 326 uintptr_t *virt, uintptr_t bound) 326 327 { 327 328 ASSERT(TASK); 328 329 329 size_t pages = SIZE2FRAMES(size); 330 uint8_t order; 331 332 /* We need the 2^order >= pages */ 333 if (pages == 1) 334 order = 0; 335 else 336 order = fnzb(pages - 1) + 1; 337 338 *phys = frame_alloc_noreserve(order, 0); 339 if (*phys == NULL) 330 size_t frames = SIZE2FRAMES(size); 331 *phys = frame_alloc(frames, FRAME_NO_RESERVE, constraint); 332 if (*phys == 0) 340 333 return ENOMEM; 341 334 342 335 mem_backend_data_t backend_data; 343 backend_data.base = (uintptr_t)*phys;344 backend_data.frames = pages;336 backend_data.base = *phys; 337 backend_data.frames = frames; 345 338 346 339 if (!as_area_create(TASK->as, map_flags, size, 347 340 AS_AREA_ATTR_NONE, &phys_backend, &backend_data, virt, bound)) { 348 frame_free_noreserve( (uintptr_t) *phys);341 frame_free_noreserve(*phys, frames); 349 342 return ENOMEM; 350 343 } … … 373 366 */ 374 367 375 void *phys;368 uintptr_t phys; 376 369 int rc = dmamem_map((uintptr_t) virt_ptr, size, map_flags, 377 370 flags, &phys); … … 390 383 */ 391 384 392 void *phys; 385 uintptr_t constraint; 386 int rc = copy_from_uspace(&constraint, phys_ptr, 387 sizeof(constraint)); 388 if (rc != EOK) 389 return rc; 390 391 uintptr_t phys; 393 392 uintptr_t virt = (uintptr_t) -1; 394 int rc = dmamem_map_anonymous(size, map_flags, flags,393 rc = dmamem_map_anonymous(size, constraint, map_flags, flags, 395 394 &phys, &virt, bound); 396 395 if (rc != EOK)
Note:
See TracChangeset
for help on using the changeset viewer.